AnsweredAssumed Answered

SW2018 Loadfile4 error

Question asked by Markus Greger on Apr 6, 2018
Latest reply on Apr 9, 2018 by 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





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