4 Replies Latest reply on Dec 23, 2013 4:04 AM by Nazar Chaykin

    EPDM: Run SolidWorks from selected file

    Nazar Chaykin


      There is problem with starting of SolidWorks in EPDM Add-in. Supposing I enter in epmd  container and i want to start it on the chosen file, the attachment to work out right the chosen document shuld open  (ActiveDoc)  SolidWorks and to execute an operation then close. I have everything working in tasks (Scenary VBA) but in VB.NET it doesn t work. SOLIDWORKS appears in the process, but then nothing happend.

      Thanks in advance!


      Example of the VBA code that is responsible for SolidWorks opening:


      Dim fileName As String
             fileName = "<Filepath>"
          Dim ext As String
          ext = UCase(Right(fileName, 6))
          If ext <> "SLDPRT" Then
              Exit Sub
          End If
          Set swApp = Application.SldWorks
          Set pdmVault = CreateObject("ConisioLib.EdmVault")
          Dim folder As Object
          Dim file As Object
          pdmVault.Login USERNAME, PASSWORD, VAULT_NAME
          Set file = pdmVault.GetFileFromPath(fileName, folder)
          If False = file.IsLocked Then
              file.LockFile folder.ID, 0
          End If
          Set swModel = swApp.OpenDoc6(fileName, swDocumentTypes_e.swDocPART, swOpenDocOptions_e.swOpenDocOptions_Silent, "", 0, 0)
          swModel.ShowConfiguration2 defaultConf
          swModel.Save3 swSaveAsOptions_e.swSaveAsOptions_Silent, 0, 0
          swApp.CloseDoc swModel.GetPathName