In this blog post I would like to demonstrate how to automate reinforcement designs with the Dynamo graphical programming interface using the example of standard rebar designs for window and door openings.
Revit 2019.1 comes with Dynamo 1.3.3 preinstalled, however the workflows covered in this blog post are compatible with Dynamo 2.0. When you try to run scripts presented in this post you should make sure you are using Dynamo 2.0, which you can download and install from dynamobim.org/download.
Dynamo 2.0 can be installed side-by-side with an existing 1.x version allowing you to have control over which major version you use for your project. In Dynamo for Revit, you will be prompted to choose which version you wish to run on first launch of Dynamo. This setting is cached per-session of Revit. A restart of Revit will enable you to change to a different version of Dynamo.
Building my Dynamo script I will be using Revit 2019.1 and the Structural Design 1.0.2 Dynamo package.
Structural Design package
The Structural Design Dynamo package supports various structural workflows in Dynamo and Revit (metric units only [mm]). The 1.0.2 version of the package mostly supports the reinforcement detailing workflows, however, moving forward the scope of the package will be extended.
Before getting started please make sure and verify the package is installed on your machine.
You can use the Search for a Package option if the package is not installed on your computer yet.
If the package is installed properly you should see it under the Add-ons.
First, let’s define some input parameters.
Note: To define Straight Rebar Diameter and Diagonal Rebar Diameter and Stirrup Rebar Diameter input nodes you should use the RebarBarType node from the Structural Design package. It can be found under Structural Design->Rebar->Properties.
Double click the node title bar to rename it accordingly.
This is how the input parameters should look in Dynamo Player:
Get Window/Door Opening Characteristics
You may ask “What about the selection process? Where is any Select button to get a model geometry?”
In this case I will create a different approach. Instead of clicking the Select button, I will set up input parameters and click the Run script button to execute the script, and then I will be asked to make a selection. Once the selection is made the script proceeds its execution.
Let’s get started:
1) I will use the PickObjectsOfCategory node to define the selection functionality of my script. The node can be found under Structural Design->Model->Selection.
This node prompts the user to select multiple objects of the defined categories while showing a custom status prompt string.
- category: Single category or a list of categories.
- objectType (int): Specifies the type of object to be selected 0-Nothing, 1-Element, 2-PointOnElement, 3-Edge, 4-Face, 5-LinkedElement, 6-Subelement. Default value: 1
- statusPrompt (string): The message shown on the status bar. Default value: “Click to select multiple elements, TAB for alternates, ESC quit”
- preselection (bool): Takes into account the initially selected set of objects. Default value: false
- refresh (bool): Refresh selection. Default value: true
In this case the user will be able to pick only elements of the Window and the Door categories.
2) Next, I need to retrieve window and door opening characteristics using a dedicated node from the Structural Design package.
The Geometry.GetWindowDoorOpeningCharacteristics node can be found under Structural Design->Model->Geometry.
Thanks to this node I can get:
- Curves from which an opening is created.
- Opening plane.
- Opening host.
- Opening host width.
- Vector normal to opening plane.
- Opening category.
- Opening width.
- Opening height.
- Opening corner points.
3) Let’s get the rebar cover dimensions for the host of the selected opening element.
Now, based on the selected opening characteristics, I can create straight rebars around the opening.
1) First, I need to generate Dynamo curves which will be used during the creation of straight rebars. There is a dedicated node in the Structural Design package to do this.
As the above node needs two input parameters which are rebar diameters, I need to get a rebar diameter from Rebar Bar Type first.
2) Now I can connect all inputs with the right data.
3) Next, I can create Revit rebars using the FromCurve node (Structural Design->Rebar->Create).
Note: The respective vectors are taken from the Vector output of the Designs.OpeningStraightRebarCurves node. Vector is the normal to the plane that the rebar curve lies on.
4) Next, let’s set the Layout Rule property of newly created rebars to Fixed Number. The default number of bar positions in rebar set is 2, so no need to make a connect in this case as this is the number of rebars we want to set up.
Note: The respective distribution length of rebar sets (arrayLenght) is taken from the Spacing output of the OpeningStraightRebarCurves node.
5) There is one more thing I am going to include in the logic of creation of straight rebars. When the Top Stirrup is Closed input parameter is True, and the Two Layers parameter is True too, then I would like to have the top straight rebars copied to create reinforcement of a lintel. To do this, let’s filter out top bars first.
6) Next, if the conditions are met then we copy filtered rebars.
7) Of course, we need to determine a vector that is used when we copy elements.
Note: In this case we don’t perform an operation on a Dynamo geometry when we copy elements, but instead when we copy Revit objects. The Geometry.CopyElement node copies an element and places the copy at a location indicated by a given transformation (Structural Design->Model->Geometry).
The version 1.2.2 of the package is optimized for Dynamo Revit 2.1 and Revit 2020.1. Take a look at the “extra” folder for some examples that can be used with the Dynamo Player. Contact with the author if any questions: @tomekf
The final script covered in this post can be found in the extra folder.
In my next post I will continue to develop this script and I will:
- add Diagonal Rebars
- add Boundary Stirrups
- and set up Rebar Visibility
Continue reading: Learn the Power of Dynamo for Automated Reinforcement Detailing – Part 2