Jean-Marc Flamand
New member
I did record a macro that copy a geometrical set from a catpart and paste "as result" into another catpart but the paste as result instruction did not record the instruction. Need help to complete the code below.
Dim documents1 As Documents
Set documents1 = CATIA.Documents
Dim partDocument1 As PartDocument
Set partDocument1 = documents1.Item("cyl1.CATPart")
Dim part1 As Part
Set part1 = partDocument1.Part
Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies
Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Item("toto")
selection1.Add hybridBody1
selection1.Copy
Dim partDocument2 As PartDocument
Set partDocument2 = documents1.Item("Cyl2.CATPart")
Dim part2 As Part
Set part2 = partDocument2.Part
Dim hybridBodies2 As HybridBodies
Set hybridBodies2 = part2.HybridBodies
Dim hybridBody2 As HybridBody
Set hybridBody2 = hybridBodies2.Item("toto")
part2.UpdateObject hybridBody2
part2.Update
End Sub
Dim documents1 As Documents
Set documents1 = CATIA.Documents
Dim partDocument1 As PartDocument
Set partDocument1 = documents1.Item("cyl1.CATPart")
Dim part1 As Part
Set part1 = partDocument1.Part
Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies
Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Item("toto")
selection1.Add hybridBody1
selection1.Copy
Dim partDocument2 As PartDocument
Set partDocument2 = documents1.Item("Cyl2.CATPart")
Dim part2 As Part
Set part2 = partDocument2.Part
Dim hybridBodies2 As HybridBodies
Set hybridBodies2 = part2.HybridBodies
Dim hybridBody2 As HybridBody
Set hybridBody2 = hybridBodies2.Item("toto")
part2.UpdateObject hybridBody2
part2.Update
End Sub