Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
For example, in this situation, NN1 ↔ NN2 ↔ NN3 ↔ NN4 ↔ NN5. command1(NN1, NN5) writes as follows NN1, NN2, NN3, NN4, NN5
Solved! Go to Solution.
For example, in this situation, NN1 ↔ NN2 ↔ NN3 ↔ NN4 ↔ NN5. command1(NN1, NN5) writes as follows NN1, NN2, NN3, NN4, NN5
Solved! Go to Solution.
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.