GLD Tools Documentation
Complete technical reference and user guide for the GLD Tools plugin suite. Covers all modules, algorithms, configuration, and the Civil 3D API integration layer.
Overview
GLD Tools is a Civil 3D plugin developed by Ground Level Design Inc. that accelerates pipeline and infrastructure engineering workflows. It provides a unified ribbon interface with specialized modules for alignment management, profile design, automated profile generation, pipe profiling, corridor building, corridor replication, cross-section reporting, TILOS CSV export, and spoil pile grading automation.
The plugin loads via the PluginLoader entry point, which registers a custom GLD Tools tab in the Civil 3D ribbon. All project-specific settings (bend specs, pipe profiles, hot bends, cover tables, cross-section offsets) are persisted as a JSON sidecar file (.gld-settings.json) alongside each .dwg drawing file, ensuring per-project configuration that travels with the drawing.
Alignment Manager
Create, edit, and manage all project centreline and offset alignments with live Civil 3D data.
Profile Designer
Interactive PVI editor with deflection analysis, bend compliance checking, and themed export to Excel/HTML.
Auto-Profile Generator
4-pass algorithm with 4 optimization modes that automatically generates compliant pipeline design profiles.
Pipe Profile Creator
Generate pipe invert profiles from grade surfaces using configurable cover tables, pipe specs, and rock zones.
Corridor Builder
Configure baselines, assemblies, and regions with a live WPF cross-section preview navigator.
Corridor Replicator
Replicate corridor baseline regions with a different assembly while preserving station ranges and exclusions.
Cross-Section Report
Generate HTML cross-section reports with multi-profile elevation analysis and cross-slope data at configurable station intervals.
TILOS Profile CSV
Sample surface elevations along an alignment and export to TILOS-compatible CSV with Chainage, Elevation, Easting, and Northing.
Spoil Pile Grading
Automate spoil pile creation from layer-named polylines with multi-stage grading: height, flat top, and surface tie-back.
Export System
5 professionally designed export themes for PVI tables — Excel (.xlsx) and HTML with full statistics.
Architecture
GLD Tools follows a modular WPF-over-Civil 3D architecture. The plugin is structured into six namespaces, each with a clear responsibility. All windows use a shared dark theme (GLDDarkTheme.xaml) for visual consistency with modern Civil 3D workflows. Newer modules (Cross-Section Report, TILOS Profile, Corridor Replicator, Spoil Pile Grading) are built entirely in code-only WPF (no XAML), constructing their UI programmatically in C#.
Startup Sequence
The PluginLoader class implements IExtensionApplication and is registered via the [assembly: ExtensionApplication] attribute. On Civil 3D startup:
| Step | Trigger | Action |
|---|---|---|
| 1 | Initialize() | Register OnFirstIdle handler and DocumentActivated event. Print startup message to the command line. |
| 2 | Idle event (once) | Build the GLD Tools ribbon tab via RibbonBuilder.BuildGLDTab(). Load settings for the active drawing. |
| 3 | Document switch | Automatically reload PipelineSettings from the new drawing's sidecar JSON. |
| 4 | Terminate() | Unhook events and dispose the Module Dock palette. |
Ribbon & Commands
The plugin adds a dedicated GLD Tools tab to the Civil 3D ribbon with six panels. Each ribbon button maps to an AutoCAD command string via the RibbonCommandHandler class.
| Command | Panel | Description |
|---|---|---|
GLDTOOLS | GLD Tools v1.0 | Toggle the Module Dock palette |
GLDMODULEDOCK | GLD Tools v1.0 | Alias for GLDTOOLS — toggle the Module Dock palette |
GLDALIGNMENTS | Alignments | Open the Alignment Manager window |
GLDPROFILES | Profiles | Open the Profile Designer window |
GLDAUTOPROFILE | Profiles → Grade | Open the Auto-Profile Generator |
GLDPIPEPROFILE | Profiles → Pipe | Open the Create Pipe Profile window |
GLDPIPEPROFILESETTINGS | Profiles → Pipe | Open the Pipe Profile Settings window |
GLDPIPELINESETTINGS | GLD Tools v1.0 | Open the Pipeline Bend Settings window |
GLDCORRIDORS | Corridors | Open the Corridor Builder window |
GLDCORRIDORREPLICATE | Corridors → Tools | Open the Corridor Region Replicator |
GLDCROSSSECTION | Profiles → Reports | Open the Cross-Section Report Generator |
GLDTILOSPROFILE | Profiles → Reports | Open the TILOS Profile CSV Generator |
GLDSPOILGRADING | Grading | Open the Spoil Pile Grading Generator |
Modules
Alignment Manager Live GLDALIGNMENTS
The Alignment Manager loads all alignments from the active Civil 3D drawing into a sortable data grid with a sidebar quick-list. It reads alignment properties via the Civil 3D .NET API, displaying name, type (Centerline, Offset, etc.), start/end station, total length, and PI count.
Features
Live data reload from Civil 3D drawings. Sidebar quick-list with alignment type indicators. DataGrid with columns for name, type, station range, length, PI count, and status. Demo mode fallback when no Civil 3D drawing is open. Create, edit geometry, and generate offset alignments via the toolbar. Export to LandXML 1.2 format.
Civil 3D API Usage
Uses CivilApplication.ActiveDocument.GetAlignmentIds() to enumerate all alignments. Each Alignment object provides Name, AlignmentType, StartingStation, EndingStation, Length, and Entities.Count properties.
Profile Designer Live GLDPROFILES
The Profile Designer is the primary PVI editing and analysis tool. It provides a sidebar listing all profiles in the drawing (grouped by alignment), an OxyPlot profile chart, a detailed PVI data grid, and integrated bend compliance checking. Window size: 900×680, resizable.
Key Features
Lazy Loading — Profiles are not loaded into the viewer until the user clicks one in the sidebar. This prevents slow startup when drawings contain high-density Existing Ground profiles.
PVI Density Detection — When a profile is selected, the system calculates PVIs per kilometer. If the density exceeds 50 PVIs/km and the profile has more than 200 PVIs, a dialog prompts the user to display a simplified (decimated) view or load all PVIs. The decimation algorithm reduces the set to approximately 500 evenly-spaced points while preserving the first and last PVIs.
PVI Validation — Civil 3D grades are decimal ratios (e.g., −0.0045 = −0.45%). The loader strips phantom entries (sentinel values > 10.0), duplicate-station PVIs, and handles cases where GradeIn / GradeOut throws on BVC/EVC boundaries.
Deflection Calculation — At each interior PVI:
Grades are already decimal ratios from Civil 3D, so no division by 100 is needed.
Compliance Checking — Compares each PVI's deflection against the active PipelineBendSpec. Concave (sag) PVIs are checked against MaxBendSag, convex (overbend) PVIs against MaxBendOverbend. Hot bend stations are exempt and flagged with a fire indicator. Auto-assigned hot bends are marked with a lightning bolt. Results are color-coded: green for pass, red for fail, amber for whitelisted hot bends, purple for auto-assigned hot bends.
Rock Layer Tracking — When a rock profile is available (from Auto-Profile), the Profile Designer shows a delta column indicating the distance between each PVI elevation and the rock surface below it. Color-coded: green (>0.5 m above rock), amber (0–0.5 m), red (below rock).
Statistics Panel — Displays max/min/average deflection, overbend count, sag bend count, exceedance counts, auto-assigned hot bend count, average elevation, and total profile length.
Batch Delete — Delete interior PVIs where |Grade In| or |Grade Out| exceeds a user-specified threshold. BVC and EVC endpoints are always protected.
CAD Integration — Selecting a PVI in the grid zooms the Civil 3D profile view to that station and draws a transient red highlight circle. Editing elevation values in the grid and clicking Apply writes changes back to the Civil 3D profile via pf.PVIs.RemoveAt() and pf.PVIs.AddPVI().
Export — PVI tables can be exported to Excel (.xlsx) or HTML with one of 5 professionally designed color themes. Exports include profile statistics, active spec information, and per-row compliance coloring.
Auto-Profile Generator Live GLDAUTOPROFILE
The Auto-Profile Generator automatically creates a pipeline design profile that satisfies bend compliance requirements while staying below one or more reference surface profiles. It uses a multi-pass algorithm with four configurable optimization modes and includes a real-time progress window with live logging.
Input Configuration
| Parameter | Description |
|---|---|
| Alignment | Target centreline alignment |
| Left / Right / EG Profiles | Reference surface profiles to stay below |
| Rock Profile | Optional rock surface for delta tracking in Profile Designer |
| Start / End Station | Station range (supports chainage formats like 223+100 or 223.100) |
| Pipe Spec | Active bend specification (joint length, sag/overbend limits) |
| Optimization Mode | Algorithm behavior modifier (Legacy, Minimum Excavation, Smoothest Profile, Minimum PVIs) |
| Max Iterations | Phase A iteration limit (100–2000, default 300) |
| Auto Hot Bends | Enable/disable automatic hot bend assignment for remaining violations |
Station Input Sanitization
The SanitizeStation() helper strips + characters and spaces unconditionally. It also removes dots that appear to be thousands separators (exactly 3 digits follow the dot), converting inputs like 223+100, 223.100, or 223 100 into the numeric value 223100.
Multi-Pass Algorithm
Adaptive Coarse Sampling — Walk the alignment starting at joint-length intervals. At each station, sample left, right, and EG profile elevations; the target is the minimum of all reference surfaces minus a clearance offset. The step size adapts between 1× and 3× joint length based on terrain smoothness — intermediate 1 m checks verify that extending the step won't cause the grade line to exceed the surface envelope.
Fine Floor (1 m resolution) — Re-sample at 1-metre intervals to build a floor profile for surface enforcement. This captures terrain detail missed by the coarse pass.
Bend Compliance (Phase A + B) — Phase A: Iteratively process PVIs to satisfy bend compliance (up to N passes, default 300). For each interior PVI, calculate the deflection angle; if it exceeds the sag or overbend limit, adjust the PVI elevation toward linear interpolation of its neighbors. Hot bend whitelisted stations are skipped. Converges when no violations remain. Phase A.5: Auto hot bend assignment — for each remaining violation, find the smallest available degree that covers the excess and record the assignment. Phase B (Smoothest Profile only): 200 additional passes moving each PVI 50% toward linear interpolation for a gentler aesthetic.
Surface Enforcement — Final verification pass ensuring every point on every grade-line segment stays at or below the floor profile. For each segment, check all fine 1 m samples; if any violation exists, lower the endpoints. Repeat up to 150 passes until clean. The lowering strategy depends on the optimization mode (single endpoint for Minimum Excavation, both endpoints for other modes). A Collinear Merge post-pass (Minimum PVIs only) removes interior PVIs that are collinear within a 0.01° tolerance.
Optimization Modes
| Mode | Phase A Behavior | Surface Enforcement | Post-Processing |
|---|---|---|---|
| Legacy | 1.0× delta factor, 0.05° prune threshold | Translate entire segment down | None |
| Minimum Excavation | 0.6× delta factor (smaller corrections) | Only lower the closest endpoint | None |
| Smoothest Profile | 1.0× delta + Phase B: 200 extra passes converging each PVI 50% toward linear interpolation | Translate entire segment down | None |
| Minimum PVIs | 1.0× delta factor, aggressive 0.002° prune threshold | Translate entire segment down | MergeCollinearPVIs() — removes collinear interior PVIs within angle tolerance |
Generation Progress Window
The Auto-Profile Generator launches a modeless Generation Progress Window that displays real-time updates during profile computation. The window shows the current phase name, detail text (iteration counts, violation counts), a progress bar (indeterminate or percentage), and a scrollable log with timestamped entries. The log can be copied to clipboard or saved to a text file. The dispatcher is pumped via DispatcherFrame to keep the UI responsive while the algorithm runs synchronously on the main thread.
Proxy Metrics
The results summary includes three proxy metrics to help compare optimization modes:
| Metric | Calculation | Purpose |
|---|---|---|
| Excavation Proxy | Trapezoidal sum of depth × width (m²) | Relative indicator of excavation volume |
| Roughness | Sum of |deflection| across all PVIs (°) | Indicates how smooth the profile is |
| PVI Count | Total number of output PVIs | Fewer PVIs = simpler construction |
Output
The generator creates a Civil 3D layout profile via Profile.CreateByLayout() and adds each PVI via ProfilePVICollection.AddPVI(station, elevation). Auto-assigned hot bends and rock elevation data are passed back to the Profile Designer for display. The profile is placed on the target alignment and can be immediately viewed in profile views or opened in the Profile Designer for further editing.
Create Pipe Profile Live GLDPIPEPROFILE
The Create Pipe Profile tool generates a pipe invert profile by offsetting a grade (ROW) surface downward according to a configurable set of pipe parameters. It uses the PipeProfileGenerator helper class.
Invert Elevation Formula
At each station along the alignment, the pipe invert is calculated as:
The generator walks the alignment at variable step sizes determined by the Pipe Spec Table. Different station ranges can have different joint lengths, so the step size adapts as the profile progresses. The first and last PVIs are always included to ensure full coverage.
Configuration Inputs
| Parameter | Source | Default |
|---|---|---|
| Alignment | ComboBox (from drawing) | — |
| Grade Profile | ComboBox (from drawing) | — |
| Pipe Profile Config | ComboBox (from PipelineSettings) | — |
| Pipe Diameter | PipeProfileSettings | 300 mm |
| Bedding Thickness | PipeProfileSettings | 150 mm |
| Rock Ditch Padding | PipeProfileSettings | 200 mm |
| Additional Cut Factor | PipeProfileSettings | 0 mm |
| Cover Table | Per-chainage depth of cover entries | 1.2 m |
| Pipe Spec Table | Per-chainage joint length, bend limits, wall thickness, grade | 12 m joint, X52 |
Corridor Builder Live GLDCORRIDORS
The Corridor Builder manages corridor regions, assemblies, and targets via the Civil 3D API. It provides a data grid of corridor regions with a live WPF Canvas cross-section preview navigator.
Features
Enumerates all corridors in the drawing by walking the model-space block table record (the standard cross-version pattern, since CivilDocument does not expose a GetCorridorIds() method). Displays corridor baselines, sampled stations, and region details. The cross-section navigator allows stepping through stations with Previous/Next buttons. WPF Canvas rendering draws the cross-section geometry with feature lines (daylight, toe, etc.). Includes corridor rebuild, volume report, and surface extraction capabilities.
Civil 3D API Usage
Uses Corridor.Baselines to access baseline collections, CorridorBaseline.SortedStations() to get sampled station arrays, and Corridor.Rebuild() to re-sample after changes.
Corridor Region Replicator Live GLDCORRIDORREPLICATE
The Corridor Region Replicator automates the creation of new corridors by replicating baseline regions from a source corridor with a different assembly assignment. This is commonly used for tasks like creating topsoil strip corridors from an existing road corridor design.
Features
Source Corridor Selection — Select any corridor and baseline in the drawing. The tool scans and displays all regions with their station ranges and assembly names.
Assembly Substitution — Choose a target assembly to replace the source assembly in all replicated regions, while preserving the original station ranges.
Feature Line Exclusions — Optionally pick left and right offset polylines (Polyline, Polyline2d, Polyline3d, or FeatureLine) directly from the drawing to define exclusion boundaries. The polyline picker uses a modal Hide()/Show() pattern for reliable entity selection from the WPF dialog. Selected polyline information (type, handle, name) is displayed in the UI.
Exclusion Profile Selection — A dynamic grid of checkboxes allows selecting which corridor profiles to include as exclusion profiles in the replicated corridor.
Workflow
Select a source corridor and baseline. Review the detected regions and their station ranges. Choose a target assembly from the drawing's assembly collection. Optionally pick left/right exclusion polylines and select exclusion profiles. Click Replicate to create the new corridor with all regions, preserving station ranges and applying the new assembly.
Cross-Section Report Generator Live GLDCROSSSECTION
The Cross-Section Report Generator produces HTML reports containing profile elevations and cross-slope analysis at user-specified stations along an alignment. It is a code-only WPF module with dedicated configuration and settings sub-dialogs.
Features
Multi-Profile Analysis — Select an alignment and assign roles (EG, Design, Rock, Topsoil) to multiple profiles. The generator samples each profile at every report station and tabulates the elevation data side by side.
Cross-Slope Analysis — Optionally sample a TIN surface at perpendicular offsets (left and right) from the alignment centreline. The cross-slope is computed from the elevation difference and offset distance. Slope display format is configurable: Percent (%), Ratio (1:X), or Degrees (°).
Station Equation Support — Handles Civil 3D station equations by detecting gaps via exception handling on PointLocation calls, ensuring reports skip equation gaps gracefully.
Configurable Intervals — Generate reports at preset intervals (50 m, 100 m, 200 m, 500 m, 1000 m), at every PVI location, or at a custom user-specified interval. A live estimate shows how many station cards will be produced.
Export Themes — Output HTML files use the same 5 export themes available to the Profile Designer, with professional color palettes for client deliverables, boardroom presentations, engineering reports, on-screen review, or paper printing.
Configuration Dialog
Before generating, a configuration dialog (CrossSectionConfigWindow) presents station interval selection, export theme choice, cross-slope enable/disable with offset inputs, auto-open browser option, and a file save dialog. All parameters are validated before generation begins.
Cross-Section Settings
A separate settings dialog (CrossSectionSettingsWindow) persists global cross-section parameters to the .gld-settings.json file: cross-slope left/right offsets, maximum corridor width, and slope display format (Percent, Ratio, or Degrees). These settings persist across sessions.
TILOS Profile CSV Generator Live GLDTILOSPROFILE
The TILOS Profile CSV Generator samples a TIN surface along an alignment at regular intervals and exports the results in a CSV format compatible with TILOS scheduling software.
Features
Surface Sampling — Walks the alignment centreline at a user-defined sampling interval (default 10 m), querying the selected TIN surface elevation at each station. Alignment coordinate geometry (Easting, Northing) is also captured at each sample point.
Station Equation Handling — Detects and skips stations that fall within equation gaps, ensuring clean output without duplicated or invalid chainage values.
Chainage Range Selection — Users can specify start and end chainage in metres. Leaving these blank defaults to the full alignment extents.
Live Estimate — As parameters change, the UI updates a live estimate showing the expected number of sample points, chainage range, and total length.
Graceful Surface Handling — Points outside the surface coverage are skipped and counted separately, so partial surface overlap doesn't cause failures.
CSV Output Format
The output file uses a simple 4-column format with high precision:
The end station is always explicitly included in the output regardless of interval alignment.
Spoil Pile Grading Generator Live GLDSPOILGRADING
The Spoil Pile Grading Generator automates the creation of spoil pile gradings from polylines placed on named layers following a specific naming convention. It creates feature lines with elevation assignment, weeding, and multi-stage grading (pile height, flat top, and surface tie-back).
Layer Naming Convention
Polylines must be placed on layers matching the pattern SPOIL-{material}-{height}-{flatDistance}. For example, SPOIL-TOPSOIL-5-1 creates a 5 m high pile with a 1 m flat top from topsoil material. The layer prefix is configurable (default: SPOIL).
Grading Workflow (per Polyline)
The generator processes each selected polyline through a multi-stage pipeline:
Feature Line Creation — Create a feature line from the source polyline on the specified output layer (default:
C-TOPO-FEAT). Assign elevations from the selected reference surface using surface-based elevation assignment.Vertex Weeding — Reduce feature line vertex density using configurable thresholds: minimum angle change, minimum grade change, minimum segment length, and minimum perpendicular distance. This produces cleaner gradings with fewer unnecessary vertices.
Grade to Relative Elevation — Apply the first grading stage: raise the feature line by the pile height parameter (parsed from the layer name) using the specified uphill or downhill slope percentage.
Grade to Distance (Flat Top) — Apply a flat top section at the pile crest by grading outward at 0% slope for the flat distance parameter (parsed from the layer name).
Grade to Surface (Tie-Back) — Tie the grading back to the reference surface, completing the pile geometry. The generator uses the Civil 3D Grading API via reflection for compatibility across C3D versions.
Discovery Modes
Automatic Layer Scan — Scans all layers in the drawing matching the prefix pattern, then counts polylines on each qualifying layer. Results display as checkboxes with layer name, polyline count, and parsed parameters (material, height, flat distance). Select All / Deselect All buttons are provided for convenience.
Manual Polyline Selection — For polylines on non-standard layers, the manual pick mode lets users select polylines directly from the drawing using the AutoCAD editor selection tool. After selection, a parameters dialog prompts for pile height, flat distance, and material name. The dialog uses SizeToContent.Height to ensure OK/Cancel buttons are always visible. The picker uses the proven Hide()/Show() pattern for reliable selection from the WPF dialog.
Configuration
| Parameter | Default | Description |
|---|---|---|
| Reference Surface | — | TIN surface for elevation assignment and tie-back |
| Site | — | Civil 3D site to place feature lines and gradings in |
| Grading Group | {SiteName} 1 | Editable — select existing or type a new name |
| Feature Line Layer | C-TOPO-FEAT | Layer for output feature lines |
| Layer Prefix | SPOIL | Prefix for layer-based polyline discovery |
| Slope Up / Down | — | Slope percentages for uphill and downhill grading |
| Flat Slope | 0% | Slope for the flat top section |
| Weed Angle | — | Minimum angle change threshold (degrees) |
| Weed Grade | — | Minimum grade threshold (%) |
| Weed Length | — | Minimum segment length (m) |
| Weed Distance | — | Minimum perpendicular distance (m) |
{SiteName} 1 naming convention used by Prospector and allows free text entry for custom group names.
Module Dock Live GLDTOOLS
The Module Dock is a dockable palette implemented via ModulePaletteSet that provides quick access to all GLD Tools modules. It uses the AutoCAD PaletteSet API with the AddVisual() method for .NET 8 WPF hosting. The palette is a singleton that can be toggled via the GLDTOOLS or GLDMODULEDOCK commands, or the ribbon button. It persists its dock position (left, right, or undocked) across sessions using a unique GUID identifier.
Configuration
Pipeline Bend Settings GLDPIPELINESETTINGS
Manages pipe bend specifications and hot bend exemptions. Each PipelineBendSpec defines a label, maximum sag deflection (concave), maximum overbend deflection (convex), and joint length. One spec can be marked as the "Active Spec" for compliance checking throughout the plugin.
PipelineBendSpec Properties
| Property | Type | Default | Description |
|---|---|---|---|
Label | string | "New Spec" | Display name (e.g., "NPS 12 X52") |
MaxBendSag | double | 3.0° | Maximum concave/sag deflection per joint |
MaxBendOverbend | double | 1.5° | Maximum convex/overbend deflection per joint |
JointLength | double | 12.0 m | Pipe joint length |
AvailableHotBendDegrees | List<double> | — | Available degrees for auto hot bend assignment (e.g., 5°, 10°, 15°) |
The settings window also manages a Hot Bend Degree Library per spec, defining which bend degrees are available for the Auto-Profile Generator's auto hot bend assignment feature. Default specs are seeded if none exist (DN300 6 m, DN400 9 m, DN600 12 m).
Pipe Profile Settings GLDPIPEPROFILESETTINGS
The Pipe Profile Settings window (960×780, dark theme) configures everything needed for pipe profile generation. It is organized into four sections: Pipe Parameters, Pipe Spec Table, Cover Table, and Rock Zones. Multiple pipe profile configurations can be created and managed per drawing.
Pipe Parameters
| Parameter | Unit | Default | Description |
|---|---|---|---|
| Pipe Diameter | metres | 0.300 | Nominal outside diameter |
| Bedding Thickness | metres | 0.150 | Thickness of bedding material below the pipe |
| Rock Ditch Padding | metres | 0.200 | Extra depth added when the station is in a rock zone |
| Additional Cut Factor | metres | 0.000 | Extra depth applied universally along the entire route |
The window includes a Help button that displays a detailed dialog explaining the invert elevation formula and all parameter definitions.
Pipe Spec Table
The Pipe Spec Table defines per-station-range pipe specifications. This allows different pipe materials, joint lengths, and bend limits to be used along different sections of the route. The Auto-Profile Generator and Pipe Profile Generator both look up the correct spec entry for each station.
| Column | Type | Default | Description |
|---|---|---|---|
| Start Station | double (m) | 0.0 | Start of the station range |
| End Station | double (m) | 10,000.0 | End of the station range |
| Joint Length | double (m) | 12.0 | Pipe joint length (determines PVI spacing) |
| Max Sag | double (°) | 3.0 | Maximum concave deflection per joint |
| Max Overbend | double (°) | 1.5 | Maximum convex deflection per joint |
| Wall Thickness | double (mm) | 12.7 | Pipe wall thickness |
| Pipe Grade | string | X52 | Material grade (e.g., X42, X52, X60, X70) |
The GetSpecAtStation(double station) method searches the pipe spec entries for one covering the given station. If no entry matches, it falls back to the first entry in the collection.
Cover Table
The Cover Table defines the required depth of cover at different chainage ranges along the route. It is used by the Pipe Profile Generator to calculate pipe invert elevations. Cover table entries can be manually created in the UI or imported from CSV files.
| Column | Type | Default | Description |
|---|---|---|---|
| Start KP | double (m) | 0.0 | Start chainage |
| End KP | double (m) | 100.0 | End chainage |
| Depth of Cover | double (m) | 1.2 | Required minimum cover above the pipe crown |
Rock Zones
Rock zones identify station ranges where rock ditch padding should be applied. When the Pipe Profile Generator encounters a station within a rock zone, it adds the RockDitchPadding value to the pipe invert offset, resulting in a deeper trench to accommodate rock excavation requirements.
| Column | Type | Default | Description |
|---|---|---|---|
| Name | string | "Rock Zone" | Descriptive name |
| Start Station | double (m) | 0.0 | Start of the rock zone |
| End Station | double (m) | 100.0 | End of the rock zone |
| Notes | string | — | Optional notes or geotechnical reference |
Hot Bends
Hot bends are station ranges where the pipe is pre-bent at the factory, allowing greater deflection angles than cold-bending permits. PVIs within hot bend ranges are exempt from compliance checking and are flagged with a fire indicator in the Profile Designer. The Auto-Profile Generator also respects hot bend whitelists during Phase A compliance checking.
| Column | Type | Default | Description |
|---|---|---|---|
| Name | string | "Hot Bend" | Descriptive name |
| Start Station | double (m) | 0.0 | Start of the exempt range |
| End Station | double (m) | 100.0 | End of the exempt range |
| Notes | string | — | Optional notes |
Algorithms & Logic
Bend Compliance Check
The compliance check evaluates every interior PVI against the active PipelineBendSpec. The algorithm operates as follows:
For each PVI that is not BVC or EVC: first check if the station falls within a hot bend range (exempt) or is in the auto-assigned hot bend list. Otherwise, determine if the PVI is concave (sag) or convex (overbend) and compare the deflection angle against the corresponding limit. Results are stored per-row with a compliance icon, note, and color-coded deflection cell. The DataGrid is force-refreshed after the check because PviRow does not implement INotifyPropertyChanged — the entire collection is cloned and repopulated.
PVI Density & Decimation
Existing Ground profiles from surface sampling can contain thousands of PVIs per kilometer, which can cause slow loading and rendering in the Profile Designer. The density detection system works as follows:
If PVIs/km exceeds 50 and total PVI count exceeds 200, the user is prompted. Choosing the simplified view triggers the DecimatePviDisplay() method, which keeps every Nth PVI to reduce the set to approximately 500 points. The first and last PVIs are always preserved. An amber info bar indicates the decimated state. Clicking the Reload button while in decimated view force-loads all PVIs (bypassing the density prompt).
Export & I/O
Export Themes
The PVI table and cross-section report export systems support 5 professionally designed color themes, each defined as an ExportTheme class with a comprehensive color palette covering page background, headers, statistics, table rows, compliance states, type badges, and footer.
| Theme | Description | Best For |
|---|---|---|
| Clean Professional | White background, navy headers, subtle blue accents | Client deliverables |
| Corporate | Warm-gray tones, slate-blue headers | Boardroom presentations |
| Blueprint | Light blue tint, steel-blue headers | Engineering reports |
| Dark Minimal | Toned-down dark, desaturated accents | On-screen review |
| Print-Friendly | Minimal ink, crisp black & white | Paper printing |
Export formats are Excel (.xlsx) via ClosedXML and HTML with inline CSS. Both formats include: title row with profile and alignment name, active spec summary, statistics section (7 metrics), column headers, data rows with compliance coloring, and type badges. The cross-section report HTML builder (CrossSectionHtmlBuilder) and Excel exporter (CrossSectionExcelExporter) produce similar themed output for cross-section data.
The user's theme preference can be saved (persisted to the .gld-settings.json file via the LastExportTheme property).
CSV Import
Cover table data can be imported from CSV files via the CsvParser helper. The parser expects a minimum of 3 columns: Start KP, End KP, and Depth of Cover. It also accepts 4-column files for backward compatibility (the 4th column, formerly Joint Length, is silently ignored).
The parser uses a custom ParseCsvLine() method that respects double-quote escaping, making it safe for fields that contain commas. The header row is automatically skipped.
Settings Persistence
All project settings are serialized to a JSON sidecar file using System.Text.Json. The file is named by replacing the drawing's .dwg extension with .gld-settings.json.
Persisted Data
| Category | Data |
|---|---|
| Bend Specs | Label, MaxBendSag, MaxBendOverbend, JointLength, AvailableHotBendDegrees for each spec |
| Hot Bends | Name, StartStation, EndStation, Notes for each hot bend |
| Pipe Profiles | Label, PipeDiameter, BeddingThickness, RockDitchPadding, AdditionalCutFactor, PipeSpecs, CoverTable, RockZones for each pipe profile |
| Active Labels | ActiveSpecLabel, ActivePipeProfileLabel |
| Preferences | LastExportTheme, OptimizationMode, MaxAutoProfileIterations |
| Cross-Section | CrossSlopeLeftOffset, CrossSlopeRightOffset, MaxCorridorWidth, SlopeDisplayFormat |
Settings are automatically reloaded when the user switches between drawing tabs via the DocumentActivated event.
ObservableCollection<T> for WPF binding, while the serialized DTO uses List<T> for clean JSON output. Load/Save methods convert between the two representations.
UI & Dark Theme
All GLD Tools windows share a dark theme defined in GLDDarkTheme.xaml. The theme provides consistent styling for windows, buttons, text blocks, data grids, combo boxes (including full editable ComboBox support with PART_EditableTextBox), toolbars, info bars, sidebar panels, and modal title bars. Key design elements include:
Dark background palette (#0F1923, #1A242C, #1A2530) with light text (#D0D0D0, #7B8C9E). Cyan accent (#00BCD4) for primary actions and selection states. Color-coded sections in the Pipe Profile Settings: green (#4CAF50) for Pipe Spec Table, blue (#2196F3) for Cover Table, amber (#FF9800) for Rock Zones. Info bars with Amber and Green variants for warnings and success states. Custom ComboBox popup and ComboBoxItem templates for proper dark rendering in dropdown menus, with hover and selected state triggers.
Newer code-only WPF windows (Cross-Section Report, TILOS Profile, Corridor Replicator, Spoil Pile Grading, Generation Progress) apply the same theme by loading GLDDarkTheme.xaml as a merged resource dictionary at construction time, then referencing brush keys like BrBgPanel, BrText, BrAccent, and style keys like ModalTitleBar programmatically.