The following example uses the number of nodes in a part instance to determine the range of a loop counter:
const odb_SequenceNode& nodeSequence = myInstance.nodes();
for (int i=0; i < nodeSequence.size() ; i++){
const odb_Node& myNode = nodeSequence[i];
nodeLabel = myNode.label();
}
You can make the program more efficient if you create an object to hold the value of the number of nodes.
const odb_SequenceNode& nodeSequence = myInstance.nodes();
int numNodes = nodeSequence.size();
for (int i=0; i < numNodes; i++){
const odb_Node& myNode = nodeSequence[i];
nodeLabel = myNode.label();
}
You can use this technique only if the maximum value of the loop counter remains fixed for the duration of the loop. |