question

Joerg Vogel avatar image
2 Likes"
Joerg Vogel asked Matthew Gillespie edited

How to get access to the variables of an object by dot syntax?

I have found these two ways to get access to the variables tree of an object

Object op = model().find("Operator1");
pf(op.attrs.variables.find("maxspeed").value);

and

Object op = model().find("Operator1");
pf(getvarnum(op, "maxspeed"));

Are there other methods to get access to the variables tree items besides the numerical approach?

FlexSim 17.0.0
dot syntaxvariables
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Matthew Gillespie avatar image
4 Likes"
Matthew Gillespie answered Matthew Gillespie edited

These are correct. You could also do this with just a path:

treenode op = model().find("Operator1");
pf(op.find(">variables/maxspeed").value);

With dot syntax we've tried to bring forward the things users use the most (i.e. labels), but variables are more of a developer thing so we haven't yet made an easy way to access them.

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.