## Revit dynamo - model a curved foundation - example 7

0. Intro

In this example, we build on example 6, by modeling a foundation for the retaining wall.

The script and principle is very much the same as in example 6, only a few changes have been made to make the geometry like a foundation.

1. Input

First, we use Pick edge to select the edge from the retaining wall as shown in the video.  In addition, thickness and height values are added.

2.Points on the picked curve

The procedure we use to modulate the foundation 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 use the whole line, the code block inputs will, therefore, be 0..1..a. a is an input value that determines the number of points the line is divided into, in this case 100.

3. Vector, 90 degrees on the curve

We now arrive at 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.ByCoordinates 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 foundation(point 1 in picture 2), the node Line.ByStartPointDirectionLenght with input value: small width foundation as length, the vector found in the previous chapter as direction, and the 100 points created in 2.points on the selected curve as the start point. Curve.EndPoint is point 1 in picture 2.

5.points, top foundation (point 2 in picture 2), use the input value: small width foundation and total width foundation to calculate the distance with formula, the length is the distance from the start point to point 2 in picture 2.

6.points, bot(points 3 and 4 in picture 2), Use the input value: thickness foundation to translate points created in 4 and 5 in the z-direction to create the two bot points.

7. 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.