Macro selecting all faces in product, is ignoring multiple instances of same part

Christopher Davey

Macro selecting all faces in product, is ignoring multiple instances of same part

For a macro that I am writing, I am simply trying to select all the faces of all parts in a product. What I am struggling to understand is why my code will select all the faces of parts, but only one part instance of parts that appear multiple times in the product tree. For example if I have 10 bolts in the product, it is only selecting the faces from one of the bolts.

 

Any help understanding this would be great!

 

I've included the simple code I am using to select the faces:

 

Language = "VBSCRIPT"

Sub CATMain()

Set prdroot = CATIA.ActiveDocument.Product
prdRoot.ApplyWorkMode DESIGN_MODE

Set partDoc = CATIA.ActiveDocument
prdroot.Update

Set objSel = CATIA.ActiveDocument.Selection
objSel.Search "((Topology.CGMFace) & (Topology.CGMFace & Visibility=Shown)),all"

End Sub

Eric Neuville

RE: Macro selecting all faces in product, is ignoring multiple instances of same part
(in response to Christopher Davey)

Seems the behaviour of 3DX2021X HF 0.12  is not the same as it does select the faces from all instances...

If I change the graphic properties of the faces it does not really matters if I have the faces from all instances as the faces belong to the reference and if I do change the reference, all instances are changed.

But maybe you search for the faces for another reason...in this case you will have to be creative...

Edited By:
Eric Neuville[Organization Members] @ Jun 08, 2020 - 11:29 PM (Europe/Paris)