Revit 2025 – Using Dynamo Scripting to Obtain Parameter Information

Marketing
Marketing
  • Updated

by Dennis Collin

Dynamo Scripting 1.png

Dynamo scripting in Revit can be used to perform many different tasks. I am often asked can Revit do ‘A, B or C’ and the answer is usually yes, but you may need to utilise a Dynamo script. This often results in some puzzled looks from our customers, but Dynamo follows similar principles to how Revit scheduling works i.e. it queries the model into lists of information that can be both displayed in a schedule or a Dynamo list, which can be viewed in a variety of nodes.

A Dynamo node is just a component that the script uses to perform a simple task. This can be anything from performing calculations, generating or modifying geometry or querying or modifying properties. Nodes can have inputs, outputs or both!

To get started with Dynamo, it can help to create a simple script just to obtain certain information from a selection or a Revit Category which can then be viewed and potentially exported to excel, or have calculations made or written to another parameter. Think numbering of Doors, Rooms or any Revit component. Coordinate Schedules etc. But we are getting ahead of ourselves! Let’s consider a simple script that will allow users to select a category or element and display all or just a selected parameter into a list.

Dynamo Scripting 2.png

Fig 1. Searching for a node in Dynamo’s vast node library.

Starting a new Dynamo workspace, nodes can be chosen by right clicking and typing in a name or via the node library search field on the left. This simple script just uses 7 nodes but will enable users to interrogate the model and provide a base script that can be expanded upon to perform more complex tasks.

Nodes that can be searched for:

  • Select Model Elements – Allows users to window select several Revit Elements of different types and categories.
  • Categories – Allows users to select built-in categories (Walls, Floors, etc.)
  • All Elements of Categories – Select all elements of chosen category
  • String – Creates a string, to obtain parameter names or set values etc.
  • Element.Parameters – A general node that displays all element parameters of that category. Depending on selection some parameters may appear as blank fields (note the dot between word Element and Parameters).
  • Element.GetParameterValueByName – A more specific node that requires a string reference to identify a particular parameter to list.
  • Watch – A Useful diagnostic node, used to check scripts and list information.

(NB. Many other nodes are also available!)

To get the script to work, place the nodes around the workspace and connect the outputs of the selection nodes to the information nodes as shown. Lines known as wires show the connection of script functions and work in a similar way to an electrical circuit!

Dynamo Scripting 3.png

Fig 2. Setting up our first Dynamo script with 7 basic node types. Wires to be added, the yellow node indicates nothing has been selected yet!

For this example, users have a choice of either selecting individual model elements or an entire category. However, the relevant wire connection can be made to suit the selection option, with the second option automatically disconnecting from the other nodes. Fig 3 shows the model elements selection option being ‘enabled’.

On the select model elements node, click the ‘Select button’ and select the required elements in the Revit model. Once complete the element ID’s numbers will display and that node will display without the ‘yellow alert’ flag.

By default, the script will run automatically and provided the correct wire connections have been made with the correct nodes, the watch nodes should display information as per figure 3.

Dynamo Scripting 4.png

Fig 3. The Completed Script, with watch nodes reporting parameter information, of some Revit walls.

The GetParameterValueByName node provides more accurate reporting of numerical data but both nodes can send their data lists on to other nodes, to other parameters or exported to Excel as desired.

When running large and complex scripts, it is recommended to set the script execution to manual, as Dynamo can be a little ‘temperamental’ with large amounts of data processing. I also recommend getting into the habit of saving scripts regularly. Although if readers are a seasoned AutoCAD or Revit user, they will be doing this already! Am I right?

Dynamo Scripting 5.png

Fig 4. Dynamo scripts are just small text files saved with a DYN extension, keep in an easy to find location.

When saving a script, it is a text file with a dyn extension. These should be kept in a location which can be easily found when needed.

Dynamo Scripting 6.png

Fig 5. For complex operations, set the script execution mode to Manual and save the script & model before running!!

Dynamo Scripting is a tremendous tool to perform tedious and repetitive tasks in Revit and other software like FormIt and Civil 3D, which also have Dynamo scripting capabilities.

I will post separately on exporting data to Excel and pushing data to other parameters which is needed for equipment naming, numbering and Coordinate Schedules!

Some example tasks and capabilities of what Dynamo for Revit can do, can be found here.

Civil 3D users can also have fun with Dynamo too!

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.