Video Script - Autodesk Design Academy

advertisement

Computational Logic Part 2 – June 15, 2015

In this lesson we will take a look at how to instantiate a Revit family element, as well as how to control a family type and instance parameters in Dynamo for Revit and Dynamo Studio. Since we will be automating the placement of Revit families and setting parameters I am going to create a new project file.

From the Revit menu in the top left corner of the viewport select “open”. Browse to the datasets folder for this lesson and select the Revit family titled “8.3.2 computational logic column”. This Revit family contains a single column. Open the “family types” interface located in the modify properties tab or by typing FT.

Notice that this family contains 3 types. Each type has a unique height and depth. Load the column into the project document by selecting “load into project” in the “modify family” editor tab. With the family now loaded into our project document we can select “edit type” from the properties window. Select the family then “edit type” and make changes to the type and dimensions of the column. I am going to close the edit type window and return to the properties palette. Note that there is an additional instance parameter to find the height of the column. Changing the value of an instance property affects only the elements in your selection set or the element you are about to place. Let’s place the three column types into the project document. Notice that each instance has a predefined width and depth.

We will use Dynamo to automate the placement of these family types based on the proximity to a point.

Columns closer to the point will have a larger width and depth dimension. Columns farther will be narrower. I will now select the columns that I had placed into the project document and delete them by pressing the delete key. Let’s now launch Dynamo from the add-ins tab in Revit.

In Dynamo let’s search for the “family-types” node. The “family-types” node will look into the current

Revit document and select all family-types available. Using the drop down browse to the “8.3.2 computational logic column type 1” family-type. Now add 2 more “family-type” nodes to the workspace and select types 2 and 3.

We will now create a list of family-types by adding a “list-create” node to the workspace. Click the plus icon to add 2 more input ports and connect family types 1, 2, and 3 to the “list-create”. We will now add a “get-item-at-index” and “integer” slider to the workspace. This will allow us to select one of the family-types from the list we just created. Note that the max value of the integer slider should correspond to the max value index in our “list-create”. Connect the output of the “integer” slider to the input port index on the “list-get-item-at-index” node. Using the rectangle at the bottom right corner of the “list-get-item-at-index” node we will expand its output. Making changes to the integer slider will now dynamically result in an alternative family type being currently selected.

To automate the placement of this family type I will search for a “family-instance-by-point” node. This node is located in the Revit – family instance – create category. Take the output of the “get-item-atindex” node and connect it to the family symbol input port of “family-instance-by-point”. The second

input port requires a point. Add a “point-by-coordinate” node to the workspace to define the origin of the family instance. I will use a “number” node to define both the X and Y coordinates.

Let’s see the results of this operation in Revit. Making changes to the “integer” slider results in a different family instance being placed. I will now make a modification to define a sequence of values.

Right clicking on my “point-by-coordinates” I will change the lacing to “cross product”. Once again, I will make changes to my “integer” slide to see the results automated in Revit.

In order to pick and choose which of the family types are placed though I will need to create a point that will work as an attractor or a structural loading point to determine the distance and then place the type based on proximity. To do this we will start by adding another “point-by-coordinate” node to the workspace. Use a “number” node to define the inputs for X and Y. The second “point-by-coordinate” node will be my attractor. In order to determine the proximity of each of the points coming from our grid I will search for a “geometry-distance-to” node and connect the output of my grid to the geometry input of my “geometry-distance-to” node. I will then take the output of my load point into the entity input. To view the distance I will click the rectangle in the bottom right corner of my “geometrydistance-to” node. We have now computed the distance from each center point to the attractor but to use these values to get an item from a list we will need to remap the values.

Returning to the search field in the node library I will type remap and add the “remap-range” node to the workspace. The “remap-range” node will take a current value and remap it within a target domain.

(In this case between 0 and the count value of our list) This corresponds to the values we see HERE in our “integer” slider. I would like to remap the distance to a domain between 0 and a new max. We will use a “number” node to specify a new min. The new max however, must be computed from our “listcreate” node.

I will search the library by scrolling down to the category related to “actions”. Within this category we will see there is a node called “count”, which gets the number of items stored in a given list. We will connect the output of our “list-create” to the input of “list-count”. Notice that the output is 1 greater than the maximum value specified in our integer slider. In order for us to remap the distance to a selection range we will need to subtract a small amount from this value and select the node “floor” to round down to the closest integer.

I will start by going back to my node library and from “operators” select “minus”. From the “list-count” I will subtract 0.001. Subtracting a small amount from “list-count” will allow me to then round down to the closest integer. To view the output of the “remap-range” I will click on the rectangle at the bottom right corner of the node. You can see that these values are now between 0 and 2.999. We can now use the “floor” node to return the first integer smaller than the current value. Taking a look at the output of this and comparing it to the list on the left we will see that now 2.999 returns an integer of 2. The output of the “floor” node will now replace the index input of the “get-item-at-index”.

Now, let’s verify that this definition is correctly automating this task in Revit. Make changes to the load

point and Dynamo will automate the placement of the family type. To make columns larger in diameter correspond to the closest distance we will subtract the output of the “remap-range” from the initial

“subtraction” node. Lastly we will add an “element-set-parameter-by-name” to the workspace. This node will take a specified parameter name and allow you to quickly redefine the associated value for each family instance. Connect the output of the “family-instance-by-point” node to the element input of the “set-parameter-by-name”. To define the parameter name we will add a “string” node. Selecting a column in Revit will allow us to see that the property or parameter we would like to interface with is titled “height”. Connect this output to the input port parameter name. Using a “number” node I will define a new height. As you can see, this definition efficiently automates the selection, placement, and parameter manipulation of a collection of Revit family elements.

Download