July 10, 2018

Dynamo: Export Views and Sheets from Revit - Part 1

I had a request the other day to streamline the process of updating CAD Exports for an Autodesk Revit® project. Unfortunately, some team members are not working in Revit, so certain Views have to be exported to CAD on a regular basis for use as backgrounds for the non-Revit-using team members. After a bit of trial (and a little tribulation) along with an enormous amount of help from the generous souls who have posted sample code to the Community Forums at dynamobim.org, I came up with the following Dynamo graph. All of the nodes used are "out-of-the-box" nodes available in the 1.3.2 version of Dynamo, but there are two Python Script nodes, the code for which is based on example code posted in the Community Forums. (As always, click on a image to see a full-size version of the image.)

The end user has to do three things prior to using the graph:
  • Create a View/Sheet Set into which all of the Views and/or Sheets to be exported are placed.
  • Get the name of the DWG Export Setup to be used for the export. (Create a new one if required by the project.)
  • Identify the folder (with full path) where the exports are to be sent.
With that information in hand, the user can make a project-specific copy of the Dynamo file, enter those three items in the appropriate nodes, save the file, and then run it whenever updated exports are needed. Dynamo will overwrite any files of the same name in the target folder, so previous versions need to be archived elsewhere if a record of all exports is required. In the next few posts, I will go through the various sections of the graph, and, to the best of my ability, explain how each works, including the two Python Script nodes that do the heavy lifting. Before doing so, I would like to thank the following Community Forum contributors whose helpful responses to others' questions also helped me to complete this project.
  • Konrad K Sobon, for the code in the Python Script 2 node that does the exporting, as well as for the advice given to Andrea_Ghensi in the same thread regarding code to have a specific DWG Export Setup used for the export. See the full thread here.
  • Andrea_Ghensi, for the code in the Python Script 2 node that allows the user to specify an existing DWG Export Setup for the export (as amended by Konran K Sobon). See the same thread as the previous link.
  • 4bimfercesp, for the line in the code in the Python Script 2 node that allows the user to specify whether Views on a Sheet should be merged into the exported sheet or exported as a separate file that is externally referenced into the exported Sheet file. See the full thread here.
  • Kukul, for the code in the Python Script 1 node that extracts a list of the Views/Sheets in a View/Sheet Set. See the full thread here.
The nodes at the left side of the graph that are in green-colored groups are the nodes that require user input. I will conclude this first post with one of the simpler parts of the graph, the Folder for Exported DWGs - Directory Path node.
This is an instance of the out-of-the-box Directory Path node, with a modified node title. The Browse button allows the user to navigate to the folder where the exported drawings are to be placed. The output of this node is fed to the IN[0] input of the Python Script 2 node. One thing to note about this node, and the other user input nodes, is that if you right click on the node, you will see that the Is Input item on the context menu is checked. That means that this node will be available for user input in Dyanmo Player.

I am not certain how many clicks using this graph will save over manually doing the same export (probably a few on subsequent exports if Dynamo Player is used, without making any changes to the inputs), but it certainly will help make the process more consistent.

Next post in this series [Part 2]

No comments: