CHAPTER 21
Computational Design with Dynamo

For a typical Revit user, the term computational design can evoke visions of obscure tools used for advanced form-making. This preconceived notion has proven difficult to curtail, even as parametric modeling and design computation become more commonplace. New tools providing parametric design environments enable users to not only create unique geometry but also develop automated processes and sophisticated data manipulation techniques.

The application of computer programming in design and construction has given rise to architects and engineers extending the capabilities of “out-of-the-box” Revit software by developing custom tools with the Revit application programming interface (API). The results provide more flexibility and expediency to the design process. Learning to code can be a difficult task, necessitating the rise in use of visual programming as a vehicle for computational design. With this process, users can create algorithms and manipulate data graphically, rather than textually.

Visual programming is diagrammatic and easier to understand than code, with nodes representing entities and wires mapping out how nodes relate to each other. This is known as a data flow, and in most visual programming languages the flow of data occurs from left to right.

In this chapter, you’ll learn to:

  • Get started with Autodesk Dynamo®
  • Understand the Dynamo UI
  • Connect nodes to make data flow
  • Use additional Dynamo tools

Getting Started with Dynamo

Dynamo is a visual programming interface plugin for Revit. It is also available as a stand-alone application known as Dynamo Studio. With Dynamo for Revit, users can create custom design and automation methods with node-based diagrams that instantly affect both project and family files. Geometry and data generated with Dynamo become flexible; minor tweaks to a Dynamo definition file can deliver major results. Figure 21.1 shows an example of this.

Screenshot shows a data flow from left to right that includes nodes such as number 12, number 5, add x, and y, multiply x, and y, and watch 204 along with wires between them.

Figure 21.1 Using nodes and wires to create the equation [(5+12)×12]

Downloading Dynamo

Dynamo is an open source application. You can download the official released version of Dynamo from http://www.dynamobim.com. On the home page, browse to the dedicated download page and choose the latest version. Figure 21.2 shows the Dynamo BIM homepage.

Image described by surrounding text.

Figure 21.2 The Dynamo BIM homepage

Installation

Once Dynamo is downloaded, run the executable file to complete the installation if you’re planning to use the stand-alone version (Figure 21.3). Make sure Revit and any other applications are closed. During the installation you can customize the installed components, including what versions of Revit you want to add Dynamo to (if you want to install this for earlier versions of Revit). (In Revit 2017, Dynamo is installed automatically with Revit.) Make sure Dynamo Training Files is selected, as these are an invaluable learning resource.

Image described by surrounding text and caption.

Figure 21.3 Dynamo installation. Make sure to install all available options.

Opening Dynamo

Once Dynamo is installed, open Revit to use the application. Dynamo will be available in the Manage tab of the ribbon. You might notice that Dynamo is grayed out initially. To open Dynamo, you must have a Revit project file or family file (typically a Conceptual Mass) open to connect to Dynamo. Dynamo will run only in the file in which it was opened. If you have multiple files open within Revit, make sure that the file you want to connect to Dynamo is the active window before clicking the Dynamo button.

images

Click the Dynamo button to start the application. It will open in a new window (Figure 21.4). To create a new Dynamo file, with the extension *.dyn, click the New icon on the Start Page. A Dynamo file is referred to as a definition and can be thought of as a dynamic diagram that performs a function or process.

Image described by surrounding text and caption.

Figure 21.4 Dynamo Start Page

Understanding the Dynamo UI

Although connected to a Revit file, Dynamo has its own user interface and window separate from the Revit window. Dynamo’s user interface is divided into four areas, as shown in Figure 21.5.

  1. Toolbar
  2. Node Library
  3. Workspace
  4. Execution Bar
Image described by surrounding text.

Figure 21.5 The Dynamo UI

Toolbar Like most Windows-style software, the toolbar contains the basic application functionality for managing files, selections, and settings. It includes drop-down menus as well as icons for quick access. Hovering over an icon will display its functionality and hotkey in a contextual box.

Node Library The Node Library is a categorized repository for all available nodes. Nodes are objects within Dynamo that connect to form a routine or program and are connected with elements called wires. Wires are what visually demonstrate the flow of data between nodes. We’ll go into the parts of a node a bit later in this chapter.

The nodes are organized hierarchically within nested libraries based on how nodes relate to one another. You can browse the Node Library by clicking the menus and submenus until you reveal a set of nodes and their descriptions. As an example, point-related nodes can be found in the Geometry menu and then the Point submenu (throughout this chapter we will use the convention Geometry ➢ Point to describe where to locate a specific node). Within the submenu, nodes are further categorized by color: green is Create, red is Action, and blue is Query. Hovering over a particular node will reveal a contextual box with the node description including necessary inputs for the node and what it will output when used properly. The search bar at the top of the Node Library palette can be used in lieu of browsing the library’s hierarchy to search for a specific node by name. Finally, clicking a node will place the node into the Graph View of the workspace.

Workspace The workspace is where you interact with nodes and relationships while developing your Dynamo definition. The workspace is an area where two views are overlaid: the Graph View and a 3D Preview. The Graph View is the display of your Dynamo definition showing the mapping of the nodes and formulas; the 3D Preview is the display beyond the Graph View (in the background) and shows any geometry being created by your Dynamo definition. Both are rendered simultaneously.

As you create a Dynamo definition that includes geometry nodes, you will see a preview of the results, or an instantiation, not only within the workspace but also within the project or family environment. The preview geometry cannot be selected and should be thought of as a by-product of what you are creating in your definition. It is shown as a visual reference only.

It is important to note that your mouse will behave differently depending on whether the Graph View or 3D Preview is activated. Refer to Table 21.1 for mouse controls in each of these view types.

Table 21.1 Dynamo Mouse Controls

MOUSE CONTROL GRAPH VIEW 3D PREVIEW
Left-click Select Node
Middle click Hold to Pan Hold to Pan
Middle scroll Zoom Zoom
Right-click Contextual menu: Node Search Contextual menu: Hold to Orbit

Toggling between the two views to control the extent and orientation of each view is possible by selecting the Toggle Preview icons at the top-right corner of the workspace, as shown in Figure 21.6 (A). Any geometry that is displayed in the 3D Preview is visible only within the workspace. Unless you have created a definition that converts Dynamo geometry into model geometry using particular Revit element nodes, you will be unable to see any geometry visible in the Revit project or family file you have connected to this Dynamo session. We suggest playing with the two different view types and the mouse controls. While it might not sound intuitive when reading the workflow, it functions fairly simply when you are in the Dynamo environment.

Image described by surrounding text and caption.

Figure 21.6 The workspace navigation tools

Also shown in Figure 21.6 are additional navigation tools. Dynamo definitions can become rather large, and at times you will want to zoom in or zoom out to work in greater detail or to see the overall workflow. From top to bottom in area B, these tools will allow you to zoom to fit, zoom in, zoom out, and pan within the view.

Execution Bar The Execution Bar is where you run the Dynamo definition or perform the process that you have laid out in the view. A new definition defaults to Automatic as a run style. This means that the definition is running automatically and updates immediately when it is modified. Automatic execution is appropriate for smaller and leaner Dynamo definitions. However, it can create performance issues when you are modifying larger definitions where small changes can take considerable time to update. If you notice a lag in performance or are working with large definitions, switch to Manual where the definition is processed only when the user chooses.

Connecting Nodes Makes Data Flow

Now that we have looked at the user interface, let’s take an in-depth look at a node’s structure and state and how you can create a visual program when connecting nodes with wires.

Node Structure

Dynamo nodes are the building blocks of a visual program. The flow of data within a node (and ultimately through the entire Dynamo definition) enters through the left and exits out the right side via ports. Nodes can store, analyze, and process both data as well as geometry; they can even report and access information that exists outside of the Dynamo environment. A node is broken down into five key parts, as shown in Figure 21.7.

Screenshot shows node with name Line.ByStartPointEndPoint along with start point A, and end point B on left, line C, node preview D, and lacing option E on right.

Figure 21.7 The anatomy of a Dynamo node

A node consists of the following:

  1. Node name: This is the common name of the node. The system of naming is Category.NodeName. For example, you can define a point in space with Point.ByCoordinates. Throughout the chapter this convention will be used to define nodes.
  2. Input ports: These are receiving locations for data from another node. You can hover over a port to see a contextual pop-up containing the type of data required. Some nodes do not have input ports, meaning that their primary function is either to act as an input for other nodes (for example, the Integer node) or to access and report information from the Revit file you have tethered to the Dynamo file (for example, the Wall Type node).
  3. Output ports: These are transmitting locations to send data from the current node to the input port of another. Whatever the function of the node might be (whether you are creating a point or calculating the volume of a solid mass), you can supply the results further along the Dynamo definition. Some nodes do not have output ports, meaning that their primary function is to either display information from a preceding connected node (Watch) or perform a transaction (Excel.WriteToFile).
  4. Node preview: This tool allows you to preview the resultant data from the node. You can hover over the icon to see a contextual pop-up of the data or click the icon to open and close a preview pane.
  5. Lacing option: This tool illustrates the lacing option applied to the resultant data (more on lacing options later) and is relevant only when your node contains a list of data, which it often does.

