AnsweredAssumed Answered

How to save *.sldasm as *.ifc 4 in solidworks 2016 programatically

Question asked by Uma SHANKAR on Apr 12, 2019
Latest reply on Apr 22, 2019 by Uma SHANKAR

Hi,

Below is the code snippet written in VB to save the assembly as IFC file type.

It is opening in SWX2016 but the same IFC files are not opening in Revit. Instead some errors and warnings are thrown.

Manually saved the *.assembly to *.ifc 4 type and opened in Revit software which worked fine.

 

Same am trying to save it as IFC4 in VB code. But the existing code is not supporting. I had tried modifying
the old VB classic code by referring some online stuffs but it dint helped. I feel something wrong with the save as method syntax or something I couldn't figure out.

So kindly requesting to review the code and advice on the syntax and the error.

 

Case "ifc"

        Set Part =
swApp.ActivateDoc2(StrAssemblyFile, True, longstatus)

      
swApp.SetUserPreferenceToggle 26, 1

        'Part.SaveAs3
StrFileName, 0, swSaveAsOptions_Silent - worked fine in SWX2011 & 2018 But
errored in 2016 Revit Software

        Part.SaveAs4
StrFileName, 0, 8, 1, 1

 

I get run time error for the above code,

ErrMsg : “ type mismatch in preparefile(). error number=13 “

 

A quick response would be more appreciated.

 

Thanks,

Bala.

Outcomes