question

Sean avatar image
0 Likes"
Sean asked Felix Möhlmann answered

How can I set up conditional rule using FlexScript

Hi,

I have lots of AGV straight paths.Some of paths conditional rule are rule1, others are rule2. How can I set up conditional rule using FlexScript. Thank's.

FlexSim 22.2.2
agvnetwork
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

What exactly do you mean by "set up" a rule? Creating a new rule, assigning an existing rule to paths or use custom code to create a more complex rule than checking a label?

To assign an existing rule to a path you can use the following code: This example assigns "Rule 1" to "StraightPath1".

Object Path = Model.find("AGVNetwork/StraightPath1");
treenode rule = Model.find("AGVNetwork>variables/pathConditions/Rule 1");
Path.find(">variables/condition").value = rule;
5 |100000

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