question

Jason P2 avatar image
0 Likes"
Jason P2 asked Jason P2 commented

Updating Object Properties


I have a source that creates a token once a variable on my Task executer changes. When this happens I want to reduce the speed of the task executer I am using Astar. What is the correct syntax in the custom code? Is it "Object.setProperty"?


1629990597439.png

FlexSim 21.1.5
flexsim 21.1.5changing object properties
1629990597439.png (53.1 KiB)
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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Jason P2 commented

Yes, it's either

Object.setProperty("MaxSpeed", <newValue>);

or

Object.setVariable("maxspeed", <newValue>);

Be aware that the change will only take effect at the start of the next travel task.

· 2
5 |100000

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

Jason P2 avatar image Jason P2 commented ·

1629996682953.png


i am getting Invalid type (invalid) for call to method setVariable

0 Likes 0 ·
1629996682953.png (6.3 KiB)
Felix Möhlmann avatar image Felix Möhlmann Jason P2 commented ·
"Object" has to be replaced with a reference to the object you want to change the variable on (task executer).

Based on the screenshot in your post, that would be "token.Bolt" in your case. If you still get an error message try adding ".as(Object)" into the command like this:

token.Bolt.as(Object).setVariable("maxspeed", 0.5)

0 Likes 0 ·