Terrain Grader

Generates adaptive grading meshes, volumes, and crisp cut/fill colors.

Site Analysis Nickname: TERRAIN GRADER

Overview

Generates adaptive grading meshes, volumes, and crisp cut/fill colors.

Inputs (8)

  • Mesh (Mesh): Original Topography
  • BoundaryCurves (Curve): Closed pads (Optional)
  • BlendAngle (Number): Max allowable slope in degrees
  • CutColor (Colour): Cut zones color
  • FillColor (Colour): Fill zones color
  • MeshResolution (Number): Base grid size
  • ShowContours (Boolean): Toggle contour generation
  • Run (Boolean): Optional. False = skip the analysis and keep showing the last results (cached). Share one toggle with the Analysis Dashboard to switch everything on/off together.

Outputs (7)

  • ModMesh (Mesh): Adaptive Tri-Mesh
  • ColoredMesh (Mesh): Unwelded crisp cut/fill visualizer
  • CutVolume (Number): Total Cut (Negative Z)
  • FillVolume (Number): Total Fill (Positive Z)
  • Contours (Curve): 1m Interval Curves
  • MainContours (Curve): 5m Interval Curves
  • Info (Text): Component information and interpretation

Method, assumptions and simplifications

The same notes appear in the component's Info output.

Method

  1. Each closed BoundaryCurves pad gets a best-fit plane through its polyline vertices (or 20 division points if it is not a polyline); open curves are ignored. With no pads the input Mesh is passed through unchanged with zero volumes.
  2. The terrain is sampled by vertical rays on a square grid of MeshResolution over the mesh bounding box. Where the local face is steeper than 30°, two extra samples are added at half a cell in X and in Y. Points every MeshResolution × 0.25 along each pad boundary are added too.
  3. A sample inside a pad (plan containment test in World XY) is moved onto that pad plane. A sample outside all pads is clamped into a slope envelope: for each pad, Z must lie within padZ ± d × tan(BlendAngle), where d is the plan distance to the nearest point on the pad boundary; the tightest limits over all pads apply.
  4. ModMesh is a 2D Delaunay triangulation (in World XY) of all the moved samples.
  5. CutVolume and FillVolume are summed on the base grid: at each cell centre the original terrain is ray-cast and the grading rule (pad plane or slope envelope) is applied at that point; the height difference × MeshResolution² is counted as fill if above +0.01 m or as cut if below −0.01 m. Both are reported as positive volumes.
  6. ColoredMesh is an unwelded copy of ModMesh. Each face takes FillColor if the mean vertex height difference to the original terrain is above +0.05 m, CutColor if below −0.05 m, and white otherwise.
  7. With ShowContours on, ModMesh is contoured at every whole model unit between the lowest and highest Z of the original and graded terrains; levels divisible by 5 go to MainContours, the rest to Contours.

Assumptions

  • Model units are metres: thresholds of 0.01 m and 0.05 m, the 30° refinement angle and the 1 m and 5 m contour intervals are hard-coded.
  • Pads are closed curves that are roughly planar; a sloping pad is allowed and follows its fitted plane.
  • The terrain is a single-valued height field seen from above (no overhangs); faces wound downwards are treated as upward for the steepness test.
  • BlendAngle is the steepest permitted embankment slope for both cut and fill (same value either side).

Simplifications and limits

  • Embankments are a geometric slope envelope (a cone of slope BlendAngle around the pads), not a designed batter, retaining wall or drainage profile; no soil type, bulking or shrinkage factor is applied.
  • The graded surface (ModMesh) is a re-triangulation of grid samples, so away from the pads it is a linear resampling of the original terrain. Volumes are not affected (they apply the grading rule directly), but on rough terrain ColoredMesh can show small cut or fill where nothing was graded.
  • Volumes use one sample per grid cell (midpoint rule), so accuracy depends on MeshResolution.
  • Overlapping pads are resolved by input order (the first containing pad wins); conflicting envelopes from several pads are not reconciled.

Workflow

  • Site terrain mesh (for example from Site Fetch) -> Mesh; building pads or platforms as closed curves -> BoundaryCurves.
  • ColoredMesh for cut and fill diagrams; CutVolume and FillVolume for an early earthworks balance; Contours and MainContours for drawings.