Populating Revit with BS1192 drawing numbers with Dynamo
Dynamo script for importing data from Excel is very useful to achieve correct standardised naming of files in accordance to BS1192, so let's begin...
|Project||Originator||Zone||Level||File Type||Role||Number||File Container|
This is the 7 field library naming that provides a unified approach to identifying objects across data sets and associated tools, but how do we get this from an excel spreadsheet into Revit at the click of a button?
First of lets start Revit 2017 and launch Dynamo through Revit. This is done through the Manage Tab – Visual Programming Panel and selection Dynamo form the drop down. Click on the new Lets start a new Dynamo file.
So lets add some nodes to bring our Excel information into Dynamo. The nodes that we need to link the excel spreadsheet are first of all “File Path” node. This allows us to link in an external file. “File.FromPath” allowing us to create an object from the linked file. We then have to get Dynamo to read from the excel file. To do this we use the “Excel.ReadFromFile” Node. We Also want to tell Dynamo what sheet in the excel spreadsheet we are wanting to extract the data from. To do this we add a “String” node and give the string the value of the sheet name. For example if the sheet is named “DRAWING NUMBERS” then this is what you enter into the string node. Bare in mind that this is case sensitive. Once we have these starting nodes loaded lets joint them together.
Right, so now that we have linked the required information into Dynamo, we now need to organize it. We need to list the data that is contained within the excel spreadsheet, to do this we use the node “List.Transpose”. From this list we can start to get items from the spreadsheet use the “List.GetItemAtIndex” and user the “Number” node to tell Dynamo what column within the spreadsheet to reference to. So a 0 in the number node will reference column 1. So let’s join them together.
Now we have the file linked into Dynamo and we are telling it where to look in the spreadsheet. now lets take that from Dynamo and populate some sheets with the information within the excel document. To do this we require 3 nodes. the first one is the “Sheet.ByNameNumberTitleBlockAndView” allowing Dynamo to create the sheets within Revit. You need to then specify the titleblock family that you want to use. For this example i have specified the pre-loaded example. To specify the titleblock you need to load the “Family Types” node and specify the family. To get this to work you also need to place a view on one of the sheets. Use the “Views” node to specify a view to add to a sheet. This will only add the selected view to one of the sheets. Add them all together and you are almost there.
Click “Run” if you haven’t got automatic on and check the project browser to see the populated sheets with the numbers from the spreadsheet.
There we go. A simple and fast way of populating titleblocks with their file container number all from a spreadsheet.
Interesting in finding out more or perhaps fancy going on a training course? Request bespoke training or view our current Autodesk public courses via: http://www.pentagonsolutions.com/training/
By Matt Hull,
AEC Software Consultant, Autodesk Certified Professional
Original post HERE