Using Nodes

You can place a node into the workspace by browsing through the Node Library categories and clicking one of the node options available. The node will appear in the center of your workspace when selected. A node can be moved by simply selecting and dragging it to a new location.

SEARCH BAR

Once you get a handle on the naming conventions of the Node Library, another method for node selection and workspace placement is to use the search bar available at the top of the Node Library palette. When nothing is selected in the Dynamo environment, the search bar is automatically active; simply typing at any point will begin a dynamic search. As you type, the Node Library will limit the available nodes based on what is being typed. Dynamo will try to predict the node you are searching for and highlight a node as you continue typing. If the highlighted node is the desired node, pressing Enter on your keyboard allows you to place it, as shown in Figure 21.8. Pressing Escape will clear the text in the search bar and restore all available nodes. If you are having trouble with the search bar being automatically active, press Escape prior to typing a search query.

Image described by surrounding text and caption.

Figure 21.8 The Node Library search bar

CONNECTING NODES WITH WIRES

Nodes are linked together using wires, a graphical representation denoting the flow of data within the Dynamo definition. To connect two nodes, left-click the output of one node (the right side of the node), then move the mouse to the inputs of another node (on the left side) until the intended input port highlights, and left-click again to complete the connection. A connected node will look like Figure 21.9. To disconnect, left-click the output port of your node and then again in an empty area in the workspace.

Screenshot shows Cuboid.Height node with cuboid on left and double on right and Line.ByStartPointEndPoint node with start, and end points on left and line on right. Double is connected to the start point.

Figure 21.9 Connecting nodes

NODE STATES

As shown in Figure 21.10, a node can have various visual states depending on how it is connected to other nodes, whether the user is interacting with it, and whether the definition is valid. Here are some examples of node coloration:

  1. Active: The node’s header is dark gray with all inputs connected and (when running automatically) the type of data is correct.
  2. Idle: The node’s header is gray and disconnected from other nodes.
  3. Warning: The node is yellow; it is in an error state because of the type of data being fed to it or the structure of the data it is attempting to interpret.
  4. Selected: The node has a blue stroke around the perimeter. Any connected wires will also highlight as blue.
Image described by surrounding text and caption.

Figure 21.10 Node states and colors

Organizing a Definition

As you develop a Dynamo definition, it can start to look a lot like spaghetti if you are not careful. Organization and legibility are important, regardless of whether you are a beginner or an advanced user. There are many reasons why you would want to stay organized.

  • You are possibly sharing your definition with your colleagues.
  • Your definition is large and/or complex.
  • You are working on your definition intermittently and might not remember your line of thinking between opportunities to work on it.
  • You have realized you have made an error and need to go back through your definition and troubleshoot.

Fortunately, Dynamo includes some tools to help you with organizing your definition.

Notes Notes are editable text fields you can add to your Dynamo definition, allowing you to add descriptions and characterize areas of your definition in plain language. To add a note to the workspace, select Edit in the toolbar and choose Create Note (or use Ctrl+W). You can move the note around with your mouse similar to how you do with a node. Double-clicking the note opens an Edit Text window.

Selection Alignment Making your definition look neat and tidy by manually moving nodes with your mouse can be difficult, if not impossible. To align a set of nodes, drag-select them and right-click. In the context menu, choose Align Selection. There are a variety of alignments available including average and distribution options.

Grouping Grouping is an effective way to organize your definition, allowing you to highlight selections of nodes with color and annotate with text. To group a set of nodes, drag-select them and right-click. In the context menu, select Create Group. A green rectangle will appear around your selected nodes. You can drag the group with your mouse similar to how you move a node and edit the group annotation by double-clicking the group. To change the group color or ungroup the selection, right-click the group and select the appropriate option.

Using Visual Programming

With that background, let’s start programming! Once you have an understanding of the user interface and node structure, it is time to delve into visual programming by creating small snippets of Dynamo definitions. As you read through the exercises, use Dynamo to re-create the images shown in this section. Each aspect covered includes relevant material, advice, and where/how to find depicted nodes. You can also use the automatic search function within Dynamo to quickly find a node if you are familiar with the node name (in other words, the header text at the top of each node).

Before we begin, we have to delve into the two types of nodes we are going to use: input nodes and watch nodes.

