




























































































Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!





























































































320096
Paul F Aubin Paul F Aubin Consulting Services, Inc.
Discuss how to combine logic, geometry, math, and BIM (Building Information Modeling) with Dynamo visual programming. We’ll use Dynamo to drive a Revit document and interoperate with other applications, data sources, and modeling tools. If you already have some experience with Revit and are looking to expand its capabilities with computation, this workshop is for you. In this long-format hands-on lab, we’ll introduce you to the basics of using Dynamo for Revit. We’ll explore how the two tools interface; the basics of building a Dynamo graph; and the logic, form, and structure of graphs—and we’ll help you understand how to apply what you’ve learned to your own solutions after the workshop. A basic understanding of Revit software and computer programming and scripting is helpful, but not required.
Paul F. Aubin is best known as the author of many books and video training courses for Revit and other Autodesk tools. He has 28 years of experience in the Architectural industry and has worn many hats in that period, from designer, to CAD Manager, technologist, and trainer. He continues many of these in his current role as an independent Architectural consultant based in Chicago. Paul is the founder of ChiNamo; the Chicago Dynamo Community.
Follow Paul twitter: @paulfaubin
Check out Paul’s Dynamo and Revit online training courses And be sure to check out: Dynamo Practical
Some of the content in this paper was developed by instructors in previous year’s version of this workshop. Special thanks for their contributions.
Kyle Martin twitter: @KCMarchitect Racel Williams twitter: @RacelWilliams Sol Amour twitter: @solamour
Start Time Duration Topic
1:00 PM 0:15 Welcome (Introduce team, session and agenda)
1:15 PM 0:10 Getting Started (Dynamo Player)
1:25 PM 0:20 Hello World! (Dynamo Basics, Nodes, Wires, Library, Dynamo Geometry version, Revit version)
1:45 PM 0:10 Code, Logic, Pseudo Code, Programming and Program Execution
1:55 PM 0:20 Placing a Single Family (Basic selection, Errors, Ranges, Lists, Lacing)
2:15 PM 0:10 Bonus items
Placing Multiple System Families (Working within Revit hierarchy, System vs. Component families)
2:25 PM 0:30 Placing Loadable Families (Array of points, introducing logic, using a package node)
2:55 PM 0:35 Importing and Exporting Data (Get and Set Parameters)^ (Using Excel)
3:30 PM 0:15 Use Excel to Edit Revit
3:45 PM 0:20 Afternoon Break
4:05 PM 0:30 The “I” in BIM (Performing Calculations on Model Data)
4:35 PM 0:30 Using CAD Data to build Revit Geometry (Extract CAD, geometry analysis, element creation)
5:05 PM 0:45 A Curtain Wall Challenge (Adaptive components, geometry analysis)
5:50 PM 0:10 Q&A
6:00 PM Wrap up
It is important to understand how to structure a problem. This means clearly deciding what you want to do and then breaking it down into the component steps required to achieve the desired results. Most Dynamo scripts follow a simple structure: Input, Process, Output. This means that you bring data and geometry into Dynamo. You ask Dynamo to do something to those items; process or manipulate them in some way, and then you output the results; usually back to Revit.
The session is hands-on. This means that we want you to follow along. Don’t just sit back and watch. You will get MUCH more out of the session by participating and following along. Detailed steps are included here, so you should be able to keep up. But if you do get behind, there are several intermediate versions of the files provided throughout the handout. They look like this:
SAMPLE F ILE : You can open a file completed to this point named: 00_Sample File.dyn.
These files should help you keep pace with the session without getting too far behind. You can always perform the steps shown here later after the lab. So, it is highly recommended that you use the catch-up files instead of getting way behind in the live lab session. But we have lab monitors roaming around as well. Please feel free to raise your hand and ask for help.
If you are comfortable with Dynamo already, some of the material in this session will already be familiar to you. So, feel free to stray off on your own and experiment freely. Take the time to experiment a little, and break things! This is a great way to learn. There is an appendix at the end. And some bonus content there and elsewhere in the handout that we will not get to in the live session. You can review that material after the session or even in the live session if you get ahead of the group.
There are many online resources that can help you on journey to learn more about Dynamo. There is a list in the appendix that you can consult before and after the session. But we would like to share a few useful resources with you right away: dynamobim.org/ - the Dynamo home page. http://primer.dynamobim.org/en/ - an introductory tutorial on getting started with Dynamo. dictionary.dynamobim.com – this is a searchable database for Dynamo functionality.
This is a hands-on lab. So, let’s start right in and do some hands-on exercises. The first example will show us how to access Dynamo from within your Revit interface and use a premade script using the Dynamo Player.
To access Dynamo, you first launch Revit, open a project or family document and then click the Dynamo button on the Manage tab (see Figure 2). This will launch Dynamo in a separate
window. Dynamo requires an active Revit document^1 , and it will “tether” itself to this document^2. So be sure to open a file first. It can be a project or a family. ( Don’t do this yet , the hands-on steps begin with the next topic).
F IGURE 2 Working with two screens is recommended. If you don’t have two (such as here in the lab), you will want to position Revit so you can see the model behind the Dynamo window. From the Manage tab, you can also run Dynamo Player (using the button on the ribbon right next to Dynamo). We’ll do this in the first exercise.
Dynamo Player allows existing Dynamo graphs to be run in Revit through a simple interface. This is a convenient way to share Dynamo graphs with your team and reuse them on multiple projects. Users do not need to have extensive experience with Dynamo to use scripts through Dynamo Player. Let’s run our first Dynamo script from the Dynamo Player. To do so, we first need to launch Dynamo Player and then point it to the location where the scripts for the lab are stored.
There are a few icons across the top.
(^1) Dynamo for Revit requires Revit to run. There is a stand-alone version of Dynamo called Dynamo Studio
which does not require Revit and runs as a separate stand-alone application. We will not be using Dynamo Studio in this lab. Further, be aware that Dynamo Studio has no Revit nodes. (^2) Be sure to save or synchronize your current Revit session before launching or running a Dynamo graph. If Revit or Dynamo crashes, it will bring down both. (^3) We are using the default United States Imperial project template in this lab. Other templates should work as well if you prefer, but differences in settings and units may make for variations in your results and what is pictured here. (^4) We will instruct you in the lab where to locate the dataset on your lab computer. If you are using your
own laptop, or following these instructions after AU, you can visit: http://paulaubin.com/au/ to find this paper in PDF format and a downloadable ZIP file containing the dataset files. Unzip these files to a folder on your system and then browse to that location in the instructions here.
There are inputs in the script that control what the comments say and where the wall is drawn onscreen. We can edit those directly from Dynamo Player.
This will display the inputs for the graph.
F IGURE 6 This graph has inputs for the X and Y values of the two endpoints of the wall, the wall type that is used, the base and top levels and of course the value of the comments field. You can change any of these. (To change levels, you would need to add some new levels in the Revit file first). If you don’t erase the wall, when you run a second time, it will create a new wall. So now that you have seen a simple graph in action, let’s close Dynamo Player, and launch Dynamo itself and create this graph from scratch.
Now that we’ve seen Dynamo Player and the results of an existing graph with inputs, let’s try our hand at creating our own graph by launching the Dynamo application. We will recreate the graph we just ran piece by piece. Dynamo will launch in a separate window. Dynamo requires an active Revit document, and it will “tether” itself to this document. So be sure to have a file open first. It can be a project or a family. Working with two screens is recommended. If you don’t have two, you will want to position Revit so you can see the model behind the Dynamo window.
F IGURE 7 The Dynamo interface will load with menus across the top, the library on the left and the main graph editing window filling the remainder of the screen. Some navigation tools will appear in the upper-right. At the bottom of the screen is the execution options button (see Figure 8).
F IGURE 8
simple numerical values. Making sure that you always feed the right kind of data into an input is critically important in Dynamo. We’ll get into that much more later, but in this case, numerical input is required.
To wire up your nodes, simple click on the port of one node, a wire will extend out of the port as you move your mouse. Click on another port to finish the wire and connect the two ports
Notice that the point onscreen is unchanged. This is because the Number nodes use the same default (0) as the Point.ByCoorindates node does.
Notice that the point will move accordingly. Inputs can only have one wire. But multiple wires can be connected to outputs allowing output values to feed into several other locations of the graph. To see this, you can try connecting the output from one of the Number nodes to both inputs of the Point.ByCoordinates node. This would mean that the X and Y coordinates would always be the same. Reverse this when you are done experimenting so that we have one Number feeding each input separately.
As we saw previously, you can browse the library by clicking on the category headings to see what is stored within them. But Dynamo contains LOTS of nodes. So, browsing this way can be time consuming. An alternative is to search for nodes. There is a Search field at the top of the library and you can also right-click in the canvas to get a search field on the context menu as well (see Figure 11).
F IGURE 11 However, the trouble with searching if you are a beginner is knowing what to search for… So, we recommend that you take some time initially to browse the library and get familiar with the included nodes and overall library structure. In the graphs that follow, we indicate where each node is in the library for your convenience. You are always free to search for them instead if you wish however.
Here is a summary of the most important concepts covered in the previous exercise: Dynamo files are referred to as “scripts” or “graphs.” Dynamo is accessed from within Revit and requires an active Revit document to run. Access Dynamo and Dynamo Player on the Manage tab. Dynamo Player runs pre-built Dynamo graphs without the need to open Dynamo. Dynamo Player gives access to input nodes included in the scripts allowing users to interact with the script and change input values. Dynamo graphs are built from left to right. Locate nodes (prebuilt bits of code that perform specific actions) in the library by browsing or searching. Wire nodes together by connecting outputs to inputs. Outputs can have more than one wire feeding into multiple inputs. Inputs can only contain a single wire. Graphs flow from left to right.
Once you are familiar with the overall interface, you will want to create your first graph. Programmers always like to show the “Hello World” example as an “ice-breaker.” In other words, something really simple; something that gives quick results.
SAMPLE F ILE : You can open a file completed to this point named: 01_Hello Wall_A.dyn. (In the Open dialog, uncheck “Open in Manual Execution Mode” before opening).
F IGURE 13 Well, that is a complete graph, just not very useful or exciting. Let’s vary it a bit.
The Watch will still be wired to the original node and will now only report “Hello.” To put the two together, remember that we cannot put two outputs into a single input. If you try to wire “World” to the Watch, it will replace the wire from “Hello.” So instead, we need another node to combine their values first.
So how do we combine them? Well there are lots of ways. Here’s a simple one.
F IGURE 14 Notice that it is quite literal and will report “HelloWorld” as the result. You can edit the first String node and add a space at the end of “Hello ” to fix that. The graph will update immediately. Again, this is not too exciting, but even this simple example shows how data flows through the graph. Let’s take it a little further. Since we have a + node, what about some numerical input?
SAMPLE F ILE : You can open a file completed to this point named: 01_Hello Wall_B.dyn. (After opening, change the execution mode at the bottom from Manual to Automatic).
In the library, on the Input > Basic branch, click on the: Number node. Wire the Number node to the y input of the + node. Note the result in the Watch. In this case, Dynamo will happily combine text with numbers, but since one of the inputs is text, it will keep the result as text. But if you create a second Number node and wire it in, it will do the math instead (see Figure 15).
F IGURE 15 It is worth repeating that when we fed in text, the + node produced a text result (concatenation), but only when both inputs were numerical did it produce the numerical output (math). This is critically important. Dynamo is very sensitive the type of data being input. Many errors encountered have to do with incompatible data types. We will discuss this more later. But for now, please make note that understanding and properly matching of data types are a critical component to success in Dynamo.
SAMPLE F ILE : You can open a file completed to this point named: 01_Hello Wall_C.dyn. (After opening, change the execution mode at the bottom from Manual to Automatic).
Using Dynamo to add two numbers may not be very exciting nor faster than your calculator, but there is plenty more that you can do with numbers. The “hello world” of making geometry would be making points; like the one we did above. So, let’s return to making points. The Geometry > Points > Point branch has a few options for making points (see Figure 16).
F IGURE 16 The main difference for most of them is in the inputs required. Let’s look at the Point.ByCoordinates that we used above (shown second from the right in Figure 16). It is the simplest one and only needs an x and y input. If you hover your mouse over an input, it will typically tell you what it expects and if there is a default value. In this case, simply placing
F IGURE 18
F IGURE 19
The Watch nodes are not necessary here. It can be nice to include them as you are working so that you get feedback as you go. In this case however, you see the points in the 3D canvas. So the Watch nodes really don’t add any value to the graph. You will also notice that Watch nodes have outputs. You can wire from those or go back to the original node and wire from their output. Notice that here, we have done the latter. This makes it easier to remove the Watch nodes later without forcing you to re-wire anything. There is an alternative to Watch nodes. You can instead receive feedback directly from the node itself. When you hover your mouse over a node, it will show a little pop-up (called a “preview bubble”) with the output of that node. There is a small pushpin icon that you can click to keep the preview bubble expanded even as you move your mouse away (see Figure 20).
F IGURE 20 If you use the preview bubbles, you can eliminate the Watch nodes. Or you can use both. It is up to you.
SAMPLE F ILE : You can open a file completed to this point named: 01_Hello Wall_E.dyn. (After opening, change the execution mode at the bottom from Manual to Automatic).
As noted before, when building your graph, think about what you want to create, add the nodes that will create what you need and then look to see what inputs are required. For example, if you started the previous exercise with the Line node, then look at its required inputs, that would have told you that you needed two points. This approach helps you figure out what will be required. Once you have a line, you can use it to make many things; like a Revit wall for example! There are two nodes available for adding walls. Both let us build a wall from this Dynamo line that we already have. At this point we should stress that while you are potentially seeing a blue preview line in Revit, we have not yet created any actual Revit geometry. When you work in Dynamo, you will be frequently creating Dynamo geometry, then using that to build Revit geometry and vice-versa. But they are too different things! (See the next topic for more information on this concept).
This node has four inputs: c stands for “curve.” We also need two levels to set the height and a wall type. As noted previously, a useful habit to get into is to pause your mouse over the various inputs for a tooltip indicating more information on what that input expects (see Figure 22).
F IGURE 21 To make a wall, we need a path for it follow. In programmer speak this is called a “curve.” This is “curve” in the math class sense of the word; not necessarily “curvy.” By this definition, our line
appears in Dynamo is a good indication that there is a difference between “Dynamo geometry” and “Revit geometry.” Dynamo geometry only appears in the Dynamo environment and is more abstract. You can use Dynamo geometry to create Revit geometry (as we have done here) and vice-versa. But you will not automatically get both. If you want to see a representation of the wall in Dynamo, you can do so by adding another node to the graph^7.
F IGURE 23 If you want to orbit, pan or zoom the 3D preview in Dynamo, use the small toggle icons at the top right to switch to navigation in the 3D view. Then switch back to the graph when you are done. You can also temporarily switch by holding down the ESC key and then using the mouse buttons and wheel to orbit, zoom and pan.
SAMPLE F ILE : You can open a file completed to this point named: 01_Hello Wall_F.dyn. (After opening, change the execution mode at the bottom from Manual to Automatic).
The original graph that we ran at the start (using Dynamo Player) contains one more piece. There was a value input into the comments on the wall created. Two of the most useful nodes in the library allow us to “get” and “set” parameters on Revit elements. The “get” nodes retrieve a value from some parameter in the Revit model while the “set” nodes write a value to a specified parameter. We’ll try the “set” one now.
Notice that it takes three inputs: element , parameterName and value. The element input takes a Revit element like the wall we created with this graph. The parameterName input is a string and takes the name of any parameter of the element in the first input. In this instance, we want to write to
(^7) It can be tempting to add the Geometry node to the graph to see a nice preview directly within Dynamo.
But do this sparingly as in many cases it can add significantly to the time it takes to process the graph.
the “Comments” parameter. Also keep in mind that you must be sure to type the name exactly. It is case sensitive. Finally, the value input takes the value you want to write. Since Comments is a text parameter in Revit, the value we input here will be text as well using a String node^8.
F IGURE 24
SAMPLE F ILE : You can open a file completed to this point named: 01_Hello Wall_G.dyn.
This graph is now complete and matches the one we ran at the start from Dynamo Player with one small exception. If you recall when we edited the inputs using Dynamo Player, they had user friendly names like: “Start X Coordinate” and “Base Level.” If you were to run the graph we just completed in Dynamo Player, the inputs would not have these names, but rather would simply display the generic names of the various nodes like: Number, String, etc. If you intend to use a graph in Dynamo Player, you must designate which nodes are to be inputs and you can rename the nodes to make the input names more user friendly. To do this, right- click on a node and choose: “Is Input.” To rename it, simply double click the titlebar on the node you want to change. This will let you type in a new name. If you have a node that you do not want to appear as an input in the Dynamo Player, right-click on it and uncheck “Is Input.” In our
(^8) Data type is very important in Dynamo. If you feed the wrong type of data to an input, it will fail. In this case it is a simple string. But in many cases it will be something more specific.