How can I set up conditional rule using FlexScript

How can I set up conditional rule using FlexScript

hsiangchao
Not applicable
100 Views
1 Reply
Message 1 of 2

How can I set up conditional rule using FlexScript

hsiangchao
Not applicable

[ FlexSim 22.2.2 ]

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.

0 Likes
Accepted solutions (1)
101 Views
1 Reply
Reply (1)
Message 2 of 2

moehlmann_fe
Advocate
Advocate
Accepted solution

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;
0 Likes