Input Nodes Input nodes are how a user can define values or parameters within a definition. There are a variety of different types of inputs.

  • Number and Integer: These nodes allow you to manually input a numeric value.
  • String: A string is another word for a series of characters or text. An example of a string could be “Room Name” or “Fire Rating.”
  • Number Slider and Integer Slider: These nodes are similar to Number and Integer but give you dynamic control of the output with a slider. By clicking the down arrow at the left of the node, you can reveal the default values controlling the slider granularity.
  • File and Directory Path: These nodes allow users to access and utilize files or directories available on the workstation.

Watch Nodes Watch nodes are preview nodes. They serve a similar function to clicking the Node Preview button, but they create a continuous reveal that is useful for troubleshooting and data management. There are two types of watch nodes:

  • Watch: This node creates the standard data list preview.
  • Watch3D: This node creates geometric results, acting like a small workspace view. It might seem redundant at first glance, but if you are creating a definition with multiple geometric solutions, the overlap within the workspace can be illegible and cumbersome. You can hide a geometry’s preview in the workspace by right-clicking the node and selecting Preview.

In Figure 21.11, watch nodes surface solutions from data that has been both created and derived from manual inputs.

Screenshot shows input nodes such as Boolean, string, number, file path, and code block, number slider, integer slider, nodes for multiply two numbers, and repeat something, watch nodes of 12, 735, and a list.

Figure 21.11 Input nodes and watch nodes

With an understanding of the node types, you’re ready to begin creating a Dynamo definition. This definition is going to start with a simple shape. Shapes can be points, curves, and surfaces. Let’s explore each type.

Points Point nodes can be found by browsing Geometry ➢ Point in the Node Library. In Figure 21.12, two points are created using the Point.ByCoordinates(x,y,z)node. The coordinates for the first point are defined by Number nodes, while the second point is defined by an Integer Slider node. Both points require user input for their coordinate values. Note the point in the lower right of Figure 21.12.

Screenshot shows number nodes 0 and 5 and 0 to 12 integer slider node are connected to Point. ByCoordinates node ports x, y, and z respectively.

Figure 21.12 Using input nodes to create a point

To create a point, simply drop in the following nodes:

  • Number (you’ll need two instances of this)
  • Integer Slider
  • Point.byCoordinates node

Once the nodes are placed, connect them, mimicking Figure 21.12. With the Execution Bar set to Automatic, modify the Number node values, and slide the arrow on the Integer Slider. You should see the location of the points update in the 3D Preview beneath the Graph View.

Curves By browsing for Geometry in the Node Library, you can find a number of categories corresponding to types of curves such as Line, Curve, and NURBS Curve. In Figure 21.13, a Line.ByStartPointEndPoint node is used to create a curve with two point nodes as inputs. We can use this to create a curve attached to our point.

  1. Start by detaching the Integer Slider node. You are going to use a similar tool, the Number Slider (shown in Figure 21.14), in the following steps. This slider allows you a higher level of granularity but works effectively the same way as the Integer Slider. After you detach the Integer Slider, connect the NumberSlider following the same layout (Figure 21.14).
  2. Add another Point.ByCoordinates node and connect them as shown in Figure 21.13. Set your first Number node to zero and connect it to the X and Z connections on the first Point .ByCoordinates node and to the Y on the second Point.ByCoordinates node. Set the second Number node to 5 and connect it to the remaining Y and X and Z connections.
  3. Add a Line.ByStartPointEndPoint node. Connect the Point connections from the Point.ByCoordinates nodes to the startPoint and endPoint connections of the new node.
  4. Add a new NumberSlider node and a Curve.PointAtParameter node.
  5. Connect the Line connection from the Line.ByStartPointEndPoint node to the Curve connection in the Curve.PointAtParameter node. Finally, connect the NumberSlider output to the Param connection of the Curve.PointAtParameter node.
Screenshot shows number nodes 5 and 0 connected to Point.ByCoordinates nodes, node to create a line between two points, number slider, and Curve. PointAtParameter nodes to create a point on the curve.

Figure 21.13 Creating a curve by start point and end point

Screenshot shows number nodes 5 and 0 connected to Point. ByCoordinates nodes, Line. ByStartPointEndPoint, Vector. Yaxis, number 10, Curve. Extrude, 0 to 1 number sliders, and Surface.PointAtParameter nodes.

Figure 21.14 Creating a surface by extruding a curve

Now, by changing the values of the Number node or the slider, you can change the location of the point on the line or the line’s start and end points.

