When Dynamo was first released for Autodesk Revit I assumed that this would just be used for computational geometry and complex architectural forms. However, I recently took a deeper look into Dynamo and started to realise that this has many uses for the everyday management of models, manipulation of data and the automation of typical time consuming tasks.
I have created a small Dynamo program to create drawing sheets by reading data from an Excel Sheet and also generate parameters for each view to aid the view categorisation. I was surprised at how quickly this visual ‘code’ came together! Let’s take a look at the process from the start.
First you need to make sure that you have Dynamo installed, this is installed automatically with Revit 2015 R2 and Revit 2016 but can be installed separately for older releases. The versions are changing very rapidly so in this tutorial I am using Dynamo V0.8.
In the future I can see Dynamo appearing in many other Autodesk applications as it has a very flexible and intuitive interface for the average Revit user that is not a coding expert.
Let’s now look at the steps required to create this visual application. This of course can be scaled up to meet more demanding procedures as required!
- Start a new Revit Project and then launch Dynamo from the Add-Ins Ribbon as shown below.
- Start Microsoft Excel and create a document that contains the following columns, you can of course use your own names, numbers etc. Microsoft Excel is particularly good for this type of work as the drawing number can be created from specific entries in other columns.
- Next you rename the Excel sheet to the following. Save the Excel file in a location of your choice.
4. Switch to Dynamo and start a new Dynamo File.
5. You will now see the main Dynamo interface. The Dynamo application is split between the node library on the left and the Workspace on the right. You will also notice that Dynamo has a search function at the top of the node library for locating specific nodes. Note that older versions of Dynamo may not display icons.
Start by searching for the File Path node as shown below.
Click the File Path node once and it will be added to your workspace. The workspace can be zoomed and panned in the same way as Revit and you can drag the node to any location within the workspace.
Click the Browse button and locate your Microsoft Excel file. This node will allow you to select any type of file on your PC.
6. Next you add File from Path node. This should appear in the node library as it contains the File Path search string. Click this node to add it to the workspace.
Next you ‘wire’ the nodes together as shown below. This is the primary method of building a visual program within Dynamo. At any time you can select the small grey square below the file node to display a watch window to show the current output.
7. Using a similar process you can search for the Excel nodes and add Excel.ReadFromFile and a String Node. These should look like the following as shown below. The String entry is used to select the correct sheet in Microsoft Excel, in our case we named it ‘DRAWING NUMBERS’. Note the Watch window now shows the data from the Excel File. If any boxes show in Yellow then there is an error in your inputs.
8. Next we need to split the data into separate columns from the list. Note that the watch window shows [0], [1] and [2]. These are the column headers in Excel.
9. Type List.Transpose in the Search nodes and then add this to the workspace. Wire the Var[][] node to the List node. You then search and add a Number node and also the List.GetItemAtIndex.
Wire these together as shown below. Again click the grey Square box to show a Watch window of the data. Notice that this is now reading the first column of the Excel Sheet.
10. You then repeat this process to create three separate lists. Note that you can copy and paste the nodes for speed. Select the nodes with the Ctrl Key and then Ctrl-C and Ctrl-V and then rewire. Your workspace should now look similar to the below image.
11. Next we create a new node to create the drawing sheets in your Revit project. In the search field type ‘Sheet By Name’ and then add the ‘ByNameNumberTitleblockAndView’ node to your workspace. You can then wire the Sheet Name and Sheet Number and connect these to the relevant lists as shown below.
12. The next step is to tell the node what titleblock to use. In this example we will use the default A1 Metric title block. Type ‘Family Types’ into the node search and add this to the work space. Also search for ‘Views’ and add this to the workspace as shown below. You can of course use your own settings for the title block and view. In this example I have used the North Elevation for the first view and A1 metric for the Title Block.
That should be your code. The Running of this code is probably set to Automatic by default but you can select run in the bottom left of the Dynamo interface as shown below.
I hope that this has shown how useful and simple Dynamo can be for automation of tedious operations. I will showcase some more uses for Dynamo in future tutorials.
LawrenceH