Revit dynamo - model rebars, U-shape - example 11

**0. Intro**

In this example, we will generate 2 different U-shaped rebars (code 21 and 25) in a curved and sloped wall( the wall is model by the same principles as in example 6,7 and 8.)

The rebars will be placed at top and bottom, as well as the sides, see picture 11 for the finished result.

**1. Input-1**

Select edge is the rebar path, the rest of the input values are pretty straight forward and need no further explanation.

**2. Spacing**

**Rebar.shorten** is used to shorten the curve at both sides, the distance that shortens represent the rebar cover.

**Curve.PointsAtSegmentLengthFromPoint **is used to divide the curve into equal segments length equivalent to spacing specified in input_1. The number of segment length is counted with **List.Count, **add 2, the number of points is used in a code block as the number of points divided along the curve, the code block is used as a parameter in the node **Curve.PointAtParameter.** We now have the spacing, symbolized as points at the curve.

**3. Vector, 90 degrees on curve**

The next section has been done a couple of times in earlier examples.

We want to create individual vectors that are perpendicular to the line for every point we set along the curve, this allows us to get the correct distance from the center on each of the points.

The first step is to make a plane perpendicular to the line for each of the 100 points, using Curve.PlaneAtParamter. further, turn this into a vector with Plane.Normal, Then extracting the vector from Plane.Normal, we only need direction in XY-plane, then rotate the vector 90 degrees(for the bottom vector, we don’t want any rotation). For some reason, the z-values are not 0, so I have to do one last step. Retrieves vector.X and vector.Y from the previous Vector.Rotate, and uses Vector.ByCoordinates to merge the vectors again, leaving the Z vector blank, The reason why is because we want this value to be 0(only rotation in XY-plane). We now have individual vectors in XY direction for each of the points along the curve.

**4. Points**

Has now created the tools, spacing between points and direction(vectors, both 90 and 0 degrees on the respective points) necessary for the next phase.

Next phase, generate points at the ends of the U-shaped rebars(total of 4 points), using the input values from 1, with the node **Geometry translate**.

Collects the points with **list.create**.

**5. Lines **

**3 Line.ByStartPointEndpoint **is used to create lines between the points that were made in the previous section. It is important that the order of the points is correct so that the lines that are made form a U-shape.

Further, the lines are assembled using a code block, as shown in picture 5. **List.Transpose** reorganizes the list so that list can be read by the node **PolyCurve.ByJoinedCurves, **to form one curve out of the three lines.

The U-shaped rebars have now been produced in dynamo, just the last step, getting them into Revit as rebars.

**6. Input-2**

Arrive at the second input box, this box is related to the rebars value.

degrees input decide how much the U-shaped rebar is going to rotate around its Z-axis. Rebar style is standard, the diameter of the rebar is 16, none **RebarHookType**, select the model the rebars are going to be placed in, **RebarHookOrietation** is left, and the vector is normal at the selected curve.

the four last nodes determine the parameter values for the shape(21) and partition(x103).

7.** Import rebar to Revit**

The main node in this section is **CreateFrom.Curves, **and can be found in the package dynamo for rebar. All the input values are described in the **6.Input-2.**

The parameters mentioned are (shape and partition) set by the node **Element.SetParameterByName** and linked with the main node, this means that all the rebars created from the main node will have the parameters decided in **6.Input-2**.

We also want the rebars created to be solid in view, this is done by using the node **Create.SetSolidInView.**

**8. Conclusion**