Surfaces Now that you have created a point and a curve, you can use what you have to create a surface. There are a number of surface categories to browse under the Geometry heading of the Node Library such as Surface, Sphere, and Polysurface. There are also surface nodes that are “hidden” within other categories. To continue this exercise, you are going to use the Line .ByStartPointEndPoint from the previous example (Figure 21.13). You will create an extruded surface using a Curve.Extrude node, which can be found under Geometry ➢ Curve. Notice how the extrusion of the curve is controlled with the NumberSlider nodes in this example.

  1. This example will get a bit more complex. Start by removing the NumberSlider and Curve.PointAtParameter nodes. You are going to connect a few additional nodes between your original content and the sliders.
  2. Add Vector.YAxis, Number, and Curve.Extrude nodes (shown in the green box in Figure 21.14). With those nodes added, do the following:
    • Connect the output of Line.ByStartPointEndPoint to the Curve input of CurveExtrude.
    • Connect the Vector output of Vector.YAxis to the Direction input of CurveExtrude.
    • Connect the output of the Number node to the Distance input of CurveExtrude.
    • Give the Number node a value of 10.
  3. Add two NumberSlider nodes and a Surface.PointAtParameter node, as shown in the blue area of Figure 21.14. With those nodes added, connect the following:
    • The output of first NumberSlider to the U input of Surface.PointAtParameter
    • The output of the second NumberSlider to the V input of Surface.PointAtParameter
    • The output of the CurveExtrude node to the Surface input of Surface.PointAtParameter

Now, by changing the sliders, you can update the curve and the surface! As we’ve demonstrated in this basic example, once your definition is created, it can be a simple matter to use the definition to manipulate forms. Next, you’ll look at some advanced elements in Dynamo.

Additional Dynamo Tools

Now that you have stepped through some basic examples of using Dynamo to create points, lines, and surfaces, you can learn how those tools can be leveraged for more complex shapes. In this section, you’ll explore some additional tools and see how they can be leveraged to create more robust Dynamo definitions. Because providing exercises to fully explain all the aspects of Dynamo could easily fill an entire book, the following content will simply explain the concepts and refrain from more step-by-step examples.

Code Blocks

Code Blocks are nodes that you can use to define a snippet of DesignScript, a simple programming language developed by Autodesk. DesignScript is a programming language available in many Autodesk tools such as AutoCAD that allows for more robust control of parametric content. You can create a Code Block by searching for it in the Node Library or just double-clicking an empty area in the workspace. The basic structure of DesignScript works by creating a line of code followed by a semicolon, as shown in Figure 21.15. Code Blocks can come in handy in a variety of ways. The following are two commonly used Code Block functions:

  • Creating inputs: A Code Block can be used in lieu of inputs. Simply typing a numeric value followed by a semicolon will create an output. Multiple outputs can be created using the same node.
  • Creating expressions: Adding an expression with variables will reveal inputs. This minimizes the need for additional nodes for mathematical equations that can make a definition bulky and difficult to follow.
Screenshot shows code blocks containing 5 and this is and 7 and a string are connected to node containing a multiplied by b, and x plus y followed by watch nodes to multiply two numbers and combine two strings of characters.

Figure 21.15 Code Blocks for creating inputs and expressions

You can find resources for learning more about Code Blocks and DesignScript at www.dynamobim.com.

Managing Data

Situations will arise using Dynamo where you will create data flows that are collections of items, and in some cases, they are associated with other collections. Any data flow containing multiple items is known as a list (sometimes described as an array). List nodes can be found under Core ➢ List. Understanding the principles of data management in Dynamo is critical for successfully developing useful definitions. Take some time to peruse and experiment with all the various list nodes available. Each of the images accompanying the following topics can be used to practice the concept and replicate the Dynamo definition.

SIMPLE LISTS

A simple list is a line of items, as shown in Figure 21.16. A List.Sequence node has been used to create the list 1, 2, 3…. Let’s examine Figure 21.16 more closely. In the first Watch node, you will notice that each item in the list has an index value in brackets signifying its location in the list. Index values are integers and begin with the value [0]. To select an item from a list, you have to use its index value. In the second half of the definition, items [0] and [3] have been singled out using List.GetItemAtIndex.

Screenshot shows number nodes 1, 12, and 1 are connected to start, amount, and step inputs of sequence node, sequence output is connected to watch node containing list, followed by two List.GetItemAtIndex nodes.

Figure 21.16 Creating a simple list and retrieving items

COMPLEX LISTS

A complex list has more than one dimension, often referred to as a list of lists or a multidimensional array. In Figure 21.17, a complex list is generated from a simple list using List.Chop. The result is a list of five sublists, each containing two values. Using List.GetItemAtIndex will single out an item of the highest order, as shown in the Watch node. It can then be used again to single out a particular value.

