AnsweredAssumed Answered

Save Assembly as part settings

Question asked by Danny Bradford on Jul 17, 2014
Latest reply on Jul 17, 2014 by Danny Bradford



I apologize for this simplistic question but sometimes these help documents skip some simple but key points. Here goes...


I am trying to use this code to take an open assembly and save it as a part:


        Dim swApp As SldWorks

        Dim swModel As ModelDoc2

        Dim swModelDocExt As ModelDocExtension

        Dim nErrors As Long

        Dim nWarnings As Long

        Dim bool As Boolean


        swApp = GetObject(, "SldWorks.Application")

        swModel = swApp.ActiveDoc

        swModelDocExt = swModel.Extension


        bool = swApp.SetUserPreferenceIntegerValue(swSaveAsmAsPartOptions_e.swSaveAsmAsPart_ExteriorFaces, 1)

        swModelDocExt.SaveAs("C:\test_folder\create_me.sldprt", 0, swSaveAsOptions_e.swSaveAsOptions_Silent, Nothing, nErrors, nWarnings)








Unfortunately while the boolean messagebox comes back as true but the settings are not really being taken into account during save.


I know it has something to do with the SetUserPreferenceIntegerValue second value. I have tried many options but cannot get control. The help is quite cryptic in this regard.


Thanks in advance for your assistance.