question

Daniel avatar image
0 Likes"
Daniel asked Daniel commented

How can I use flexscript to add a control point on AGV path?

I have a follow-up question: I tried to add a control point to the AGV path using the following Flexscript code:

  1. treenode SpathNode = node("/project/library/AGV/StraightPath");
  2. treenode Spath = createinstance(SpathNode, model());
  3. treenode ControlPointNode = node("/project/library/AGV/ControlPoint");
  4. treenode controlpoint1 = createinstance(ControlPointNode, model());

1736694783898.png

However, the control point does not successfully attach to the AGV path. How should I modify my Flexscript code to make it work properly? Thank you for your assistance!

FlexSim 24.2.0
flexscriptagvpathcontrol point
1736694783898.png (2.2 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 Daniel commented

Either use "setProperty" to adjust the location.

  1. treenode SpathNode = node("/project/library/AGV/StraightPath");
  2. treenode Spath = createinstance(SpathNode, model());
  3. treenode ControlPointNode = node("/project/library/AGV/ControlPoint");
  4. treenode controlpoint1 = createinstance(ControlPointNode, model());
  5. controlpoint1.as(Object).setProperty("Location", Vec3(6, 0, 0));

Or call "finalizeSpatialChanges" after setting the location.

  1. treenode SpathNode = node("/project/library/AGV/StraightPath");
  2. treenode Spath = createinstance(SpathNode, model());
  3. treenode ControlPointNode = node("/project/library/AGV/ControlPoint");
  4. treenode controlpoint1 = createinstance(ControlPointNode, model());
  5. controlpoint1.as(Object).setLocation(6, 0, 0);
  6. function_s(controlpoint1.as(Object), "finalizeSpatialChanges");
· 3
5 |100000

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