question

Alfredo DF2 avatar image
0 Likes"
Alfredo DF2 asked Jordan Johnson commented

how to turn a tree variable from script into node as Flexsim script?

treenode.pngscript.pngHi,

I wanto to turn a tree variable (like creationtrigger for a Source) in a node with Flexsim script, by the script same.

In fact I have writtten a code to script, but the similation doesn't read it because in the tree the node isn't a script.

Thank you all!

sourcetreenodesimulation timenode
treenode.png (20.3 KiB)
script.png (15.6 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.

Steven Hamoen avatar image
1 Like"
Steven Hamoen answered Jordan Johnson commented
@Alfredo DF2

Check out the functions: switch_flexscript() and buildnodeflexscript()

· 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.

Alfredo DF2 avatar image Alfredo DF2 commented ·

script2.png

Is it right? Because when I launch the script, the setting is not saved.

0 Likes 0 ·
script2.png (15.0 KiB)
Steven Hamoen avatar image Steven Hamoen Alfredo DF2 commented ·

@Alfredo DF2

2 points:

1. I would first set the nodestr and after that toggle the node as FlexScript.

2. If you look at the switch_flexscript() command you will see that you need an extra parameter to toggle it as flexscript (switch_flexscript(creationtrigger, 1) )

2 Likes 2 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ Alfredo DF2 commented ·

If you change the code after building flexscript, you need to build flexscript again:

buildnodeflexscript(myNode);
0 Likes 0 ·
martin.j avatar image
0 Likes"
martin.j answered Alfredo DF2 commented

Right click the node in the tree and select "Build > Toggle Node as Flexscript", then to build the node for the first time; right click again and select "Build > Build Node Flexscript".


buildfsnode.jpg (44.7 KiB)
· 1
5 |100000

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

Alfredo DF2 avatar image Alfredo DF2 commented ·

Yes, but after reset this set will delete.

0 Likes 0 ·