Docsity

Computational BIM Workshop: Beginner Dynamo for Revit, Guías, Proyectos, Investigaciones de Computación Gráfica

Toggle sidebar
bg1
Page 1
320096
Computational BIM Workshop:
Beginner Dynamo for Revit
Paul F Aubin
Paul F Aubin Consulting Services, Inc.
Description
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.
Speaker
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
Learning Objectives
• Learn how Dynamo and Revit work together, and how to build your first graph
• Learn concepts like input and output, list usage, and management and lacing
• Learn how to break down a problem into simple manageable steps and construct
the logic of your graph
• Learn how to interact with outside tools like Excel and AutoCAD using Dynamo as
the conduit to this outside data
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Vista previa parcial del texto

¡Descarga Computational BIM Workshop: Beginner Dynamo for Revit y más Guías, Proyectos, Investigaciones en PDF de Computación Gráfica solo en Docsity!

320096

Computational BIM Workshop:

Beginner Dynamo for Revit

Paul F Aubin Paul F Aubin Consulting Services, Inc.

Description

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.

Speaker

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

Learning Objectives

  • Learn how Dynamo and Revit work together, and how to build your first graph
  • Learn concepts like input and output, list usage, and management and lacing
  • Learn how to break down a problem into simple manageable steps and construct the logic of your graph
  • Learn how to interact with outside tools like Excel and AutoCAD using Dynamo as the conduit to this outside data

Agenda for Workshop

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.

This is a LAB

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.

Appendix, Bonus Material and Advanced Users

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.

Additional Resources

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.

00–Getting Started

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.

Accessing Dynamo

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.

Using Dynamo Player to Launch a Graph

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.

1. Launch Revit 2020.1.

2. Create a new empty project file from the Default Architectural template file^3.

3. On the Manage tab, on the Visual Programming panel, click the Dynamo Player button.

There are a few icons across the top.

4. Click the first icon to Browse to a folder containing Dynamo scripts.

5. Browse to: [Local location of the lab datasets]^4 and then click OK (see Figure 3).

(^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.

Edit Dynamo Player Inputs

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.

1. Click the small Edit inputs icon directly beneath the name of the script (see the left side of

Figure 6).

This will display the inputs for the graph.

2. At minimum, change the: Value of Comments (optionally change some other inputs too).

3. Scroll back to the top if necessary, then click the run button to run the script, again. Select

the wall and check its Properties (see the right side of Figure 6).

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.

4. Close Dynamo Player.

5. Delete the wall(s) created by Dynamo Player.

Running Dynamo

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.

6. From the Manage tab, launch Dynamo and then click the New button on the welcome

screen, to create a new Dynamo file (also called a “graph”) (see Figure 7).

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.

8. In the library, click on: Input , then Basic , then Number. Click it again to add a second one.

9. Drag the two Number nodes by their titlebars to position them to the left side of the

Point.ByCoordinates node.

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

10. Click on the output port (right side) of the first Number node and connect it to the x port of

the Point.ByCoordinates node. Repeat for the second Number connecting it to the y port

(see the right side of Figure 10).

Notice that the point onscreen is unchanged. This is because the Number nodes use the same default (0) as the Point.ByCoorindates node does.

11. Click in the Number node that feeds the y coordinate and change it to: 10. Press ENTER.

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.

Finding Nodes

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.

Summary of Key Concepts

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.

01–Hello World

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.

6. Add another String node. Type: “Hello” in the first one and: “World” in the second.

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.

Combining Values

So how do we combine them? Well there are lots of ways. Here’s a simple one.

7. On the Math branch of the library, expand Operators and then click the + node.

This has two inputs: x and y. These can be anything (kind of like algebra class…)

8. Wire “Hello” into x and “World” into y. Then wire the output of + to the input of the

Watch node (see Figure 14).

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).

Numbers

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).

Making Points

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

16. Wire these to the Line.ByStartPointEndPoint node to create a line (see Figure 19).

F IGURE 19

To Watch or not to Watch…

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).

Draw a Wall

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).

17. in the Revit branch of the library under the: Elements > Wall branch, click the

Wall.ByCurveAndLevels node.

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.

22. Browse to: Revit > Elements > Element and click the Geometry node to add it to the

canvas.

23. Wire the output of the Wall node into this node (see Figure 23).

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).

Hello Wall

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.

24. Browse to: Revit > Elements > Element and click the SetParameterByName node to add it

to the canvas.

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.

25. On the Input library branch, expand Basic and then add two String nodes.

26. Position them to the left of the SetParameterByName node.

27. In the first String node, type: Comments and then click outside the node (do not press

ENTER ). Wire it to the parameterName input.

28. For the other String node, type in: Hello World (or any other message you like) and then

wire it to the value input.

29. Wire the output from the Wall.ByCurveAndLevels node (not the Element.Geometry node)

to the element input on the SetParameterByName node (see Figure 24).

F IGURE 24

30. In Revit, select the wall and look at its Comments on the Properties palette.

SAMPLE F ILE : You can open a file completed to this point named: 01_Hello Wall_G.dyn.

Finishing Touches

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.