How Do I Convert Multiple Drawings From SolidWorks to PDF?

Converting multiple drawings from SolidWorks to PDF can be a time-consuming task if done manually. Thankfully, there are a few methods you can use to streamline this process and save yourself valuable time. In this tutorial, we will explore two different methods to convert multiple SolidWorks drawings to PDF effortlessly.

Method 1: Batch Conversion using SolidWorks Task Scheduler

If you have a large number of drawings that need to be converted to PDF, using the SolidWorks Task Scheduler is an efficient way to automate the process. Follow these steps:

  1. Step 1: Open the Task Scheduler by going to Start > All Programs > SolidWorks 20XX > SolidWorks Tools > SolidWorks Task Scheduler.
  2. Step 2: In the Task Scheduler window, click on the “Convert Files” option.
  3. Step 3: Click on the “Add Files” button and select all the SolidWorks drawings you want to convert.
  4. Step 4: Choose the destination folder where you want to save the converted PDF files.
  5. Step 5: Set any additional options you require, such as specifying a prefix or suffix for the file names.
  6. Step 6: Click on “Convert” and wait for the Task Scheduler to complete the conversion process.

This method allows you to convert multiple drawings from SolidWorks to PDF in one go, saving you time and effort.

Method 2: Using a Macro in SolidWorks

If you prefer using macros, this method might be more suitable for you. Follow these steps:

  1. Step 1: Open SolidWorks and go to “Tools > Macro > Edit” to open the Visual Basic for Applications (VBA) editor.
  2. Step 2: In the VBA editor, click on “Insert > Module” to insert a new module.
  3. Step 3: Copy and paste the following code into the module:

Sub ExportToPDF()
    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Dim swDraw As SldWorks.DrawingDoc
    Dim FileList As Variant
    Dim FilePath As String
    
    Set swApp = Application.SldWorks
    
    FilePath = "C:\Destination\Folder\" 'Specify your destination folder path here
    
    FileList = BrowseForFiles("Select SolidWorks Drawings", "*.SLDDRW")
    
    If Not IsEmpty(FileList) Then
        For Each FileName In FileList
            Set swModel = swApp.OpenDoc6(FileName, swDocumentTypes_e.swDocDRAWING, swOpenDocOptions_e.swOpenDocOptions_Silent, "", errors, warnings)
            Set swDraw = swModel
            
            'Export PDF
            FilePathAndName = FilePath & Left(swDraw.GetTitle(), InStrRev(swDraw.GetTitle(), ".")) & "pdf"
            swDraw.ExportToPDF FilePathAndName
            
            'Close drawing without saving changes
            swModel.CloseDoc False
        Next FileName
        
        MsgBox "Conversion complete! ", vbInformation, "Success!" 

Else
        MsgBox "No files selected. ", vbExclamation, "Error!" End If
    
End Sub 

Function BrowseForFiles(Title As String, Filter As String) As Variant
    Dim FileOpenDialog As Object
    Set FileOpenDialog = CreateObject("MSComDlg.FileOpenDialog")
    
    FileOpenDialog.AllowMultiSelect = True
    FileOpenDialog.Title = Title
    FileOpenDialog.Filter = Filter
    
    If FileOpenDialog.Show = 0 Then Exit Function
    
    BrowseForFiles = FileOpenDialog.FileNames
    
End Function
  1. Step 4: Modify the destination folder path in the code to specify where you want the converted PDF files to be saved.
  2. Step 5: Save the macro and close the VBA editor.
  3. Step 6: In SolidWorks, go to “Tools > Macro > Run” and select the macro you just created.

This method allows you to automate the conversion process using a macro, providing a more personalized approach.

In Conclusion

Converting multiple SolidWorks drawings to PDF can be time-consuming when done manually. However, using either the SolidWorks Task Scheduler or a custom macro can significantly streamline this process. Choose the method that suits your workflow and start saving time today!