CheeseMaker13
Aerospace
- Sep 25, 2012
- 42
HI Guys,
Pulling my hair out here, because whatever I do I cannot get instances within a component to rename.
Essentially I have a product with a component at the end of the tree with loads more parts inserted in there.
This code drills down to it and then renames them sequentially:
However, nothing happens. No error, no nothing. Not even " ProductRename.Name = "TEST" " results in anything!!!
Works perfectly at the upper level (Set oProducts = oProduct.Products).
Any thoughts on what I'm doing wrong?
Pulling my hair out here, because whatever I do I cannot get instances within a component to rename.
Essentially I have a product with a component at the end of the tree with loads more parts inserted in there.
This code drills down to it and then renames them sequentially:
Code:
Sub CATMain()
Set oDocument = CATIA.ActiveDocument
Set oProduct = oDocument.Product
Set oProducts = oProduct.Products
Set oProducts = oProduct.Products.Item(oProduct.Products.Count).Products
'Rename Instances Sequentially
For i = 1 To oProducts.Count
Set ProductRename = oProducts.Item(i)
ProductRename.Name = i
Next
End Sub
However, nothing happens. No error, no nothing. Not even " ProductRename.Name = "TEST" " results in anything!!!
Code:
'Rename Instances Sequentially
For i = 1 To oProducts.Count
Set ProductRename = oProducts.Item(i)
ProductRename.Name = i
Next
Works perfectly at the upper level (Set oProducts = oProduct.Products).
Any thoughts on what I'm doing wrong?