question

Gilles avatar image
0 Likes"
Gilles asked Paula LG edited

change a flexcript node from a code

hello,

I am trying to change the process time of a processor using a script.

1734681215297.png

I am able to access the node but my changes are not considered.

here is my code

1734681432676.png


FlexSim 23.2.0
scriptprocess timetreenode
1734681215297.png (11.4 KiB)
1734681432676.png (19.7 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

Paula LG avatar image
0 Likes"
Paula LG answered Paula LG edited

Hi Gilles,

I've tried this code on a dummy and it works just fine:

string processTimeAuto = "Object current = ownerobject(c);\nObject item = param(1);\nreturn 3600/Table(\"GlobalTable1\")[1][1];";
treenode myNode2 = Model.find("Processor1>variables/cycletime");
myNode2.value = processTimeAuto;
switch_flexscript(myNode2,1);
buildnodeflexscript(myNode2);

It looks like the problem was the way of assigning the string to the node.

I hope it helps!

5 |100000

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