Catiaer
Mechanical
- Nov 9, 2019
- 13
Hello,
I'm making a simple script that creates a geometrical set and hide it in selected parts.
The problem is, when I use both "SelectElement3" methode and "VisProperties" methode,
I have to add geo set and clear selection it.
Then I would like to know, whether there is a way to hide a geo set without selection.
I'm making a simple script that creates a geometrical set and hide it in selected parts.
The problem is, when I use both "SelectElement3" methode and "VisProperties" methode,
I have to add geo set and clear selection it.
Then I would like to know, whether there is a way to hide a geo set without selection.
Code:
Dim selection1 'As Selection
Set selection1 = CATIA.ActiveDocument.Selection
Dim Inputobject(0)
Inputobject(0) = "Part"
selection1.Clear
MsgBox "Please, select parts", vbInformation, "CATIA V5"
Status1 = selection1.SelectElement3(Inputobject, "select parts", True, CATMultiSelTriggWhenUserValidatesSelection, False)
If (Status1 = "Cancel") Or (Status1 = "Undo") Then Exit Sub
For n = 1 To selection1.Count
Dim documents1 As Documents
Set documents1 = CATIA.Documents
Dim SelObjName1 As String
SelObjName1 = selection1.Item(n).Value.Parent.Name
Dim partDocument1 As PartDocument
Set partDocument1 = documents1.Item(SelObjName1)
Dim part1 As Part
Set part1 = partDocument1.Part
Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies
Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Add()
part1.Update
Dim visPropertySet1 As VisPropertySet
Set visPropertySet1 = selection1.VisProperties
selection1.Add hybridBody1
visPropertySet1.SetShow 1
selection1.Clear
Next