Screenshot shows sequence node to create a list of numbers, List. Chop to chop the list into sublists with a length of two values, List.GetItemAtIndex to get the second list, and get the first item in the list and watch node.

Figure 21.17 Creating a complex list and retrieving items

STRUCTURING LISTS

Certain nodes require list inputs. For example, the Curve.ByPoints node has one input port, “curves.” A simple list of points will produce a single curve. To create multiple curves, you must break up the list supplied into sublists. By organizing data correctly, a single node can have a robust output. In Figure 21.18, we use the List.Create and List.Transpose nodes to reorganize point data. Code Block nodes, in the blue field, are used to reduce the size of the definition for clarity. You can also use Code Blocks to create lists. As you can see, 0..6..1; creates a list from 0 to 6 with a step of 1.

Screenshot shows substituting code blocks for number and List.Sequence nodes, using List. Create to combine points into three sub-lists, transposing list, and creating curve through the points using NurbsCurve. ByPoints.

Figure 21.18 Creating and restructuring complex lists

LACING

Lacing is another word for data matching, or the method in which a Dynamo node interprets and associates differently sized inputs. There are three methods available, each one producing different results. To modify the lacing method of a node, right-click the lacing icon on the lower-right corner of the node. In the cascading menu, hover over lacing and make a selection. The following lacing methods are illustrated using points and lines to establish their behavior:

Shortest List The default lacing option for Dynamo is Shortest List, as shown in Figure 21.19. For each list, associate each corresponding list item until there are no more items in one list.

Screenshot shows sequence nodes to create two lists of different sizes, use lists to create points by Point.ByCoordinates, change lacing options by right-clicking on the Line.ByStartPointEndPoint node and watch node.

Figure 21.19 Using the Shortest List algorithm

Longest List Figure 21.20 shows the longest list lacing option. For each list, associate each corresponding list item, duplicating the last item in the shorter list until there are no more items in either list.

Screenshot shows sequence nodes to create two lists of different sizes, use lists to create points by Point.ByCoordinates, change lacing options by right-clicking on the Line.ByStartPointEndPoint node and watch node.

Figure 21.20 Using the Longest List algorithm

Cross Product As shown in Figure 21.21, the cross product lacing option makes all possible connections. For each list, associate each list item with every other item in the corresponding list.

Screenshot shows sequence nodes to create two lists of different sizes, use lists to crate points, change lacing options by right-clicking on the Line.ByStartPointEndPoint node and watch node containing two lists.

Figure 21.21 Using the Cross Product algorithm

Changing a lacing method (particularly to cross product) on a large definition can generate a massive increase in node solutions, leading to performance issues and the possibility of Dynamo freezing and not responding. It is good practice to save your file first, disconnect any subsequent nodes before switching lacing methods, and then use a Watch node to best ensure the intended outcome.

Geometric Manipulation and Analysis

Beyond the creation of geometry, nodes can also manipulate existing geometry or perform analysis against an existing model. In this section, we’ll explore some of the node types that allow those functions.

VECTORS

A vector is a quantity that has a direction and magnitude. The input of a vector is similar to that of a point (x,y,z), but the node calculates the relative difference between the origin, in this case (0,0,0), and the coordinate input. Vector-related nodes can be found by browsing Geometry ➢ Vector in the Node Library. In Figure 21.22, a Points.ByCoordinates node is used to define the direction of a line using the Line.ByStartPointDirectionLength node. The YAxis node is also a vector and was used in the preceding surface example to define the direction of an extrusion.

Screenshot shows a code block in lieu of three number nodes, and Point.ByCoordinates, Vector.Zaxis, and number 5 that are connected to start point, direction, and length inputs of Line.ByStartPointDirectionLength respectively.

Figure 21.22 Using a vector to signify a curve’s direction

COORDINATE SYSTEMS

Coordinate systems are two-dimensional abstract planes, similar to construction planes in CAD software, and are used to create local coordinates for evaluating existing geometric conditions and creating new ones. Coordinate system nodes can be found by browsing Geometry ➢ Vector or Geometry ➢ Plane in the Node Library. In Figure 21.23, a Surface.CoordinateSystemAtParameter node was used to locate a coordinate system on a surface at (U:0.5, V:0.5).

Screenshot shows a code block in lieu of three number nodes, Point.ByCoordinates, Vector.Zaxis, Number 5, Line.ByStartPoint DirectionLength, Vector.Xaxis, Curve. Extrude and Surface.CoodinateSystemAtParameter nodes.

Figure 21.23 Placing a coordinate system onto a surface

GEOMETRIC TRANSFORMATIONS

