Ich bins nochmal.
Da ich das mit dem Messen etc nicht hinbekommen habe will ich mein Vorhaben auf eine andere Art realisieren.
Und zwar sollen alle Volumenkörper der bodies in einem body zusammengefasst werden.
Ich erhoffe mir dadurch, dass ich dann bei der Intersect-Anwendung keine Fehlermeldung mehr bekomme.
Aber irgendwie will das auch nicht so richtig funktionieren. Das Makro kopiert mir die shapes nicht in den ersten body, sondern erstellt neue bodies. Hier mal das Makro nur für die Inhaltsübertragung von body zu body:
Sub CATMain()
Dim partDocument As Document
Set partDocument = CATIA.ActiveDocument
Dim part As Part
Set part = partDocument.Part
Dim bodies As Bodies
Set bodies = part.Bodies
Anzahlbodies = bodies.Count
MsgBox(Anzahlbodies)
For I=Anzahlbodies To 2 Step-1
Dim partDocument1 As Document
Set partDocument1 = CATIA.ActiveDocument
Dim selection1 As Selection
Set selection1 = partDocument1.Selection
selection1.Clear
Dim part1 As Part
Set part1 = partDocument1.Part
'Dim bodies1 As Bodies
'Set bodies1 = part1.Bodies
Dim body1 As Body
Set body1 = bodies.Item(I)
Dim shapes1 As Shapes
Set shapes1 = body1.Shapes
Dim solid1 As Shape
Set solid1 = shapes1.Item(1) ' Wie kann ich hier alle solids ansprechen?
selection1.Add solid1
selection1.Copy
Set partDocument1 = CATIA.ActiveDocument
Dim selection2 As Selection
Set selection2 = partDocument1.Selection
selection2.Clear
Dim body2 As Body
Set body2 = bodies.Item(1)
'Set body2 = CATIA.ActiveDocument.Part.MainBody
selection2.Add body2
selection2.Paste
Set partDocument1 = CATIA.ActiveDocument
Dim selection3 As Selection
Set selection3 = partDocument1.Selection
selection3.Clear
selection3.Add body1
selection3.Delete
part.Update
MsgBox("body kopiert")
'MsgBox("Zuschnitt " & I & " erstellt")
Next
End Sub
Ich bin mit meinem Latein langsam am Ende.
Beste Grüße
Andy
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP