Revit Dynamo - Bridge part 3 - example 30
In this bridge blog series, we will take a closer look at how to build bridges using Dynamo, for every bridge example post created I will add a new layer of complexity.
Bridge part 3 content:
-Superstructure (curved and elevated centerline) – varying cross-section height
– Placement of column
– Placement of foundation
The section from 1-3 is very similar to the bridge 2 sections, the big different is the centerline, but I will not go into detail on this sections.
4. Placement of cross-sections along the curve
In our bridge 3 we have a varying cross-section along the curved centerline, is therefore crucial to have the possibility to place and change the placement of our two different cross-section. For instance Placement of cross-section 1 have the numbers [0.25,0.75], this means that cross-section 1 is placed two places, 25% and 75% from the start of the centerline. Cross-section 2 is placed at 0%(right at the start) 50% (in the middle) and 100%(at the end).
5.Vector – 90 degrees on the curve – Z/XY
At this point, our cross-section is just existing without the desired rotation. For the bridge to be created we need the cross-section to be placed at the curve(at each point created in the previous section) with the correct rotation. Here, we are creating the tool for just that.
First off, rotation around the Z-axis, if the curve has an elevation, our cross-section need a little tilt so the 90-degree angle, between curve and cross-section exist, otherwise the cut will show the wrong geometry. Use Line.ByTangency and then Vector.ByLine to create a tangential vector on the curve in the chosen point(section 4). Vector.AngleWithVector helps us find the angle between the tangenital vector and the Z-vector.
This will be our first rotation.
6.Vector – 90 degrees on the curve – XY
The second rotation is in the XY plane, where I wish to rotate the cross-section so the angle between the curve and cross-section is 90 degrees.
Curve.NormalAtParameter helps us find the vector normal at the points chosen before along the curve. Rotate it 180 degrees with Vector.Rotate, and finally find the angle the cross-section must be rotated to accomplish the desired outcome described above.
Putting it all together.
The cross-section needs to be rotated in two directions, using the node Geometry.Rotate, then placed it at each point along the curve using Geometry.Translate and finishing up with lofting the cross-section into a solid piece with Solid.ByLoft.
The first rotation is 90 degrees around the X-axis, the cross-section has now left the XY-plane and placed itself in the XZ-plane with a 90-degree angle between the points on the curve, since the curve don’t have an elevation(varying Z-value) we don’t need to find an individual vector for each of the points(will look at this later).
For our second rotation, we need to have an individual rotation for each point so the cross-section is placed with a 90-degree angle at the curve in the XY-plane. We use the angle found in the previous section to rotate every cross-section.
Third rotation, To create a slope that follows the curved road, a rotation is needed. The rotation is done around the vector that is tangential on the curve(found in section 5-Vector.B.Line) found at the specific point that the cross-section will be roateted.
The last step before creating a solid is to organize the cross-section in the correct order, otherwise our solid bridge won’t be created.
The bridge only exists in the Dynamo universe, to get it to Revit we use the node /W FamilyInstance.ByGeometry found in the package SpringNodes.