A transformation is a general term for methods used to manipulate the orientation, size, and location of a shape. Common transformations are translate (move), scale, rotate, and reflect. Figure 21.24 shows two of these transformations. Vectors and coordinate systems are critical for defining a transformation.

Screenshot shows code block in lieu of two number nodes, Cuboid.ByLengths, Vector.Xaxis, number 5, Geometry.Translate, Point.Origin, Vector.Zaxis, number 27 and Geometry.Rotate nodes along with rotating cuboids.

Figure 21.24 Translating and rotating a cuboid

Revit to Dynamo to Revit

The real utility of Dynamo lies in its connection to Revit, enhancing the design process by combining design computation with a robust building information database. Information from a Revit project or family file can be ported into Dynamo, provided that you opened the Dynamo session when your existing file was open. If you have multiple files open, make sure that the active window belongs to the appropriate file before clicking Dynamo. Revit-related nodes are found in their own menu within the Node Library.

Category, Type, and Element Selections

Controlling the quality of a Revit project file through auditing and en masse model changes are two prospects ripe with manual technical solutions, plug-ins, and workarounds developed over the years. Dynamo’s suite of Revit selection nodes, found by browsing for Revit ➢ Selection and for Revit ➢ Element within the Node Library, can help you develop your own dynamic solutions. There are two general types of nodes that when used together can query and select elements in a Revit file: menu selection nodes and All Elements nodes.

  • Menu selection nodes are more difficult to find because they do not have a standard naming convention, but they all share two common features: no input ports and an embedded drop-down menu. These nodes can give you access to Revit categories and types. There is also the Element Types node, a node where the term element is used broadly to describe nearly anything in Revit, from sun settings to voltage types to phase filters.
  • All Elements nodes select all the elements in a project based on a particular qualification, usually one of the tiers within the Revit hierarchy (Category ➢ Family ➢ Type ➢ Instance).

AUDITING A REVIT PROJECT

Figure 21.25 shows two project file audits being performed. Using the Categories and Element Types nodes connected to All Elements nodes, you can identify all walls that have been placed in the model as well as all wall types that are available to place. An extra node, Element.Parameters, shows the wall type properties as a series of sublists corresponding to the order of the list of wall types.

Screenshot shows Element.Parameters, All elements of Type, Element Types, two watch lists containing list of wall types, Categories All Elements of Category and watch node containing a list of all walls in a project.

Figure 21.25 Auditing wall types and walls placed

PLACING REVIT FAMILIES

In addition to auditing, you can use menu selection and All Elements nodes to help place Revit families. In Figure 21.26, a Dynamo definition creates a series of floors. All elements of category Levels are retrieved from the model. The level elevations are used to define a series of points. These points define planes where a rectangle is placed. A Floor.ByOutlineTypeandLevel node uses a “longest list” lacing option to combine the outlines, floor type, and levels to create a series of floor elements in the project.

Screenshot shows Level.Elevation, all elements of category, categories, Point.ByCoordinates, Vector.Zaxis, Plane.ByOriginNormal, number 20, Rectangle.ByWidthLength, floor types and Floor.ByOutlineTypeAndLevel nodes.

Figure 21.26 Using Dynamo to build a series of floors

MANUAL SELECTIONS

There are a variety of manual selection nodes available in Revit ➢ Selection (or you can type select in the search bar). These are point-click nodes that allow you to select model elements as well as parts of model elements. These nodes tend to be more useful in Conceptual Mass families than project files. Once selected, the element is visible in the workspace 3D Preview. The node is now dynamically linked to the object, recognizing any modifications that might occur in the Revit file and displaying the element ID below the select button, as shown in Figure 21.27.

Image described by surrounding text and caption.

Figure 21.27 Selecting faces of a conceptual mass

Interoperability

There is an entire ecosystem of software being used by architects and engineers during the design process. Each particular platform in that ecosystem has its own file formats and protocols. Moving from one file format to the next can result in both data loss and geometric “impurity.” Interoperability, a term heard often when discussing BIM processes and workflows, is a property of one piece of software that enables it to work with another. More generally, the term has come to mean the ability to send and receive data seamlessly.

Using database formats like spreadsheets is a pragmatic (and democratic) solution to the problem of interoperability. If you can convert design data into a tabular form, Dynamo proves quite useful. Dynamo has the ability to read and write in both Microsoft Excel and CSV formats. The Excel nodes, Excel.ReadFromFile and Excel.WriteToFile, can be found in their own menu named Office. CSV nodes can be located in the BuiltIn and Core menus. Using either format will require File Path inputs.

EXCEL TO REVIT

An Excel spreadsheet can be used to create a set of points. File.Path and File.FromPath are used to convert the browsed path to an input for Excel.ReadFromFile, as shown in Figure 21.28. A String input is used to locate the correct sheet in Excel. Keep in mind, strings are case sensitive. If you are having trouble accessing the data from a spreadsheet, check to make sure your sheet name is correct.

Screenshot shows nodes of File Path, File.FromPath, string, Excel.ReadFromFile, List.Transpose, code block and Point. ByCoordinates containg a list of x and y coordinates of points along with a set of scatterpoints.

Figure 21.28 Importing Excel data to create points

The original data is three columns corresponding to x, y, and z values. As you can see in the output of the Excel.ReadFromFile node, Dynamo understands the data in a way that might seem unconventional at first. The highest-order list defines a row, and the three items in that list define the three columns. Each list could be considered a point, in effect, but Point .ByCoordinates requires three inputs. The List.Transpose node is used to transpose the data, similar to transposing a spreadsheet (swapping columns and rows). Once transposed, there are three lists each with all values x, y, or z. A Code Block is used in lieu of List.GetItems to quickly create three outputs that can be used to create the point geometry.

REVIT TO EXCEL

Data can just as easily be sent to Excel from Revit (via Dynamo). In Figure 21.29, room data is retrieved from a project file and exported to a newly created Excel file. The resultant spreadsheets were added to emphasize the connections in Figure 21.29. Using selection nodes, all elements of category Room are retrieved, and room parameters are obtained using Element .GetParameterValueByName. The room names and areas are then combined into a List.Create node. If the data was placed into Excel.WriteToFile at this point, the result would be 14 columns of data including one row of room names and one row of room areas. By transposing the data before writing to Excel, you can create a more conventional spreadsheet.

Screenshots shows nodes to get the area parameter of the room list, select all elements in the project, get the name parameter of the room list, combine the two lists into two sub-lists, and transpose the data.

Figure 21.29 Exporting room data to Excel

Package Manager

The Dynamo Node Library is extensive and built for a variety of applications across a range of industries, but there is always missing functionality or modifications to existing nodes that might pique a user’s interest. Dynamo is open source and welcomes community involvement. The package manager is a portal for Dynamo users to develop and publish additions to the Node Library to extend Dynamo’s core functionality.

Packages are available to download in the Online Package Search by choosing Search for a Package in the toolbar. The list might take a few moments to load. Packages can include a suite of nodes or be an individual node. You can browse existing packages or search using the search bar at the top of the window. Similar to the Node Library, searching will limit the results related to what you type.

To install a package, select the download icon and voilà! At the bottom of the Online Package Search window, the downloaded package is highlighted in cyan. The location of the new node(s) depends on how the developer has structured the package. In some cases, installing a new package might create an additional menu in your Node Library; in others, it might be blended to fit within the library. Use the search bar if you are unsure where an installed package has been located.

Additional Resources

Sample definitions are included during installation; you can access them in the Dynamo toolbar under Help ➢ Samples. Learning Dynamo can be both rewarding and arduous, but you are not alone! The community of Dynamo users is continuously growing. At DynamoBIM (www.dynamobim.org) you can find additional tutorials, forums, user galleries, and a blog. A simple online search query for help with a Dynamo issue can yield many results, but it is important to realize that Dynamo is (currently) a perpetual beta software that has undergone many changes since 2011. Online search results that are more than a year old can yield obsolete solutions.

The Bottom Line

Get started with Autodesk Dynamo. Dynamo is a visual programming interface that runs parallel with Revit and allows you the ability to code forms and shapes within your Revit environment. Dynamo creates definitions by connecting nodes with wires to convey data.

Master It There are five parts to a node. What are they, and what do they do?

Understand the Dynamo UI. Dynamo has a simple, straightforward UI. Becoming comfortable with the parts of the user interface can allow you more flexibility and lower frustration when learning the application, either as a novice or on your road to an expert.

Master It What are the four primary sections of the user interface?

Connect nodes to make data flow. Connecting nodes is the true power behind Dynamo. The connections visually and programmatically show data flow and the path of information from beginning to end to create the form, run the analysis, or provide whatever is the desired output. Understanding the basics of connecting nodes is the first step to creating your own Dynamo definition.

Master It Describe the workflow to create a series of nodes and connect them properly.

Use additional Dynamo tools. While Dynamo is a robust programming application, there are additional tools you can use to further leverage its capabilities.

Master It Describe some of the tools external to Dynamo and how they can be used to push the capabilities of the application even further.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset