Error with SetValue in AnyPyTools

Hi,

I am working with AnyPyTools and Plug-in-gait_simple FullBody_GRFPrediction model.
I want to change some values like sRelOpt or markers, angle values of loading posture, and some external forces before running the studies. However, as I run this piece of simple code I get an error.
Code:

from anypytools import AnyMacro, AnyPyProcess, macro_commands as mc
import numpy as np

macro_list = [
    mc.Load('FullBody_GRFPrediction.main.any'),
    mc.SetValue("Main.ModelSetup.MocapDrivers.LPSI.sRelOpt", np.array([0,0,0])),
    mc.OperationRun('Main.RunAnalysis')
]

app = AnyPyProcess()
app.start_macro(macro_list)

Error:

'sRelOpt' : 'Set Value' operation on this value-object is not allowed

I really have to modify these values, but it seems like I can't. What should I do now knowing that it is not desired to change the structure of my model?

Best regards,
Mohammadreza

Hi @mrb9

In order to use a set value operation on a variable is has to support it.
In AnyBody there are different evaluation moments controlling the construction of the model.
In order to support the set value operation a variable must be a DesignVar.
Some variables are by default and some can be cast to it.

Try to wrap the value of the sRelOpt like this sRelOpt = DesignVar(0.0); This will cast the variable to the design variable evaluation moment and hopefully help your script.

You can read more on the evaluation moments in the anybody reference manual under Help.

Best regards,
Bjørn

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.