Are there any ways to export your SW drawings as DXF and PDF's automatically and for them to automatically update when you change the drawing?
I'm thinking you could using macros and you would need a macro to run when you either close or save the drawing...
Amen Allah Jlili
As John, mentioned, a macro can be made to do that.
I have this one that I've been using since 2011. The advantages in this macro are that it also saves a copy of the iges file as well AND it also saves those files to your SW file in the Design Binder. We used contract manufacturers all over the world so it was imperative that we had a system that worked. That may not be required in your workflow and disabling those functions is as easy as commenting out the lines as noted.
I have attached the macro file and pasted the text below. This macro would need to be run again to update the files. Though I'm not sure this will actually replace the files as I have never done so.
'This macro saves current drawing to PDF, IGS and DXF. Precondition is that you save an IGS file using the EXACT same name as the drawing file.
'Then this macro also inserts these files into the Design Binder
'Pack and Go will then add these files at the same time
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim Linked As Boolean
Dim sPathName As String
Dim nErrors As Long
Dim nWarnings As Long
Dim nRetval As Long
Dim bShowMap As Boolean
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim swExportData As SldWorks.ExportPdfData
Dim filename As String
Dim iPathName As String
Dim boolstatus As Boolean
Dim boolstatus1 As Boolean
Dim lErrors As Long
Dim lWarnings As Long
Dim bRet As Boolean
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
' Strip off SolidWorks drawing file extension (.slddrw)
' and add DXF file extension (.dxf)
sPathName = swModel.GetPathName
sPathName = Left(sPathName, Len(sPathName) - 6)
sPathName = sPathName + "DXF"
' Show current settings
' If swModel Is Nothing Then MsgBox "A Part or Assembly file must be open", vbExclamation: End
' the above line needs to be modified to check for the precondition of an igs file.
' Turn off showing of map
bShowMap = swApp.GetUserPreferenceToggle(swDXFDontShowMap)
Set swModelDocExt = swModel.Extension
Set swExportData = swApp.GetExportFileData(swExportPDFData)
filename = swModel.GetPathName
filename = Strings.Left(filename, Len(filename) - 6) & "PDF"
' Create IGS filename - comment out if not required
iPathName = Strings.Left(filename, Len(filename) - 3) & "IGS"
boolstatus1 = swExportData.SetSheets(swExportData_ExportAllSheets, 1)
boolstatus1 = swModelDocExt.SaveAs(filename, 0, 0, swExportData, lErrors, lWarnings)
swApp.SetUserPreferenceToggle swDXFDontShowMap, False
bRet = swModel.SaveAs4(sPathName, swSaveAsCurrentVersion, swSaveAsOptions_Silent, nErrors, nWarnings)
If bRet = False Then
nRetval = swApp.SendMsgToUser2("Problems saving file.", swMbWarning, swMbOk)
'Save files to Design Binder
'comment out the following lines if you don;t wish to save to the design binder in SW
boolstatus = swModelDocExt.SelectByID2("Design Binder", "DOCSFOLDER", 0, 0, 0, False, 0, Nothing, 0)
swModelDocExt.InsertAttachment filename, False
swModelDocExt.InsertAttachment sPathName, False
swModelDocExt.InsertAttachment iPathName, False
If boolstatus1 Then
MsgBox "Save as PDF/DXF and Added .PDF .DXF .IGS to Design Binder successful."
MsgBox "Save as PDF failed, Error code:" & lErrors '
'End Save files to Design Binder sub
' Restore old setting
swApp.SetUserPreferenceToggle swDXFDontShowMap, bShowMap
Retrieving data ...