3D String from
Model Line Group + Topography
For Revit 2023 and earlier projects using the legacy TopographySurface element. Select a grouped Model Line path and a TopographySurface, set the station interval, and AutoBRIDGE builds a 3D spline draped on the terrain mesh using triangle-by-triangle ray intersection.
What Does This Tool Do?
The Model Line → Topography tool (AlignmentTopography) is the legacy terrain version of the Model Line 3D string workflow. It is identical in form and behaviour to the Toposolid tool, with one key difference: instead of intersecting vertical rays with a Toposolid's solid faces, it intersects them with the triangle mesh of a TopographySurface (TopographySurface.GetPoints() + mesh triangulation).
Topography vs Toposolid — What Changes
Every step in this guide is identical to the Toposolid guide except for the terrain intersection method. The table below summarises exactly what differs:
| Aspect | Topography (this guide) | Toposolid |
|---|---|---|
| Revit version | Revit 2023 and earlier | Revit 2024+ |
| Element type | TopographySurface | Toposolid |
| Z intersection method | Triangle mesh — iterates all triangles of the mesh, tests each with a Möller-Trumbore style ray-triangle algorithm | Solid faces — calls face.Intersect(verticalLine) on each face of the solid geometry |
| Fallback when no hit | Returns original XY point (flat Z) | Returns original XY point (flat Z) |
| comboBox2 label | "Topography" | "Toposolid" |
| Output family name | AutoBRIDGE_3DString_IDxxxxx — identical in both tools | |
Triangle Mesh Intersection — How It Works
The GetIntersectedPointsFromTopography() method retrieves the triangulated mesh of the TopographySurface by calling element.get_Geometry(new Options()) and collecting all Mesh geometry objects. For each input XY station, it defines a vertical ray from Z=+999999 downward (direction: 0,0,−1) and tests it against every triangle of every mesh using the Möller-Trumbore algorithm — checking the intersection point using barycentric coordinates to confirm it lies within the triangle. The closest valid intersection is used as the output Z.
Prerequisites
- A Revit Group containing one or more Model Line elements that define the plan alignment path.
- A TopographySurface element (legacy terrain, available in Revit 2023 and earlier; also exists in Revit 2024 for backwards compatibility) whose mesh covers the plan area of the model lines.
Creating the Model Line Group
In Revit, draw the route using Architecture → Model Line in a plan view. Select all alignment model lines, then Modify → Group → Create Group with a clear name. The group name appears in comboBox1 at form load.
Identifying the TopographySurface
The legacy TopographySurface is typically created from imported survey point files (TXT, CSV) or from Civil 3D surface exports. In Revit 2023, it appears in the Massing & Site tab as "Toposolid" or "Topography" depending on the version. The tool identifies it internally as a TopographySurface class element and displays it by name and element ID.
Select the Model Line Group
Pick the Alignment Group
comboBox1 (left dropdown, placeholder: "Alignment Model Line Group") lists every Revit Group in the project. Select the group containing the model lines that define your alignment route. The tool calls GetElementsFromGroup() to extract all member curve elements.
After selection, the Plan canvas draws the model line route auto-fitted to the canvas, with station dots at the current interval spacing. Any change to the group or interval clears the geometry cache and redraws.
Select the TopographySurface
Pick the Terrain Surface
comboBox2 (right dropdown, placeholder: "Topography") lists all TopographySurface elements, identified by name and element ID in the format Name (ID: xxxxxxx). Select the surface that covers your alignment route.
Once selected, the Plan canvas overlays the topography footprint as a semi-transparent green polygon and the Elevation canvas shows the terrain profile with STA/EL tags. Both canvases update in real time as you change the selection.
Set Interval, Verify Plan & Elevation
Set Interval Spacing
numericUpDown1 (labelled Interval spacing:) controls the station sampling distance in metres. Range: 1–200 m, default: 10 m. Every change clears the cache and redraws both canvases. The same recommendations from the Toposolid guide apply: 10 m for most alignments, 5 m or less for tight curves, 1–2 m for rough terrain.
Verify Both Canvases Before Running
Plan canvas [PLAN]: Confirm the cyan model line route lies inside the green topography footprint polygon. Stations outside the footprint will fall back to flat Z.
Elevation canvas [ELEVATION]: The red profile line should show realistic terrain undulations. A completely flat line at Z=0 means the ray-triangle intersection failed everywhere — check that the topography mesh is valid and covers the route.
| Canvas | Interaction |
|---|---|
| Plan (top) | Left-drag to pan · Scroll to zoom · Double-click to reset |
| Elevation (bottom) | Left-drag to pan · Scroll to zoom · Double-click to reset |
Run and Validate
Click RUN — Identical Pipeline, Different Intersection
The cyan RUN button executes the same 7-stage pipeline as the Toposolid tool, with stage 6 using GetIntersectedPointsFromTopography() (triangle mesh) instead of GetIntersectedPointsFromToposolid() (solid face):
- Input validation — model line group and topography must both be selected. Progress: 0%.
- Curve retrieval —
GetElementsFromGroup(). Progress: 1%. - Length calculation. Progress: 5%.
- Station list —
CreateRange(0, totalLength, interval). Progress: 10%. - XY point extraction —
GetPointsAtStationsFromCurves(). Progress: 10–21%. - Triangle mesh Z intersection —
GetIntersectedPointsFromTopography(): retrieves allMeshobjects from the TopographySurface geometry, tests each input station against every triangle using the Möller-Trumbore algorithm, selects the closest valid hit. Duplicate points within 0.01 m removed. Progress: 25–66%. - Family creation & placement — same as all other tools: create .rfa from template, build
CurveByPointsspline, load into Revit, place at first station point. Family name:AutoBRIDGE_3DString_IDxxxxx. Progress: 68–100%.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| comboBox2 (Topography) is empty | No TopographySurface in the project | Import survey data to create a TopographySurface, or use the Toposolid tool if on Revit 2024+ |
| Elevation canvas flat at Z=0 | Ray-triangle intersection found no hits | Ensure the TopographySurface has a valid mesh; verify in 3D view that it renders a surface shape |
| Profile shows some flat segments | Some stations fall outside the triangulated mesh boundary | Extend the TopographySurface boundary or trim the model line group to the covered area |
| RUN error: "No valid intersection points" | All triangle tests returned null (mesh is degenerate or too coarse) | Re-import the topography with a finer mesh density; check the source survey file |
| Mesh is very coarse on large terrain | TopographySurface was simplified/decimated | Re-create with a higher point density, or use smaller interval spacing to snap between mesh triangles more accurately |
| Template not found during RUN | No template set in AutoBRIDGE settings | Open AutoBRIDGE settings and select a valid .rft family template |