AnsweredAssumed Answered

Macro to save opened document as STEP in Specific Folder

Question asked by Dominik Suhm on Sep 4, 2018
Latest reply on Sep 4, 2018 by Dominik Suhm

Hello,

 

I already found this macro in an older Thread:

 

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

 

 

Sub main()

 

 

    Set swApp = Application.SldWorks

  

    Set swModel = swApp.ActiveDoc

  

    Dim confName As String

    Dim revNmb As String

    Dim fileName As String

  

    confName = swModel.ConfigurationManager.ActiveConfiguration.Name

    revNmb = swModel.Extension.CustomPropertyManager(confName).Get("Revision")

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

  

    swModel.Extension.SaveAs "c:\" & fileName, swSaveAsVersion_e.swSaveAsCurrentVersion, swSaveAsOptions_e.swSaveAsOptions_Silent, Nothing, 0, 0

 

 

End Sub

 

It works but I need it to save the STEP with the name of the "Part" (for example if the parts name is Sheet Metal 1 the .STEP should be named Sheet Metal 1 .STEP)  instead of confName & revNmb but I just cant seem to get it to work.

I sadly have 0 knowledge how this programming language works.

 

I would also need the same macro to save the active drawing to a .dxf

 

I would appreciate any help on this since I have been googeling for like 3 hours

 

Regards Dominik

Outcomes