Video Script - Autodesk Design Academy

advertisement
The Anatomy of a Definition – June 12, 2015
In this lesson we will take a closer look at the program elements used to define, interface, and connect a
Dynamo definition to a Revit document. Before working in Dynamo we will have to make several
decisions about whether the definition is for a project or family document. For instance, if you are
looking to automate the placement of Revit families or manipulate project parameters, you will want to
launch a new project document. If you are intending to create a new conceptual mass, the family
environment is better suited. We are going to be placing reference points which can only be done in the
mass environment. Therefore, we will create a new Revit conceptual mass to get started. Open the
default mass template.
After loading the family document I am going to browse to the add-ins tab and launch Dynamo. Let’s
maximize the window for now as well.
Use the search toolbar on the left hand side of the workspace to locate the “number” node. The
“number” node allows you to define either a double (float) or integer value by clicking in the text field.
You can give the number a new name by double clicking and selecting rename node. This allows you to
more clearly indicate what the node is to be used for. Let’s go ahead and rename this node origin.
Again, I will use the search bar and locate the “point-by-coordinate” node. Type in XYZ and select the
first result. Alternatively, you can browse through the library from “Geometry – Point” and select the
appropriate node. You will notice there are 2 “by-coordinate” nodes. You can hover over each to
compare the difference. We are looking for the 3rd option based on the input comparison of the node
we found using the search feature.
Nodes are the building blocks of dynamo definitions and represent a variety of automation routines such
as creating Revit elements or performing math operations. Nodes have inputs and outputs referred to
as ports. Inputs are on the left side of the node. Output ports are on the right side of the node. Data
flows through the ports from left to right.
Ports require specific data types. In the case of the “point” node, the X,Y,Z ports require a double which
we can verify by hovering over the inputs. Passing data other than this type will result in an error. To
connect the number node left click on the node output, move over to the x coordinate input node and
left click once more. You do not need to click and drag. Let’s repeat this process to define Y and Z.
Wires appear as dashed while being dragged and solid once successfully connected. To disconnect a
wire left click on the output node, move your mouse to the free workspace, and click once more to
release the wire.
With this action we have created a relationship between the “number” and “point” node. Data is able
to flow downstream from one node to the next. To view the output of the XYZ node I will use a “watch“
node. Again, I will type into the search field in the library.
The “watch” node is a unique dynamo object that allows you to inspect the current status of a node by
viewing the output port data. The “watch” node belongs to a unique Dynamo set of elements located in
the “core” library which again, can be located on the left.
Let’s connect the output point to the input “watch” node. Make sure the script is set to run on the
bottom left corner to begin flowing data. By changing the value in the “number” node we can see the x
and y values of our “point-by-coordinate” node have changed.
By selecting the “number” node and going to edit/copy/paste we can duplicate the selected node as
well as the existing values. This can also be accomplished with ctrl+c and ctrl+v. Connect the new
“number” node to the Z input. We can then change the value and verify it has updated in our “watch”
node.
To have a more dynamic user experience as our definition develops, in the search field let’s go ahead
and type “slider”. This will reveal 2 nodes, a “number” slider and an “integer” slider. Click both options
to bring them into the workspace. The slider is a unique user object. It allows you to interact with
numbers within a defined range. Using the dropdown at the bottom left corner of the node we can see
this range is defined by a minimum and maximum value. We will change this maximum value to 20. The
min and max values can be collapsed to hide them.
Notice the “number” slider sometimes referred to as the “double” slider will return a floating value
where the “integer” slider will only return whole numbers. Let’s use the “number” slider to define our Z
coordinate and delete the “integer” slider by selecting it and hitting the delete key. Connect the
“number” slider to the Z input on the “point-by-coordinate” node to replace the existing connection.
As we begin to make changes to the slider notice how the “watch” node dynamically updates.
Let’s turn on the background 3d preview by going to the view tab selecting background 3d preview and
clicking show background preview.
To navigate the background 3d preview use the geometry icon in the lower right hand corner. To return
to the definition use the graph viewing icon in the bottom right.
As I make changes to the Z coordinate you will see that change updated dynamically in the “watch” and
background 3d preview.
Alternatively, we can turn our background 3d preview off and search for the “watch 3d” node in the
library. Add the node to the canvas and connect the points by coordinate output node to the “watch
3d” input.
Similar to the background 3d preview you can navigate the “watch 3d” by clicking inside the window. It
can also be resized by dragging the tab in the bottom right corner of the node. Sometimes it may be
helpful to move the “watch 3d” node under the slider to visually track actions.
It is important to note that we are seeing in the “watch 3d” node exists natively within Dynamo and not
within Revit.
If we restore the Dynamo window we can position the Revit and Dynamo windows side by side to better
help us visualize the workflow.
Points in Dynamo represent a zero dimensional intersection in space at the specified coordinate
meaning that the XYZ node is an abstract coordinate not actual geometry.
To create the actual Revit geometry lets search for “point” in the library. As we scroll through the
results we notice there are a number of point related nodes. Here, under Revit, we find a subcategory
for elements. With elements we can create a reference point in Revit by either coordinates or by points.
Choose the “reference-point-by-point” node. Now, let’s connect our “point-by-coordinate” output to
our “reference-point-by-point” input.
In doing so we see the “reference-point-by-point” node will create a fully featured Revit element. It is
important to note that this reference point can be used just as any other reference point created in
Revit.
Let’s draw a spline curve by selecting the “spline-through-points” tool in the Revit draw sub-tab. By
clicking in the viewport I will define a few points followed by a point in Dynamo. Notice as I move my
mouse pointer near this point Revit will automatically snap. I will continue to define a few more points
then hit the escape key to exit the spline command.
As we make changes to the point in Dynamo you will see the spline in Revit is now updating dynamically.
Coupling the parametric capabilities of Revit alongside the visual programming environment in Dynamo
creates a unique feature set for working with computational design within a Building Information
Modeling environment.
Download