Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
GeorgK
in reply to: YuhanZhang

Do you have an example for this? Thank you very much.

 

I could copy the sketch

 

Sub VBAMain()
   Dim oPart1 As PartDocument
   Set oPart1 = ThisApplication.Documents.Open("c:\part1.ipt", False)
   
   Dim oSketch_inPart1 As Sketch
   Set oSketch_inPart1 = oPart1.ComponentDefinition.Sketches(1)
   
   Dim oPart2 As PartDocument
   Set oPart2 = ThisApplication.Documents.Open("c:\part2.ipt", False)
   
   Dim oSketch_inPart2 As Sketch
   Set oSketch_inPart2 = oPart2.ComponentDefinition.Sketches(1)
   
   Call oSketch_inPart1.CopyContentsTo(oSketch_inPart2)
    
   Call oPart1.Close(True)

    oPart2.Update
   oPart2.Save
   Call oPart2.Close(True)
   
End Sub