PedroOliveira
Student
- Feb 19, 2024
- 1
Invert selection
I have this code in a macro and I wanted your help with something. I want that when executing this line " oGroup.FillSelWithInvert" it does not select the entire inversion of the original selection but rather makes a filter between those that are visible. This way, the selection would be the opposite of the original, but only of the visible parts, not the entire assembly.
Sub CATMain()
Dim selection1 As Selection
Set selection1 = CATIA.ActiveDocument.Selection
If selection1.Count > 0 Then
' Retrieve the Groups collection
Dim cGroups As Object
Set cGroups = CATIA.ActiveDocument.product.GetTechnologicalObject("Groups")
' Create a group with selected products
Dim oGroup As Group
Set oGroup = cGroups.AddFromSel
' Fill the selection with the inverted group
oGroup.FillSelWithInvert
Else
MsgBox "No components selected", vbExclamation, "Isolate Components"
Exit Sub
End If
End Sub
I have this code in a macro and I wanted your help with something. I want that when executing this line " oGroup.FillSelWithInvert" it does not select the entire inversion of the original selection but rather makes a filter between those that are visible. This way, the selection would be the opposite of the original, but only of the visible parts, not the entire assembly.
Sub CATMain()
Dim selection1 As Selection
Set selection1 = CATIA.ActiveDocument.Selection
If selection1.Count > 0 Then
' Retrieve the Groups collection
Dim cGroups As Object
Set cGroups = CATIA.ActiveDocument.product.GetTechnologicalObject("Groups")
' Create a group with selected products
Dim oGroup As Group
Set oGroup = cGroups.AddFromSel
' Fill the selection with the inverted group
oGroup.FillSelWithInvert
Else
MsgBox "No components selected", vbExclamation, "Isolate Components"
Exit Sub
End If
End Sub