AeroBouquito
New member
- Oct 21, 2009
- 6
Evening all,
I've written a bit of VBA code to play with CATParts for the automation of copy/paste bodies and operate transformations such as splits etc.
When i try to adapt this to a CATProduct i cant seem to be able to get the Part Porperties/Methods i had in my former code.
Let's say i have a CATProduct made of a CATPart and a sub-CATProduct (made of 4 CATParts itself).
This is the beginning of my code:
...................................................
Set partdocument1 = CATIA.ActiveDocument
Set product1 = partdocument1.Product
Set part1 = product1.Products.Item(1)
Set subproduct1 = product1.Products.Item(2)
Set subproduct1_part1 = subproduct1.Products.Item(1)
Set subproduct1_part2 = subproduct1.Products.Item(2)
Set subproduct1_part3 = subproduct1.Products.Item(3)
Set subproduct1_part4 = subproduct1.Products.Item(4)
....................................................
All the above end up being Product Objects even though they clearly have nothing under them apart from product1 and subproduct1 (e.g. part1.Products.Count = 0). I have tried ActivateShape and DesignMode with no success.
Could you help me getting hold of the actual Part Properties/Methods when i've reached a CATPart (i.e. get to Bodies, ShapeFactories etc...)? This way i could navigate in my tree and perform operation within the Parts i want to modify.
The way around it would be to grab the CATParts full name and open them in a new window, save, close and update product1 but i'm sure there is a smarter way to do it within one single window.
Thanks for your support !
I've written a bit of VBA code to play with CATParts for the automation of copy/paste bodies and operate transformations such as splits etc.
When i try to adapt this to a CATProduct i cant seem to be able to get the Part Porperties/Methods i had in my former code.
Let's say i have a CATProduct made of a CATPart and a sub-CATProduct (made of 4 CATParts itself).
This is the beginning of my code:
...................................................
Set partdocument1 = CATIA.ActiveDocument
Set product1 = partdocument1.Product
Set part1 = product1.Products.Item(1)
Set subproduct1 = product1.Products.Item(2)
Set subproduct1_part1 = subproduct1.Products.Item(1)
Set subproduct1_part2 = subproduct1.Products.Item(2)
Set subproduct1_part3 = subproduct1.Products.Item(3)
Set subproduct1_part4 = subproduct1.Products.Item(4)
....................................................
All the above end up being Product Objects even though they clearly have nothing under them apart from product1 and subproduct1 (e.g. part1.Products.Count = 0). I have tried ActivateShape and DesignMode with no success.
Could you help me getting hold of the actual Part Properties/Methods when i've reached a CATPart (i.e. get to Bodies, ShapeFactories etc...)? This way i could navigate in my tree and perform operation within the Parts i want to modify.
The way around it would be to grab the CATParts full name and open them in a new window, save, close and update product1 but i'm sure there is a smarter way to do it within one single window.
Thanks for your support !