7 Replies Latest reply on Jun 1, 2016 9:54 AM by Deepak Gupta

    DXF Export - Options

    Rafal Niczyporuk

      Hi Guys,

      Hi can I control .dxf export options using vba?

      I am using macro to export .dxf files from drawings. Some of the drawings have multiple sheets. Can I force the macro to always export with scale output enable and export all sheets to separate files.

      Any idea how control this settings using vba?

       

      Thanks in advance

      2016-06-01 12_17_36-SOLIDWORKS 2015 x64 Edition - [LC-1-3053 - Sheet1 [Read-only]].jpg

        • Re: DXF Export - Options
          Deepak Gupta

          API Help file has all the details/codes you need DXF/DWG Export Options

            • Re: DXF Export - Options
              Rafal Niczyporuk

              Hi Deepak

               

              Thank you for the replay

               

              Could you help me add the code for the options below: (  i am not sure how to do this )

              Scale 1:1 enable

              version of dxf 2002

              and export all sheets to separate files

               

              this is the code for dxf I am using(part of the macro)

               

              Private Sub DXF_Click()

              Dim swApp           As SldWorks.SldWorks

              Dim swModel         As SldWorks.ModelDoc2

              Dim swCustProp      As CustomPropertyManager

              Dim valOut          As String

              Dim resolvedValOut  As String

              Dim Filepath        As String

              Dim FileName        As String

              Dim swView          As SldWorks.View

               

              Set swApp = Application.SldWorks

              Set swDraw = swApp.ActiveDoc

               

              If swDraw Is Nothing Then Exit Sub

              If swDraw.GetType = swDocPART Then

              swApp.SendMsgToUser ("To be used for drawings only, Open a drawing first and then TRY!")

              Unload Export

              Exit Sub

              End If

              If swDraw.GetType = swDocASSEMBLY Then

              swApp.SendMsgToUser ("To be used for drawings only, Open a drawing first and then TRY!")

              Unload Export

              Exit Sub

              End If

               

              If swDraw.GetPathName = "" Then

              swApp.SendMsgToUser ("Please Save SOLIDWORKS file first!")

              Unload Export

              Exit Sub

              End If

               

              Set swView = swDraw.GetFirstView

              Set swView = swView.GetNextView

              Set swModel = swView.ReferencedDocument

              Set swCustProp = swModel.Extension.CustomPropertyManager("")

              swCustProp.Get2 "Revision", valOut, resolvedValOut

               

              Filepath = TextBox1.Text

              FileName = Mid(swDraw.GetPathName, InStrRev(swDraw.GetPathName, "\") + 1)

              FileName = Left(FileName, InStrRev(FileName, ".") - 1)

              swDraw.SaveAs (Filepath + "\" + FileName + ".dxf")

               

              End Sub

               

              Regards

            • Re: DXF Export - Options
              Rafal Niczyporuk

              You are the star!!! Thank you for the help

              All works perfect

               

              Last question

              At the minute macro saves files as: 00_filename,  01_filename .(which 00 is sheet 1 and  01 sheet 2 and so on)..is there any easy way to move '00' after file name ? (filename_00. filename_01.)

               

              Thanks!