From the course: Dynamo for Revit Project Setup

Import data for levels into Dynamo - Dynamo Studio Tutorial

From the course: Dynamo for Revit Project Setup

Start my 1-month free trial

Import data for levels into Dynamo

- [Instructor] As we talked about in the last chapter, levels are an important step to generating our floor plan views. So let's begin our Dynamo graph by creating our levels first. If you haven't yet saved the Excel file that you've been working in, now's a good time to do it. Let's switch windows and head back over to our Revit project. To launch Dynamo click on the manage tab, and then click on the Dynamo button. On the Dynamo home screen, let's click to create a new work space. We cover importing data from Excel at length in the Dynamo essential training course. So we're going to move through the next few steps fairly quickly. The node that we'll need to read an Excel file is under the office section of the node library. I'll drop it in the Excel read from file node. In order for this node to run, we need to point Dynamo to an Excel file to read, and specify the name of a worksheet with the data we want to bring into Dynamo. Let's start by dropping in a file path node, which we'll find under the core input section of the node library. This node let's us browse our computer or server to find the Excel file that we want to bring in. I've been working in the exercise files folder on my desktop, within the Excel sub folder. I'll click on project startup, and then click open. Next we need to head over the core file section of the node library, for a file from path node. To have Dynamo look at the Excel file of the path that we just specified. For more detail on why this is a necessary step, take a look at the Dynamo essential training course. Now that we've finished pointing Dynamo to our Excel file, we can go ahead and plug in the file to the file input on our Excel read from file node. Next we need to tell Dynamo which worksheet in the Excel file contains the data we want to bring in. As you probably remember from the last chapter, we've populated several sheets of data about the Revit project file we want to generate. Since our first step is to create a set of levels in Revit, we're interested in having Dynamo read the sheet containing the names and elevations of all the project's levels. As you can see, we've titled that worksheet levels. Let's remember the name of this sheet name, paying close attention to which letters are upper and lowercase, so that we can specify it properly when we hop back over to Dynamo. For our sheet name input we need to type out a string of text that matches our levels worksheet name. A quick way of doing this is to double click on an empty part of the work space to create a new code block, then type the name of our Excel worksheet inside quotations. To finish editing the code block, click on an empty space on the work space. For more on using code blocks to create strings, numbers, and boolean data types, take a look at the Dynamo for Revit Workflows course in the library. Notice from the code blocks node preview that the quotations have disappeared. We only needed those quotations to tell Dynamo that the data inside them should be a string data type. Which is the type of data that the Excel read from file node is expecting in the sheet name input. Now let's go ahead and connect these two nodes. The fact that our Excel file opened itself automatically is a good indication that Dynamo looked at the worksheet, in order to bring the data into Dynamo. Excellent the node did run properly. We're now seeing a nested list organized in the same way as our table in Excel. The first list contains two items. Which are the headers of our data, name and elevation. Then for all of the rest of the lists here, we see a level name at index zero, and the corresponding elevation index one. As you remember from Excel, level one is at zero elevation, level two is at 15 feet, level three at 25, and so on through our roof level at 60 feet. But before we use the data that we've collected here to create our level objects, we should do one bit of housekeeping. This header row is useful to you and me because it reminds us of how the data is organized, but Dynamo is only interested in lists that index one through the end of the list. Let's drop in two nodes onto our canvas. One of them is going to isolate the first list in our set, and the second node will be to separate out all of the data that Dynamo is interested in looking at, in order to create our level objects. I'm going to head over to the core list section of the node library, and I'll drop in the first item node, and the rest of items node. Then I'll plug our Excel data into both. As you can see here, our list first item node, has isolated our column headers, and the rest of items node, has separated out the information that Dynamo is going to need to create the levels. This first item node is pretty much just a reference for us in case we need to come back and remind ourselves what the rest of items data is for. In the next video, we'll use the rest of items node data, as a way of generating our Revit level objects.

Contents