Definition.instances upset
-
I hope someone can see what is wrong here. I can add all the definition instances to the selection but I can only return half of them as shown in the console. Sorry it's rather messy, made worst by the impossibility to indent.
Thanks and Happy New Year.
-
It's because you have instances of a definitions which exists in multiple instances of another definition.
Example:
Definition "lower_arm"
lower_arm_definition.count_instances == 1
(because it only has one instance, placed in the lower_arm_combo definition.)
lower_arm_definition.instances
will return only that instance. Because you add it to the selection, that instance will be highlighted everywhere it occurs in the model. But you have not iterated over any more instances.What you need to do, is travel back the paths of an instance's parents and if it's contained in another group or component, then you must work out how many copies there is of that - and continue that all the way back.
-
Takk!
Now you have said it I feel somewhat foolish ... oh well ... time to go to the pub. Maybe next year I can do better.
Happy New Year to you and all the other members.
Chris
Advertisement