June 27, 2019

# Enhanced Dynamo Script for Reinforcement by Selected Edges

Our Precast Concrete solution is great for automating modelling, numbering, and shop-drawing creation in Revit, but efficiently modelling reinforcement in a 3D model can still be a challenge. Following our post about using a Dynamo script to create rebar by selected edges, here we show how to make a layout based on certain rules and apply it automatically to elements of different length. This can be done in the same Dynamo script.

You’ll recall that we created a rebar layout via a simple Code Block with a defined bar number and step. Let’s add another node to select one more Edge, and read its length with the Curve.Length node like this: Now we can add simple rules to divide that length and create a list of the positions where we want reinforcement. Here, we will divide the length into three parts and distribute bars with a predefined step. The first group of nodes calculates how many rebars will be needed given the predefined start offset and step in the first part of the divided length. The example above shows the multiple nodes used to divide, subtract, and sum up, and the last one to round down. In fact, though, you can put all of this into one Code Block node, like this: If you type text into the Code Block, Dynamo will recognize it as an input parameter, and then you can plug other nodes into it and manipulate the information you get from them. An example would be DivLength, StartOff, stepSupport in the picture above. Also, if you type something Dynamo recognizes as a function, you can also type it in the Code Block instead of using a separate node, as with Math.Floor above.

Let’s move on and create the sequence of positions where our rebar should be created: Repeating the same procedure, we calculate the number of steps and the length of the layout for the middle part of the beam. Continuing, we then create a sequence starting with the last item in the sequence list at the support and adding other lists to form a list of all positions. Instead of using just Code Block with a defined number of rebars, we plug this List node into the Geometry.Translate node (used in the previous blog post). We also take the vector direction from this Selected Edge and scale the vector with a negative (or positive) value, in order to be able to control the layout direction of the rebar. We don’t need to change the rest of what was created in the previous script (see previous post) in order to create reinforcement. You should get result like this for the automated layout of reinforcement: You’ll probably want to improve the calculation of the middle part’s layout a bit, but I hope you find this post helpful as a starting point.

Using Dynamo scripts together with the Precast Concrete solution for Revit can help you work more efficiently, eliminate many repetitive tasks and let you focus more on making decisions!

Watch our full-length webinar (hosted May 9, 2019) about using Dynamo scripts in conjuction with Precast Concrete to automate rebar placement in Revit!

##### Related blog posts: 