Hallo Catia-Versierte,
da ich zu Vergleichszwecken die Hauptkörper aller Parts in einem Produkt umbenennen möchte,
habe ich folgendes Makro angefertigt:
Language="VBSCRIPT"
Sub CATMain()
Dim documents1 As Documents
Set documents1 = CATIA.Documents
Dim Document1, aktuPartDoc As Document
Set Document1 = CATIA.ActiveDocument
Dim PartSelektion As Selection
Set PartSelektion = Document1.Selection
PartSelektion.Search "CATProductSearch.Part,all"
Dim PartMenge, I As Integer
PartMenge = PartSelektion.Count
MsgBox(" PartMenge = " & PartMenge )
Dim aktuPart As Part
Dim DocDescription As String
Dim bodies1 As Bodies
Dim body1 As Body
For I =1 To PartMenge
Set aktuPart = PartSelektion.Item(I)
DocDescription = aktuPart.Name
MsgBox("DocDescription = a" & DocDescription )
Set bodies1 = aktuPart.Bodies
Set body1 = bodies1.Item(1) 'Set body1 = bodies1.Item("Hauptkörper")
body1.name = DocDescription
Next
End Sub
Dabei kommt es zur Fehlermeldung ScriptingERR_1002 (s. Bild).
Sicher mache ich hier einen simplen Fehler, der Euch schmunzelnd lässt.
Über einen Tipp würde ich mich auch freuen.
MfG Stephan
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP