elmundo777
Automotive
- Jun 23, 2020
- 93
Hello. I have been looking for a solution for a long time here and other resources, but I have not found a solution.
Essence of the question:: there are selected objects - parts or products. I need to change their PartNumbers and InstanceNames. The partnumber can be changed. But the instance does not come out. I don't know how to do it if the object is in level 2,3,4, etc.
For example, like the part in the picture below:
Tried the following code:
And this
and etc
but did not understand how to change the instance name in distant levels
Essence of the question:: there are selected objects - parts or products. I need to change their PartNumbers and InstanceNames. The partnumber can be changed. But the instance does not come out. I don't know how to do it if the object is in level 2,3,4, etc.
For example, like the part in the picture below:

Tried the following code:
Code:
Dim i as Single
dim selection2 as Selection = Catia.ActiveDocument.Selection
for i = 1 To selection2.count2
selection2.Item(i).Value.Name= selection2.item(i).Value.PartNumber & "_" & i
Next i
And this
Code:
selection2.Item(i).Value.Name= selection2.item(i).LeafProduct.PartNumber & "_" & i
but did not understand how to change the instance name in distant levels