Hallo
für folgendes Script bräuchte ich Unterstützung. Es soll
alle Bodies ohne Partbodies im Produkt finden und wenn diese
leer sind, löschen. D.h. diesen Code habe ich hier im Forum
gefunden und etwas erweitert. Nach dem löschen bekomme ich in
der Zeile "Set body1 = Selection1.Item(i).Value" einen Fehler.
Wer kann mir hierzu weiterhelfen. Danke im Vorraus.
Sub CATMain()
Dim productDocument1
Dim selection1
Dim body1
Dim part1
Set productDocument1 = CATIA.ActiveDocument
Set selection1 = productDocument1.Selection
Selection1.Search "CATPrtSearch.BodyFeature,all" 'Alle Bodies im aktiven Dokument suchen
For i = 1 To Selection1.Count
Set body1 = Selection1.Item(i).Value
Set part1 = body1
Do While Not TypeName(part1) = "Part"
Set part1 = part1.parent
Loop
If body1.Shapes.Count = 0 And body1.Sketches.Count = 0 And NOT _
part1.MainBody.GetItem("ModelElement").InternalName = body1.GetItem("ModelElement").InternalName Then
Selection1.Add body1
Selection1.Delete
Selection1.clear
End If
Next
End Sub
------------------
mfg
Erich
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP