Auto PDF Print from Revit 2014

Below, we will take a look at a Revit multi-project batch PDF printer project driven by the Windows task scheduler and the Revit Idling event.

Before getting to that, though, let me share some of my Sunday activities.

Contact Impro Jam and Tech Summit Arrival

From the Fells, I continued along the Mystic Valley Parkway and stopped to enjoy the beautiful Mystic Lakes on my way to the weekly Sunday contact improvisation jam in the Arlington Center, followed by a magnificent lunch at Sabzi Persian restaurant and wonderful conversation with Mike Klinger of Anzu Global, who actually used to work with Revit at Autodesk, as it turns out. Small world.

In the evening I checked in to the Tech Summit hotel on the Charles River in Cambridge and went for a very nice dinner with Adam, Manu and Mikako to the Spanish Tapeo restaurant on Newbury Street in Boston. That was the first time I set foot in the city since my arrival.

As Mikako pointed out, it is quite a novelty for me to be pleased with restaurant food – I normally prefer to cook myself – and on Sunday I had two good experiences in a row! Yay!

Back to the Revit API.

Batch Processing RVT Files Overnight

This is a contribution from Dan Tartaglia of design technology@NBBJ.

It started off from the following query:

Question: I created a tool that uses a UIControlledApplication Idling event when Revit launches. It works perfectly correctly in Revit Architecture 2013. However, if I use the same code on the same computer in Revit Architecture 2012, the Idling event does not fire.

Answer: In Revit 2012, the Idling event is not fired until a document is opened.

Response: Is it possible to open launch Revit then open a RVT file programmatically in Revit 2012? I can do this in Revit 2013 via the Idling event.

Answer: Yes, definitely. Simply specify the project filename on the Revit.exe command line.

Response: I got it to work after all. I just open a small dummy RVT before processing the RVTs for the users. I am using this to implement a batch PDF printer than can run from the Windows Task Scheduler overnight.

Based on this approach, Dan implemented AutoPDFPrint, a Revit multi-project batch PDF printer than can be driven by the Windows Task Scheduler overnight.

Task Scheduler and Revit Idling

Dan underlines that the Task Scheduler and Revit API Idling event allow you to automate almost any task. A few that help my firm are:

Some new features in the Revit 2014 API make the above tasks easier still, e.g. the OpenDocumentFile method that now enables you to open workshared RVT files detached from central and determine which user created worksets are open or closed.

There are a couple of things you need to consider before running any of the above tasks:

AutoPDFPrint Components

Looking in more detail at the PDF printer system, one its parts is the AutoPDFPrint_Bridge executable run from the task scheduler:

AutoPDFPrint_Bridge executable

The second component and the main actor in the process is the AutoPDFPrint Revit add-in:

AutoPDFPrint Revit add-in

Here are the detailed steps required to set up the system:

  1. Adobe PDF print preferences
  2. CFG file
  3. Task scheduler

All components presented are available for download below.

Step #1 – Set Up the Adobe PDF Print Preferences

  1. Click the Windows 'Start' button and select 'Devices and Printers'.
  2. Right-click the 'Adobe PDF printer' and select 'Printing Preferences'.
  3. Change these settings:
    1. 'Adobe PDF Page Size' to user Documents folder.
    2. 'View Adobe PDF results': disable.
Adobe PDF Print Preferences

Step #2 – Set Up the CFG File

  1. The CFG file goes here:
    C:\AutoPDFPrint2014\Scripts
    
  2. CFG file example name:
    100XXX.00 - My Project.cfg
    
  3. CFG file format (comma delimited):
    <view/sheet set>,<print set>,<RVT file>,<output folder for PDFs>
    
CFG File

Notes:

Step #3 – Set Up the Task Scheduler

  1. Open the Windows Task Scheduler:
    Click the Windows 'Start' button and select All Programs > Administrative Tools > Task Scheduler.
  2. Create a new Task.
    In the Actions tab:
    1. Program/script:
      C:\AutoPDFPrint2014\Program\AutoPDFPrint_Bridge.exe
      
    2. Add arguments (optional):
      “100XXX.00 - My Project.cfg”
      
Task Scheduler

Notes:

Download

Here is Auto_PDF_Print_from_Revit_2014_example.zip containing the following:

  1. ReadMe.txt (this list).
  2. Auto PDF Print from Revit 2014.vsd (pseudo logic).
  3. Auto PDF Print from Revit 2014.docx (instructions for use).
  4. Folders.zip (copy the Projects and AutoPDFPrint folders to the root C:).
  5. AutoPDFPrint.zip (Revit 2014 add-in Application).
  6. AutoPDFPrint_Bridge.zip (EXE run from Task Scheduler).

Thank you very much, Dan, for implementing and sharing this powerful tool.