Hallo Leute,
ich bin neu hier und grüße erstmal alle!
So jetzt zu meinem Problem:
Ich habe einen Process geöffnet, in dem befinden sich jeweils unter ProductList und RessourceList ein CATProduct.
In diesen CATProducts befindet sich jeweils ein CATPart.
also so:
Process
--> ProductList
--> CATProduct
--> CATPart
--> Koordinatensystem
-->RessourceList
--> CATProduct
--> CATPart
Im CATPart unter ProductList ist ein Koordinatensystem erzeugt,
welches ich jetzt in das CATPart unter der RessourceList einfügen will. Wenn ich das ganze händisch probiere, ist es kein Problem.
Zuerst doppelklick auf das Part, dann Kopieren des Koordinatensystems, dann Einfügen mit Verknüpfung in dem anderen Part unter der RessourceList.
Versuche ich das ganze per Makro, wird das Koordinatensystem zwar eingefügt, liegt dann jedoch nicht an der richtigen Stelle. Die Sache ist,
dass das kopierte Koordinatensystem ein Ursprungskoordinatensystem ist, also (0,0,0) und beim Einfügen erstellt er auch ein Koordinatensystem im Ursprung (0,0,0) allerdings liegen von außen betrachtet beide Teile so verschoben, dass das Ursprungskoordinatensystem des ersten Parts an einer anderen Stelle liegt, als das Ursprungskoordinatensystem des zweiten Parts. SIEHE BILD
Wie bekomm ich das was händisch funktioniert mit einem Makro hin?
Der Quellcode bisher:
Sub CATMain()
Dim processDocument1 As ProcessDocument
Set processDocument1 = DELMIA.ActiveDocument
Dim selection1 As Selection
Set selection1 = processDocument1.Selection
selection1.Clear
Dim selection2 As Selection
Set selection2 = processDocument1.Selection
selection2.Clear
Dim documents1 As Documents
Set documents1 = DELMIA.Documents
Dim partDocument1 As PartDocument
Set partDocument1 = documents1.Item("Tunnel.CATPart")
Dim part1 As Part
Set part1 = partDocument1.Part
Dim axisSystems1 As AxisSystems
Set axisSystems1 = part1.AxisSystems
Dim axisSystem1 As AxisSystem
Set axisSystem1 = axisSystems1.Item("Ursprungskoordinatensystem")
selection1.Add axisSystem1
selection1.Copy
selection1.Clear
Dim partDocument2 As PartDocument
Set partDocument2 = documents1.Item("Spanntisch.CATPart")
Dim part2 As Part
Set part2 = partDocument2.Part
Dim axisSystems2 As AxisSystems
Set axisSystems2 = part2.AxisSystems
selection2.Add axisSystem2
selection2.PasteSpecial ("CATPrtResult")
selection2.Clear
part2.Update
End Sub
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP