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