question

Bryan Suharik avatar image
0 Likes"
Bryan Suharik asked Bryan Suharik commented

Send to Port custom code??

Hello,

For some reason, my code doesn't apply to the Queue "Send to Port". The code loads to the queue, but then when i run the model it doesn't send the itemtypes to the correct port that ive defined.

However, when i open the queue GUI and go to the flexscript for the Send to Port, i see my code listed there. Only after i hit okay/apply, does the model then run with my code.

How do i get my code to apply without having to enter the GUI of that queue??

Thanks a bunch for the help!!!

string qcstage = "\

treenode item = parnode(1);\

treenode current =ownerobject(c);\

int port = parval(2); \

int condition = getitemtype(item) == 1;\

int port1 = 1;\ int port2 = 2;\

return condition?port1:port2;";

setvarstr(PostQCstage,"sendtoport",qcstage);

FlexSim 16.0.6
codesend to portapply
queue-gui.png (32.3 KiB)
queue-gui2.png (52.5 KiB)
· 2
5 |100000

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

Joerg Vogel avatar image Joerg Vogel commented ·

Which version do you use? The graphical code look does not match with the version you set to your post.

0 Likes 0 ·
Bryan Suharik avatar image Bryan Suharik Joerg Vogel commented ·

Flexsim 6.0. I know it's an old version.

0 Likes 0 ·

1 Answer

Bryan Suharik avatar image
1 Like"
Bryan Suharik answered

Hello, I figured out the issue. For reference, you need to toggle the node to Flexscript/c++

I did this using the code:

enablecode(var_s(PostQCstage, "sendtoport"));

Works perfect Now!

5 |100000

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