AnsweredAssumed Answered

Open .step file

Question asked by Iyed Briki on Jun 27, 2019
Latest reply on Jun 27, 2019 by Amen Allah Jlili


I need some help regarding .step files. I am trying to write a macro that opens a .step file and then saves it as .sldprt.

I used this functions:


Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

dim Path as String

Dim Importdata As ImportStepData

Dim Errors As Long

Dim Err as Long

Dim Warn as long

Dim swModelDocExt As ModelDocExtension


Sub main()
Set swApp = Application.SldWorks

Path = "C:\...................\x.step"

Set Importdata = swApp.GetImportFileData(Path)

Set swModel = swApp.LoadFile4(Path, "r", Importdata, Errors)

set swModel = swApp.OpenDoc6(Path, 6, 1, "", Err, Warn)

set swModelDocExt = swModel.Extension 





this macro does not open the .step file (Errors=1) and crashes at the line "set swModelDocExt = swModel.Extension". Could you help me with this problem?

Thank you