Revit dynamo - Create a retaining Wall - example 6
In this example we are taking the rough geometry we got from the SAT file in the last example to create a retaining wall, with a crossection shown in picture 2. Normally this is an easy task for model in place sweep, but the wall has varying xyz-coordintes, which makes the task more difficult since the geometry won’t behave as intended, dynamo is the solution!
First, we use Pick edge to select the edge from the geometry from the SAT file as shown in the video. In addition, thickness, height, and slope values are added.
2.Points on the picked curve
The procedure we use to modulate the wall is by decomposing the selected line to 100 points with xyz coordinates, this is done with Curve.pointAtParameter. Furthermore, we use a code block to determine the percentage of the line we want to keep and to be divided into 100 points, in this example, we want to remove the last 10% percentages. This is done with a code block with values 0..0.9 .. # a, a stands for the number of points in this case set to 100. We compile the points into a line using NurbsCurve.ByPoints and decompose it again (the last operation may be superfluous).
3. Vector, 90 degrees on the curve
We now arrive to the most important part of the script. We want to create individual vectors that are perpendicular to the line for every 100 points we split along the line, this allows us to get the correct cross-section, length, and thickness.
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 some reason, the z-values are not 0, so have to do one last step. Retrieves vector.X and vector.Y from the previous Vector.Rotate, and uses Vector.ByCoordintes to merge the vectors again, leaving the Z vector blank, because we want this value to be 0. We now have 100 individual vectors in xy direction for each of the points along the line that will be used in the next step.
4-7. Translating points
4.points, top wall(point 2 in picture 2), the node Line.ByStartPointDirectionLenght with input value: a) thickness top wall as length, the vector found in the previous chapter as direction, and the 100 points created in 2.points on the picked curve as a start point. Curve.EndPoint is point 2 in picture 2.
5.points, slope in-wall (point 3 in picture 2), use the input value: b) slope_1 and c)slope_2 to create the slope point.
6.points, bot(point 5 in picture 2), Use the input value: d) wall height to translate the xyz coordinates created earlier in the z-direction.
7. points, bot(point 6 in picture 2), fetching xy coordinates from 5.points, slope in wall and z coordinate from 6.points, bot to create the last bot point in the crossection.
8. Create crossection and solid
Code block is used to collect all the points(each P contains 100 coordinates.) created earlier, further we reorganize the list so that the next node Polycurve.AtPoints can read the data and create 5 curves. The 5 curves create a crossection, which is made solid with the node Solid.ByLoft. The solid is then imported to Revit.
9. Import to Revit
Here we have taken the liberty to use a custom node ꟿ FamilyInstance.ByGeometry, Found in the package spring nodes, created by Dimitar.ven. the node import geometry to Revit.
Check out example 5 how to import geometry from an SAT file here.