VB开发SolidWorks实现机械产品参数化设计

Dim swapp As SldWorks.SldWorks

Dim PatFilePath As String

Dim part As SldWorks.PartDoc

 

Private Sub Command1_Click()

Set swapp = GetObject("D:\Program Files\SolidWorks Corp\SolidWorks\SLDWORKS.exe", "SldWorks.Application")

 

    If Err Then

    Set swapp = CreateObject("SldWorks.SldWorks")

        If Err Then

          MsgBox ("无法创建SolidWorks")

          Exit Sub

        Else

          swapp.Visible = True

        End If

    End If

    

    swapp.Visible = True

    

    PatFilePath = "c:\Agile\wspaces\Default\5090050031.SLDPRT "

    Set part = swapp.NewDocument(PatFilePath, 0, 0#, 0#)

    part.SaveToFile

    

End Sub

 

你可能感兴趣的:(职场,休闲)