IMAGINiT NEW WP DynamoRevitBasics PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

WHITEPAPER

Dynamo for Revit Basics – Part 1 of 4:


Making life easier for the Dynamo beginner

Dynamo has been promoted as an add-on that allows users without any
programming background, to create a visual programming task with ease within Table of Contents
Autodesk Revit. The reality of the situation is, even though the tasks are easier,
it is still fairly difficult to learn if you don’t know the lingo. This document will ■■ Sample Script: Global Font
Alteration
outline how you can get started with Dynamo for Revit. We will also touch base
on the creation of a simple Revit Command to get you started. Alright then. ■■ About the Author: Dennis Dixon
Let’s dive in!

First thing to know about Dynamo in Revit is when to open or use a Dynamo
Script. Dynamo cannot be used simultaneously within a Project, Conceptual Mass, Family or Template. When you create a
Visual Script within Dynamo, make sure that it is created and used within the correct environment. If Dynamo is intended to be
used for Revit, make sure that you open up Dynamo from the Revit Add-ins tab. The stand-alone Dynamo for Windows does not
have access to the Revit API.

Dynamo, quite simply put, uses boxes and lines to create commands. These boxes, otherwise known as “Nodes,” talk to each
other through a series of “Wires.” Just like the typical written language, Visual scripts are put together from Left to Right
(Left being the Input and Right being the Output). So the question of the day is: “What do we do with all of these strange boxes
and lines?”. Well the answer to that is “Get your hands dirty!”.

When starting out, the most difficult aspect is sorting out which nodes do what. Let’s break down the “Must know” nodes:

String – Is more or less a text box. Used to specify element information by name in Revit.

Code Block – Create custom lines of information that can be used to drive another node.

[email protected] 800.356.9050 www.imaginit.com


Dynamo for Revit Basics – Part 1 of 4: Making life easier for the Dynamo beginner 2

Number – Adds an instance number value to a node.

Number Slider – Adds a sliding number value to a node, according to a specific range.

Watch – Can be used on any node to view the output values of that node.

Select Model Element – Used to pick a specific model element within Revit.

[email protected] 800.356.9050 www.imaginit.com


Dynamo for Revit Basics – Part 1 of 4: Making life easier for the Dynamo beginner 3

Get Family Parameter – Lists all parameters within a specific family.

Set Parameter By Name – Forces the parameter of an element to take on a value determined by the user.

Selection Actions – Various Nodes used in filtering items for use in the Dynamo Script.

All of these commands form the base of many operations for a beginning Dynamo user. As your scripts become more complex,
you will start using more and more specific nodes. Eventually you will get to the point where you will start creating your own
custom nodes!

[email protected] 800.356.9050 www.imaginit.com


Dynamo for Revit Basics – Part 1 of 4: Making life easier for the Dynamo beginner 4

Sample Script: Global Font Alteration


Now that you have a rough idea of which nodes to use, let’s go through the steps of creating a simple Dynamo Script. To do this
we need to understand how these nodes connect together. We will start with creating a command that will change the font of all
dimensions within the project environment.

First thing we need to do is identify what needs to be altered. In this case we want to change the “Text Font” parameter of
dimensions within a project. So let’s start by adding the node “Element Types.”

Once clicked, go to the provided drop-down menu and choose DimensionType. Considering “Text Font” is a type parameter, this will
ensure that Dynamo makes changes to data within the type parameters of Dimensions.

Now we need to tell Dynamo that we want to select all Dimension types in the project. Add the node “All Elements of Type” and
connect the two nodes with a wire (as shown below) by clicking the light grey button of ‘Types’ and clicking the finished wire into
‘element type.’ This will now apply any command to all dimensions within the project.

Next thing we have to do is prepare the output Node. The node that we are using for the output is going to be
“SetParameterByName.” This node allows us to specify the exact font that we wish to use in our project. Once inserted,
connect the ‘elements’ button to the ‘element’ button of SetParameterByName.

[email protected] 800.356.9050 www.imaginit.com


Dynamo for Revit Basics – Part 1 of 4: Making life easier for the Dynamo beginner 5

The two other buttons we need to create values for are ‘parameterName’ and ‘value.’ parameterName requires us to provide
the exact name of the parameter we wish to alter. In this case, go to the Annotate tab within Revit, click the drop down below
Dimensions and click on Linear Dimension Types. Scroll down to the area where you change the font and take a look at how the
Parameter is spelled (below). “Text Font” is the parameter that we will use and it must be spelled exactly as shown or Dynamo will
not recognize the correlation.

Using that parameter text, add a ‘Code Block’ Node in Dynamo, type in “Text Font”; and connect the node to parameterName
(Below). Click beside the semi-colon and hit enter on your keyboard to start another line of code. At the bottom left of Dynamo
make sure the drop down menu is set to Manual. Type in the value “Times New Roman”; and connect that wire to the value button
of SetParameterByName. Click ‘Run’ to activate the Dynamo Command. You should see the font of all dimensions change.

With this Script, we can choose various types in the “Element Types” drop down menu and alter their font. This would be useful for
Text Notes, Model Text, Level Heads (Within Family), Grid Heads (Within Family), etc. See next page for finished example.

If you wish to take this a step further, you could add more font parameters such as Bold, Italics, Underline and Text Background.

The Bold, Italics and Underline parameters can all be placed into separate Code Blocks and will use a True/False Boolean to
control the checkbox for each Type Parameter.

The “Text Background” Parameter is a little bit different. Since the Text Background parameter uses a drop down menu, it
requires the user to tell it which value it is from 0 to however many are available in the drop down menu. In this case, the value ‘0’
is Opaque and ‘1’ is Transparent. Tada! Where is the easy button right?

[email protected] 800.356.9050 www.imaginit.com


Dynamo for Revit Basics – Part 1 of 4: Making life easier for the Dynamo beginner 6

This concludes the first part of our four part series that will help you on your way to the Dynamo world. Stay tuned for
more additions!

About the Author: Dennis Dixon, Applications Expert


Using his many years in residential architecture and construction, Dennis helps clients make the most of their design technology.
Whether it’s implementing BIM, updating their CAD skills or evaluating new technology, Dennis looks at the projects and
processes clients are using to ensure they can take competitive advantage of their systems.

About IMAGINiT Technologies


IMAGINiT Technologies, a Rand Worldwide Company, is the world’s largest provider of enterprise solutions
to the engineering community, including the building, manufacturing, civil and mapping industries. With
over 25 years of experience, and 45 offices throughout North America, we provide the expertise, training
and support to help companies realize the full power of design technology, maximize ROI and gain
competitive advantage.

IMAGINiT is a leading provider of Autodesk software solutions and the largest North American Autodesk
Authorized Training Center (ATC) partner. All of our locations are supported by a vast pool of engineering
resources focused on developing real-life business solutions for their local clients.

[email protected] 800.356.9050 www.imaginit.com

You might also like