CAD Drawings to PDF with SolidWorks, eDrawings and VBA

An automated solution to make Acrobat PDF files from CAD drawings. The solution handles SolidWorks and AutoCAD drawings.
 

The problem

 
The company had a solution for plotting engineering drawings.  Employees in production had a fast utility to lookup CAD drawings. There were tens of thousands of drawings.  Printing was a simple button click.  There were no printer dialogs.  No printer choices.  No choosing settings.  Less wasted paper.  It was a huge time and resource saver.  With the upgrade to Windows 7 the supporting engineering tools no longer worked.  The efficient CAD printing no longer worked after the I.T. upgrades.
 

The parts

 
eDrawings is a free utility from SolidWorks.  eDrawings opens SolidWorks and AutoCAD drawing files.  eDrawings updates every year.  eDrawings handles new AutoCAD drawing formats with the updates.  Like most of SolidWorks, you can automate eDrawings.
 
novaPDF is a utility to generate Adobe Acrobat [.PDF] files.  novaPDF is available on Windows computers.
 
Microsoft Access 64bit.  Most use the 32bit versions of MS Access and MS Office.  For this solution we need a 64bit VBA capable container to host the eDrawings component.
 

The solution

 
With novaPDF create some virtual printers.  Create separate printers for each CAD drawing page size and orientation.  For example: ‘B_Size_portrait’, ‘B_Size_landscape’, ‘D_Size_landscape’, ‘C_Size_landscape’.
 
Create a blank MS Access database application.  Add a blank Form without a linked table.  Embed the eDrawings component into the form.  
 
Switch to the VBA editor for the MS Access Form.  The first step is a loop to watch for new SolidWorks or AutoCAD drawing files.  Opening each drawing file in turn.
 
Use the eDrawings component Event functions to handle the file once it opens.  The eDrawings component has properties to detect the drawing paper size and orientation.  Use those properties to choose the matching novaPDF virtual printer and print.
 
Provide error handling for the eDrawings Event functions for problems like corrupt files.  This app rejects undefined paper sizes.  We ran into a problem detecting AutoCAD drawing sizes that used different scales.  The solution was to calculate the size ratio of height to width and use the ratio to select the output paper size.  The MS Access/eDrawings solution becomes unstable after processing 40 to 50 files.  Auto-restarting MS Access after 20 to 30 files solves the problem.
 
This PDF Generator solution runs on a Windows virtual machine.  It averages processing drawing files every three to five seconds with moderate resources.  The solution keeps up with an engineering department of about a dozen.  Well over a hundred thousand legacy CAD files ran through the PDF Generator.
 
There are a few other pieces to the solution.  A lightweight, custom server process provides point and click printing.  A custom web server and front end JavaScript client provides searching and viewing.  The CAD library is now available to desktops, laptops, tablets and smartphones now. There are other, comercial solutions but this preserved the company’s workflow.