question

Kari Payton avatar image
0 Likes"
Kari Payton asked Matthew Gillespie answered

Change speed variables on created objects.

Is there a way to change objects' speeds after created in process flow?

I tried a custom code, but no success.

double maxSpeed = getvarnum(item, "maxspeed");
maxSpeed = 2;
FlexSim 17.2.2
flexsim commands
change-speed.png (213.0 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

Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered

In your example, maxSpeed is just a local variable, so setting it won't affect the object. You need to use the setvarnum command or set the value of the variable node:

setvarnum(item, "maxspeed", 2);
getvarnode(item, "maxspeed").value = 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.