CleanOGS

From scripting
Jump to: navigation, search
Sub CleanOGS(CurOGS As OrderedGeometricalSet)
Dim SecondPart As Part
Set SecondPart = GetContainingPart(CurOGS)
If CATIA.ActiveDocument.Selection.Count <> 0 Then
    CATIA.ActiveDocument.Selection.Clear
End If
For X = 1 To CurOGS.Bodies.Count
    CATIA.ActiveDocument.Selection.Add CurOGS.Bodies.Item(X)
    CATIA.ActiveDocument.Selection.Delete
Next
For X = 1 To CurOGS.HybridShapes.Count
    SecondPart.HybridShapeFactory.DeleteObjectForDatum CurOGS.HybridShapes.Item(1)
Next
For X = 1 To CurOGS.OrderedSketches.Count
    CATIA.ActiveDocument.Selection.Add CurOGS.OrderedSketches.Item(X)
    CATIA.ActiveDocument.Selection.Delete
Next 
End Sub