6 Replies Latest reply on Feb 12, 2018 11:14 AM by Ross Mayo

    Macro to save each body in multi-body separately as .stl

    Ross Mayo

      I'm trying to save out each body of a multibody part as seperate .stl


      I've gotten up to a pretty basic macro that I created to save .step files. Is there a way to select each of the solid bodies and save in a similar way?


      Dim swApp As SldWorks.SldWorks

      Dim swModel As SldWorks.ModelDoc2

      Sub Main()

          Set swApp = Application.SldWorks

          Set swModel = swApp.ActiveDoc

          confName = swModel.ConfigurationManager.ActiveConfiguration.Name

          fileName = confName & " - " & revNmb & ".stl"

          swModel.Extension.SaveAs "C:\Users\user1\Documents\SOLIDWORKS Macro\" & fileName, swSaveAsVersion_e.swSaveAsCurrentVersion, swSaveAsOptions_e.swSaveAsOptions_Silent, Nothing, 0, 0

      End Sub