Untitled

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Language="VBSCRIPT"

Sub CATMain()
Dim selection1 As Selection

Set Document = CATIA.ActiveDocument

Set Bodies = Document.Part.Bodies

Set selection1 = Document.Selection

For i = 1 To Bodies.Count

if CheckEmptyBody (Bodies.Item(i)) = true then


selection1.Add Bodies.Item(i)
end if

Next

selection1.Delete
MsgBox "Empty Bodies Deleted "

End Sub

Function CheckEmptyBody(body) as boolean

Set HybridShapes = body.HybridShapes


Set ogs = body.OrderedGeometricalSets
Set Shapes = body.Shapes
Set Sketches = body.Sketches

On Error Resume Next

Count1 = HybridShapes.Count
Count2 = ogs.Count
Count3 = Shapes.Count
Count4 = Sketches.Count

on error goto 0

If Count1 = 0 And Count2 = 0 And Count3 = 0 And Count4 = 0 Then


CheckEmptyBody = true

Else
CheckEmptyBody = false
End If

End Function

You might also like