For example, in this situation, NN1 ↔ NN2 ↔ NN3 ↔ NN4 ↔ NN5. command1(NN1, NN5) writes as follows NN1, NN2, NN3, NN4, NN5
For example, in this situation, NN1 ↔ NN2 ↔ NN3 ↔ NN4 ↔ NN5. command1(NN1, NN5) writes as follows NN1, NN2, NN3, NN4, NN5
The key here is to use the getnextnetnode() command. The tricky thing is that this command takes network node ranks as inputs and returns the rank of the next network node between the 2 you specify. So we will also have to use the rankfromnetnodeI() and netnodefromnode() commands to convert back and forth between the rank of the node and the node itself.
Here's the code:
treenode startNode = node("MODEL:/NN1"); treenode endNode = node("MODEL:/NN7"); int start = rankfromnetnode(startNode); int end = rankfromnetnode(endNode); int cur = start; while(cur != end) { pt(getname(netnodefromrank(cur))); pr(); cur = getnextnetnode(cur, end); } pt(getname(endNode));
And make sure you reset the model before running this script so that the network's distance table is up to date.
4 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved