Revit dynamo - model rebars, straight-shape - example 13
Straight rebars with code 0, will be generated around the edges and penetrations on the concrete slab. Picture 11 show the finished result.
In input_1 we have in total of 5 input values to determine. First, select the surface(select face) on the concrete slab, then count the number of holes(this can be pipe going through the slab) and enter the value to the number of holes. Further, we want rebar cover, the diameter on the straight rebars, and thickness on the concrete slab.
2. Straight rebars around the edges
In this section, we will create rebars around the edges on the concrete slab. Surface.perimeterCurves is used to get the curves on all edges on the selected concrete slab, included curves around the penetrations, this curves we want to exclude, do that by knowing how many penetrations there are and remove them from the list using List.TakeItems, is now left only with the curves for the outer edge of the concrete deck. Join the curves with PolyCurve.ByJoinedCurves, offset the curve inwards(Rebar cover) with a costume node ClosedCurveOffset+and downwards with Geometry.Translate so the curve is centered on the concrete slab. Split the curve into 4 individual curves. Have now created the outer rebars for the concrete slab.
3. Localize circle for hole_1
As the headline says, want to find the location for hole number 1, do this by using List.GetItemAtIndex, and extracting the correct curve from the list. In addition to finding the radius, want the coordinate in the center of the hole, find this by using Circle.CenterPoint.
4. Create 4 lines around hole_1
The center coordinate for the hole found in 3. Localize circle for hole_1 is used to create the 4 lines around the hole as shown in the picture. The node Geometry.Translate translates the point(coordinate for the center of the circle) to get the desired distance from the hole, based on rebar cover and rebar diameter.
The standing now, We have 4 points around the circle, representing the endpoint for our 4 straight lines(rebars), Line.ByStartPointDirectionLength, the line mention is created with the node above, input values are start point, direction, and length for the line.
Collect all the lines with a code block and, rearrange the list with List.Transpose.
5. Rotate lines, aligned with sides
The 4 lines created in the previous section will here be rotated so they are aligned with the outer lines(rebars) created in 2.Straight rebars around the edges.
Extract one of the outer curves from the list, get the curve start- and endpoint (Curve.StartPoint and Curve.EndPoint) Create a line (Line.ByStartPointEndPoint). We now measure the angle between the two lines(line 1 is the outer line and line 2 is one of the lines created around the hole). We do this by first finding the vector for the lines with Vector.ByLine and then the angle between the vectors with Vector.AngleWithVector. Use the angle to rotate all of the 4 lines.
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(0) and partition(1503).
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.