3 Replies Latest reply on Apr 9, 2018 8:22 AM by Markus Greger

    SW2018 Loadfile4 error

    Markus Greger

      Dear All,

       

      I have a problem with LoadFile4 (stp import) specifically in SW2018 (lower versions work nicely)

      The comparison between the versions (sw2018 [doesn't work] and sw2017 [works]) is shown in the videos (I used a clean VM for the SW2018 test)

      The used vba script is totally standard (it just opens a message box telling the user that the file was found).

       

      If anyone has any idea how to circumvent this bug(?) in sw2018, it would be highly appreciated.

      Maybe a SPR is in order

       

      Cheers

      Markus

       

      Used macro

      -------------------------------------------------------------------------------------------------

      Dim swApp As SldWorks.SldWorks
      Dim swImportData As SldWorks.ImportIgesData
      Dim swPart As SldWorks.PartDoc
      Dim errors As Long
      Dim swImportStepData As SldWorks.ImportStepData
      Dim stepFileName As String
      Dim iTemp
      Dim FileExists

      Sub main()
          Set swApp = Application.SldWorks
         
          stepFileName = "C:\Users\Public\Documents\test.stp"
          Set swImportStepData = swApp.GetImportFileData(stepFileName)
          swImportStepData.MapConfigurationData = True
         
          Set swPart = swApp.LoadFile4(stepFileName, "r", swImportData, errors)
         
          FileExists = False
          iTemp = GetAttr(stepFileName) 'Check if error exists and set response appropriately
          Select Case Err.Number
          Case Is = 0
              FileExists = True
          Case Else
              FileExists = False
          End Select

                 
          nRetval = swApp.SendMsgToUser2("File Exists=" & CStr(FileExists) & " LoadFile4 ERROR = " & CStr(errors), swMbWarning, swMbOk)
         
      End Sub

        • Re: SW2018 Loadfile4 error
          Artem Taturevych

          Can you import this file via Open menu (without API)?

          • Re: SW2018 Loadfile4 error
            Markus Greger

            The Support team provided me with an answer (thank you very much!).

            For anyone interested, the workaround is as follows:

             

            "We have the following workaround for this issue:

            In SOLDIWORKS 2018 you need to set "Enable 3D
            Interconnect" flag to False for same output as SOLIDWORKS 2017. (System
            options => Import => "Enable 3D Interconnect") Using API you
            can do this with using following code snippet:

             

               
            swApp.SetUserPreferenceToggle swUserPreferenceToggle_e.swMultiCAD_Enable3DInterconnect, False

                Set swPart = swApp.LoadFile4(stepFileName, "r", swImportData, errors)"

             

            Note that swMultiCAD_Enable3DInterconnect has the numeric value 691