3D String from
Model Line Group + Toposolid
Select a Revit Model Line Group as your horizontal path and a Toposolid as the vertical terrain reference. AutoBRIDGE samples stations along the model lines, casts vertical rays through the Toposolid solid faces to find ground Z, then builds a true 3D spline family in a single transaction.
What Does This Tool Do?
The Model Line → Toposolid tool (AlignmentMLine) uses a Revit Group containing model lines as the horizontal alignment path and a Toposolid element (Revit 2024+) as the terrain reference. It samples the model line geometry at a station interval, projects each XY station point vertically through the Toposolid's solid face geometry to obtain the ground surface Z, then creates a 3D spline family that faithfully follows both the plan route and the actual terrain elevation.
🌏 Topography (legacy) tool
- Uses
TopographySurface(Revit 2023 and earlier) - Z found via triangle mesh ray-intersection
- Legacy workflow — same form layout
🏔️ Toposolid tool (this guide)
- Uses Toposolid (Revit 2024+)
- Z found via solid face ray-intersection
- More robust — handles complex terrain geometry
Revit-Native Path
Uses Model Lines grouped together in Revit — no Civil 3D required.
Toposolid Z Snap
Vertical ray-cast through Toposolid solid faces finds the precise ground elevation at each station.
Dual Canvas
Plan view shows the route over the topo footprint. Elevation view shows the draped profile with STA/EL tags.
Revit 2024+
Requires Revit 2024 or later for Toposolid support. Use the Topography tool for earlier versions.
Prerequisites
- A Revit Group containing one or more Model Line elements that define the plan alignment path.
- A Toposolid element whose surface covers the plan area of the model lines — used to obtain ground Z values at each station.
How to Prepare the Model Line Group
In Revit, draw the route using Architecture → Model Line or Detail → Model Line tools in a plan view. The lines can be any combination of straight segments, arcs, or splines. Once drawn, select all the model lines that form the alignment, then use Modify → Group → Create Group to group them under a descriptive name (e.g., Bridge_Centreline_Route).
How to Prepare the Toposolid
Toposolid is the terrain surface element in Revit 2024+. If your project was imported from Civil 3D or contains survey data, a Toposolid is likely already present. You can verify by opening a 3D view and checking that a terrain mesh exists. The tool lists all Toposolid elements found in the project by name and ID.
Select the Model Line Group
comboBox1 (left dropdown in the top bar, placeholder text: "Alignment Model Line Group") lists every Revit Group in the project, populated by PopulateLayerComboBox3() which runs a FilteredElementCollector over all Group class elements. Selecting a group immediately redraws both canvases.
Pick the Alignment Group
Select the group that contains your model line alignment. The tool calls GetElementsFromGroup(doc, selectedGroupName) which iterates all groups, matches by name, and collects all member elements via group.GetMemberIds(). The geometry of each member element is then walked to extract all Curve objects.
As soon as a group is selected, the Plan canvas redraws showing the model line route at screen-fitted scale. Station dots appear at the current interval spacing.
Curve geometry can be used. A group containing only Revit families or non-curve elements will result in zero points and a blank canvas. Ensure your group contains actual Model Lines.
Select the Toposolid
comboBox2 (right dropdown in the top bar, placeholder text: "Toposolid") lists all Toposolid elements in the project, labelled as ElementName (ID: xxxxxxx), populated by PopulateTopographyToComboBox2(). Selecting a Toposolid redraws both canvases immediately.
Pick the Terrain Surface
Select the Toposolid that covers the area of your model line alignment. The Plan canvas will overlay the Toposolid's point cloud footprint as a semi-transparent green filled polygon (convex hull), letting you visually confirm the model line path falls within the terrain coverage area.
How the Z Intersection Works
For each XY station point, the tool creates a vertical line from Z=−999999 to Z=+999999 at that XY location. It then iterates through every Face of the Toposolid's solid geometry and calls face.Intersect(verticalLine). The closest intersection to the original point is used as the final Z value. If multiple face hits occur (e.g., overhanging terrain), the closest one wins.
Set the Interval Spacing
numericUpDown1 (labelled Interval spacing: in the right panel) controls the station sampling distance in metres. Range: 1–200 m, default: 10 m. Every change to this value clears all cached geometry and refreshes both canvases automatically.
Choose the Right Interval for Your Alignment
The interval determines both the smoothness of the output spline and the number of reference points in the Revit family. Consider:
- Straight sections: 20–50 m is usually accurate enough — more points add no visual improvement on a straight line.
- Gentle curves: 10 m is the recommended default and produces a smooth result for most bridge alignments.
- Tight curves (radius < 100 m): Use 5 m or less so the spline fits the curve without visible chord error.
- Very rough terrain: Reduce the interval so more vertical rays are cast — this captures terrain peaks and valleys more accurately.
Reading the Plan Canvas
The upper canvas (pictureBox2, labelled [PLAN]) shows a 2D top-view of the model line route. It auto-scales to fit all geometry and updates whenever any selection or interval changes.
Verify Route and Topo Coverage
The Plan canvas draws the following layers:
- Grid — fine (10 m) and coarse (50 m) grey lines at the current scale
- Toposolid footprint — semi-transparent green filled polygon (convex hull of all topo point coordinates projected to XY)
- Model line route — cyan/blue polyline connecting all extracted curve segments
- Station dots — white dots at every interval station along the route
- North arrow (pictureBox4) — small north indicator image pinned inside the canvas area
Verify that the cyan route line lies entirely within the green polygon. Stations outside the green polygon will fall back to their original flat Z elevation.
| Action | Input |
|---|---|
| Pan | Left-button drag |
| Zoom | Scroll wheel (min 10%, max 3000%) |
| Reset | Double-click |
Reading the Elevation Canvas
The lower canvas (pictureBox1, labelled [ELEVATION]) shows the terrain profile along the route at an exaggerated H1:V10 vertical scale. It renders only after a Toposolid is selected and station points have been cached.
Verify the Terrain Profile
The elevation canvas draws a red profile line connecting successive station elevations. At each station a vertical drop line is drawn to a datum baseline, with two annotations:
- STA= X.X m — station distance from start, text rotated 90°
- EL= Z.Z m — ground surface elevation at that station, text rotated 90°
A datum line is drawn at a round elevation value slightly below the lowest station elevation, labelled Datum: N.N m on the left. This matches standard civil engineering vertical section sheet conventions.
| Action | Input |
|---|---|
| Pan | Left-button drag |
| Zoom | Scroll wheel (min 10%, max 2000%) |
| Reset | Double-click |
Run and Validate
Click RUN — Seven-Stage Pipeline
The cyan RUN button (bottom-right, 120×40 px) executes the following pipeline. A WaitProcess overlay appears during execution:
- Input validation — checks comboBox1 (group) and comboBox2 (Toposolid) are both selected. Fails with a specific error if either is missing. Progress: 0%.
- Curve element retrieval — calls
GetElementsFromGroup()to collect all model line members from the selected group. Progress: 1%. - Total length calculation — sums the geometry length of all curve elements. Progress: 5%.
- Station list generation — builds a list of station distances from 0 to total length at the selected interval. Progress: 10%.
- Point extraction — calls
GetPointsAtStationsFromCurves()which builds a cumulative distance array for each curve segment and interpolates XYZ positions at each station. Progress: 10–21%. - Toposolid intersection — calls
GetIntersectedPointsFromToposolid(): for each XY station, a vertical line (Z: −999999 to +999999) is intersected with every face of the Toposolid's solid geometry. The closest valid intersection becomes the final Z. Duplicate points within 0.01 m tolerance are removed. Progress: 25–66%. - Family creation & placement — creates a family document from the selected template, builds a
CurveByPointsspline through adjusted points, saves the .rfa, loads it into Revit, and places an instance at the first 3D station point. Family name:AutoBRIDGE_3DString_IDxxxxx. Progress: 68–100%.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| comboBox1 (Group) is empty | No Revit Groups exist in the project | Select all model lines, then Group → Create Group in Revit before opening the form |
| comboBox2 (Toposolid) is empty | No Toposolid in the project, or using Revit 2023 or earlier | Add a Toposolid; or use the Topography tool if on Revit 2023 |
| Plan canvas shows route but no green polygon | No Toposolid selected yet | Select a Toposolid from comboBox2 |
| Elevation canvas shows flat line at Z=0 | No Toposolid intersection found — route is outside topo extent | Confirm topo covers the model line area in the Plan canvas; select the correct Toposolid |
| RUN error: "No valid intersection points" | All rays missed the Toposolid faces | Check that the Toposolid has a proper solid form; try viewing in 3D to confirm solid geometry exists |
| 3D string has gaps or flat segments | Some stations fell outside the topo footprint | Ensure full alignment length is covered by the Toposolid; extend the topo or trim the model line group to the covered area |
| Spline is rough / zig-zag | Terrain has sharp ridges and interval is too large | Reduce interval to 2–5 m to capture terrain details more accurately |
| Template not found during RUN | No template configured in AutoBRIDGE settings | Open AutoBRIDGE settings and select a valid family template (.rft) |