question

Laurenz Peleman avatar image
0 Likes"
Laurenz Peleman asked Mischa Spelt commented

Buildnodeflexscript on node with subnodes

Hello everyone

I am trying to assign some custom code 'on the fly' to the flow level triggers of a FloWorks flow tank, using the following code. The onpassfluidlevel node containing the level trigger code exists of different subnodes, corresponding to each defined level trigger, which require each some specific code.

  1. treenode levelTriggers = getvarnode(flowTank, "onpassfluidlevel");
  2. for (int i = 1; i <= levelTriggers.subnodes.length; i++) {
  3. string triggercode = "Object current = ownerobject( c ); Other code to add";
  4. setnodestr(levelTriggers.subnodes[i],triggercode);
  5. switch_flexscript(levelTriggers.subnodes[i], 1);
  6. }
  7. switch_flexscript(levelTriggers, 1);
  8. buildnodeflexscript(levelTriggers);

What happens now is that, on executing the buildnodeflexscript command, the sudnodes are built (the red Flescript S in the model tree turns black) but the parent node (onpassfluidlevel) isn't. Hence, the code of the subnodes is not called. I tried to write additional buildnodeflexscript statements, either with the node or the flow tank object as argument, but whatever I tried, the parent node couldn't be built. Does anyone know how this can be overcome?

I post this question here because I think the behaviour is not related to FloWorks specifically, but to building nodes with subnodes in general.

Kind regards

Laurenz Peleman

Choose One
FloWorksdevelopment
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

Phil BoBo avatar image
1 Like"
Phil BoBo answered Mischa Spelt commented

Does your levelTriggers node have a syntax error?

I just tested this with new nodes in a Processor's variables and it works fine:


· 10
5 |100000

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