Skip to content

Civil 3D .NET plugin for automated report generation (alignment, profile, surface, pipe network) and batch PDF plotting.

License

Notifications You must be signed in to change notification settings

samisbakedham/C3DReportEngine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C3D Report Engine - Civil 3D Report Generator & PDF Plotter

A professional, production-quality Autodesk Civil 3D plugin that automates the generation of detailed engineering reports and PDF plotting for alignment, profile, surface, and pipe network analysis. This open-source plugin demonstrates advanced expertise with the Autodesk Civil 3D .NET API and C# enterprise development patterns.

Features

Report Generation

  • Alignment Reports - Detailed horizontal geometry analysis including tangent elements, horizontal curves, POC/POT/PRC stations, radii, arc lengths, delta angles
  • Profile Reports - Vertical geometry analysis with Profile View Intersections (PVIs), vertical curves, grades, K-values, and sag/crest identification
  • Surface Reports - TIN surface analysis with elevation statistics, slope categorization, triangle/vertex counts, and breakline analysis
  • Pipe Network Reports - Complete network analysis including structures, pipes, rim/invert elevations, cover depths, slopes, and flow direction
  • Volume Comparison - Cut/fill volume calculations between existing and design surfaces

Output Formats

  • CSV Export - Properly formatted comma-separated values with special character escaping
  • HTML Reports - Professionally styled, responsive HTML with:
    • Embedded CSS with custom color scheme
    • Auto-generated table of contents
    • Alternating row colors for readability
    • Summary statistics with visual stat cards
    • Print-friendly layout
  • Batch Report Generation - Generate all reports for a drawing in a single operation

Plotting Capabilities

  • Individual Layout Plots - Plot any layout to PDF with configurable settings
  • Batch Plotting - Automatically plot all layouts to individual PDF files
  • Plan Set Generation - Combine all layouts into a single multi-page PDF
  • Stamp Support - Automatic date/revision stamps with customizable position
  • Configuration Options:
    • Paper size (Letter, A4, A3, Tabloid, etc.)
    • Orientation (Portrait/Landscape)
    • Plot scale and fit-to-page options
    • Plot style table selection
    • Custom margins and offsets
    • Center plot on page option

Installation

Requirements

  • Autodesk AutoCAD 2025 (or compatible version)
  • Autodesk Civil 3D 2025
  • .NET Framework 4.8
  • Visual Studio 2019 or later (for compilation)

Build Instructions

  1. Clone or download the repository:

    git clone https://github.com/yourusername/C3DReportEngine.git
    cd C3DReportEngine
  2. Open C3DReportEngine.csproj in Visual Studio

  3. Verify assembly references point to your Civil 3D installation:

    • AcDbMgd.dll
    • AcMgd.dll
    • AcCoreMgd.dll
    • AeccDbMgd.dll
  4. Build the solution:

    Build > Build Solution
    
  5. Copy the compiled DLL to your AutoCAD plugins folder:

    C:\Program Files\Autodesk\AutoCAD 2025\UserDataCache\roamed\en-US\Support
    

    Or use the NETLOAD command in AutoCAD to load the DLL on demand.

Usage

Loading the Plugin

In AutoCAD/Civil 3D, use the NETLOAD command:

  1. Type NETLOAD in the command line
  2. Navigate to and select C3DReportEngine.dll
  3. The plugin commands become available

Report Generation Commands

Alignment Report

Command: C3DRE_AlignmentReport

Generates a detailed alignment geometry report including:

  • Tangent elements with bearing and length
  • Horizontal curves with radius, arc length, and delta angle
  • Station values in XX+XX.XX format
  • Exports to CSV and HTML formats

Output Files:

  • {AlignmentName}_Alignment.csv
  • {AlignmentName}_Alignment.html

Example Output:

ALIGNMENT REPORT
Name: Main Road Alignment
Start Station: 0.00
End Station: 2500.00
Total Length: 2500.00
Generated: 2025-02-26 10:30:45

TANGENT ELEMENTS
Station,Bearing (deg),Length,Northing,Easting
0+00.00,45.0000,500.25,1000.00,2000.00
...

HORIZONTAL CURVES
POC Station,POT Station,Radius,Arc Length,Delta (deg),Direction
5+00.00,7+45.32,1000.00,245.32,14.0245,Right
...

Profile Report

Command: C3DRE_ProfileReport

Generates a vertical profile analysis including:

  • Profile View Intersections (PVIs) with elevations and grades
  • Vertical curves with K-values and curve types
  • Station and elevation data for design analysis

Output Files:

  • {ProfileName}_Profile.csv
  • {ProfileName}_Profile.html

Example Output:

PROFILE REPORT
Name: Main Road Profile
Station Range: 0.00 to 2500.00

PROFILE VIEW INTERSECTIONS (PVI)
Station,Elevation,Incoming Grade (%),Outgoing Grade (%)
0+00.00,100.00,0.000,2.500
10+50.00,121.25,2.500,-1.800
...

VERTICAL CURVES
SVC Station,LP/HP Station,EVC Station,K-Value,Type
10+00.00,10+25.00,10+50.00,50.00,Crest
...

Surface Report

Command: C3DRE_SurfaceReport

Generates TIN surface analysis including:

  • Elevation statistics (minimum, maximum, range)
  • Triangle and vertex counts
  • Slope analysis by category
  • Breakline information

Output Files:

  • {SurfaceName}_Surface.csv
  • {SurfaceName}_Surface.html

Example Output:

SURFACE ANALYSIS REPORT
Name: Existing Ground Surface
Min Elevation: 95.50
Max Elevation: 145.75
Elevation Range: 50.25
Triangles: 15,432
Vertices: 8,120

SLOPE ANALYSIS
Category,Min Slope,Max Slope,Area in Range,% of Total,Triangle Count
0%,0.00,10.00,12500.50,55.25,8,456
10%,10.00,20.00,8750.25,38.60,5,892
...

Pipe Network Report

Command: C3DRE_PipeNetworkReport

Generates complete pipe network analysis:

  • Structure list with rim/invert elevations and cover depths
  • Pipe inventory with materials, sizes, and slopes
  • Flow direction analysis
  • Network connectivity summary

Output Files:

  • {NetworkName}_PipeNetwork.csv
  • {NetworkName}_PipeNetwork.html

Example Output:

PIPE NETWORK REPORT
Name: Storm Drainage Network
Structures: 24
Pipes: 23
Total Pipe Length: 2,450.50

STRUCTURES
Name,Type,Rim Elevation,Invert Elevation,Cover Depth,Northing,Easting
MH-1,Manhole,102.50,98.75,3.75,5000.00,10000.00
CB-2,Catch Basin,105.25,98.50,6.75,5100.00,10050.00
...

PIPES
Name,Shape,Size,Material,Length,Slope (%)
P-1,Circular,15.00",RCP,125.50,0.480
P-2,Circular,18.00",PVC,156.25,0.350
...

Batch Report Generation

Command: C3DRE_BatchReport

Generates all available reports for the drawing in one operation:

  • Processes all alignments
  • Processes all surfaces
  • Processes all pipe networks
  • Creates CSV and HTML exports for each object

Output: Reports directory created in the same folder as the DWG with all generated reports

Plotting Commands

Plot Current Layout to PDF

Command: C3DRE_PlotToPDF

Plots the active layout to PDF with the following defaults:

  • Paper size: Letter
  • Orientation: Landscape
  • Scale: 1.0 (to fit page)
  • Style: Monochrome
  • Stamp: Yes (with date/time)

Output: {DrawingName}_{LayoutName}.pdf in Plots directory

Batch Plot All Layouts

Command: C3DRE_BatchPlotToPDF

Automatically plots all paper space layouts to individual PDF files:

  • One PDF per layout
  • Consistent plot settings across all layouts
  • Progress reporting in command line

Output: Multiple files in Plots directory

  • {DrawingName}_Layout1.pdf
  • {DrawingName}_Layout2.pdf
  • etc.

Plot Plan Set (Multi-page PDF)

Command: C3DRE_PlotPlanSet

Combines all layouts into a single multi-page PDF:

  • One page per layout
  • Consistent scale and style
  • Useful for distribution as single plan set

Output: {DrawingName}_PlanSet.pdf in Plots directory

Plot with Revision Stamp

Command: C3DRE_PlotWithStamp

Plots layout with automatic revision control stamp:

  • Includes timestamp
  • Includes revision number
  • Includes username
  • Configurable position (bottom-right by default)

Output: {DrawingName}_{LayoutName}_Stamped.pdf

Stamp Format:

REVISION: 1.0 | Date: 2025-02-26 10:30:45 | Plotted by: username

Configuration

Plot Settings

Plots can be configured via the PlotConfiguration class:

var config = new PlotConfiguration
{
    PaperSize = "Letter",           // Letter, A4, A3, Tabloid, etc.
    Orientation = PlotOrientation.Landscape,
    PlotScale = 1.0,                // 1.0 = 100%, 0.5 = 50%, 2.0 = 200%
    PlotArea = "Layout",            // Layout, Display, Extents, Window
    PlotStyleTable = "monochrome.ctb",
    MarginLeft = 0.5,               // inches
    MarginRight = 0.5,
    MarginTop = 0.5,
    MarginBottom = 0.5,
    EnableStamp = true,
    StampText = "Custom Text Here",
    StampPosition = StampPosition.BottomRight,
    OutputPath = "C:\\Plots\\output.pdf",
    FitToPage = true,
    CenterPlot = true
};

Report Templates

Reports use configurable export formats:

  • CSV: Fixed format for data import to spreadsheets
  • HTML: Responsive design with embedded CSS, suitable for email and web viewing
  • Both formats can be extended with custom formatting

API Reference

Key Classes

ReportBuilder

Core report generation engine:

var reportBuilder = new ReportBuilder(document);

// Build alignment report
var alignmentReport = reportBuilder.BuildAlignmentReport(alignmentId);

// Build profile report
var profileReport = reportBuilder.BuildProfileReport(profileId, alignmentName);

// Build surface report
var surfaceReport = reportBuilder.BuildSurfaceReport(surfaceId);

// Build pipe network report
var pipeNetworkReport = reportBuilder.BuildPipeNetworkReport(networkId);

// Compare two surfaces
var comparison = reportBuilder.CompareSurfaces(baseSurfaceId, designSurfaceId);

CsvExporter

Export report data to CSV:

CsvExporter.ExportAlignmentReport(reportData, "path/to/file.csv");
CsvExporter.ExportProfileReport(reportData, "path/to/file.csv");
CsvExporter.ExportSurfaceReport(reportData, "path/to/file.csv");
CsvExporter.ExportPipeNetworkReport(reportData, "path/to/file.csv");

HtmlExporter

Generate styled HTML reports:

HtmlExporter.ExportAlignmentReport(reportData, "path/to/file.html");
HtmlExporter.ExportProfileReport(reportData, "path/to/file.html");
HtmlExporter.ExportSurfaceReport(reportData, "path/to/file.html");
HtmlExporter.ExportPipeNetworkReport(reportData, "path/to/file.html");

PlotHelper

Handle plot operations:

var plotHelper = new PlotHelper(document);

// Plot single layout
plotHelper.PlotLayoutToPdf(layoutName, config);

// Plot all layouts
plotHelper.BatchPlotAllLayoutsToPdf(outputDirectory, config);

// Plot multiple layouts to single PDF
var layoutList = new List<string> { "Layout1", "Layout2", "Layout3" };
plotHelper.PlotMultipleLayoutsToPdf(layoutList, config);

// Get layout names
var layouts = plotHelper.GetAllLayoutNames();

CivilObjectHelper

Utility functions for Civil 3D object manipulation:

// Format station (1000.00 becomes "10+00.00")
string stationStr = CivilObjectHelper.FormatStation(1000.00);

// Format grade percentage
string gradeStr = CivilObjectHelper.FormatGrade(0.05); // Returns "5.000%"

// Convert degrees to bearing notation
string bearing = CivilObjectHelper.ConvertDegreesToBearing(45.5);

// Get all alignments
var alignments = CivilObjectHelper.GetAllAlignments();

// Get all surfaces
var surfaces = CivilObjectHelper.GetAllSurfaces();

// Get all pipe networks
var networks = CivilObjectHelper.GetAllPipeNetworks();

// Safe property access
double value = CivilObjectHelper.GetPropertySafe<double>(obj, "PropertyName", 0.0);

Data Models

Report Data Classes

  • AlignmentReportData - Alignment geometry with tangents and curves
  • ProfileReportData - Profile with PVIs and vertical curves
  • SurfaceReportData - Surface analysis with slope and volume data
  • PipeNetworkReportData - Network with structures and pipes

Enumerations

  • PlotOrientation - Portrait, Landscape
  • StampPosition - TopLeft, TopRight, BottomLeft, BottomRight
  • PdfQuality - Standard, High

Error Handling

All commands include comprehensive error handling:

  • Transaction management with proper rollback
  • Null reference checking
  • File I/O exception handling
  • User-friendly error messages to command line
  • Debug output for troubleshooting

Example error output:

Error generating alignment report: Object reference not set to an instance of an object.

Examples

Example 1: Generate All Reports for a Drawing

Command line:
C3DRE_BatchReport

Result:
- Creates Reports directory
- Generates reports for all alignments, surfaces, and pipe networks
- Exports to both CSV and HTML formats
- Displays summary in command line

Example 2: Create a Plan Set PDF

Command line:
C3DRE_PlotPlanSet

Result:
- Creates Plots directory
- Combines all layouts into single multi-page PDF
- Perfect for distributing design documents

Example 3: Quick Alignment Analysis

Command line:
C3DRE_AlignmentReport

Result:
- Analyzes first alignment in drawing
- Exports tangent and curve data
- Generates formatted CSV and styled HTML
- Displays summary statistics

Performance Characteristics

  • Alignment report: < 1 second for typical alignments
  • Profile report: < 1 second
  • Surface report: 5-30 seconds depending on triangle count
  • Pipe network report: 2-5 seconds for typical networks
  • Individual layout plot: 5-15 seconds
  • Batch plotting (10 layouts): 30-60 seconds

Troubleshooting

Plugin Not Loading

  1. Verify DLL is in correct location
  2. Check that .NET Framework 4.8 is installed
  3. Run AutoCAD as administrator
  4. Use NETLOAD and check for error messages

Missing Assembly References

  1. Verify Civil 3D 2025 is installed
  2. Check that assembly paths in .csproj are correct
  3. Rebuild solution with correct reference paths

Plot Operations Fail

  1. Verify layout exists in drawing
  2. Check that output directory is writable
  3. Ensure plot style table exists (monochrome.ctb is standard)
  4. Try plotting to a different location

Reports Are Empty

  1. Verify drawing contains the relevant objects (alignments, surfaces, etc.)
  2. Check that Civil 3D objects are properly created
  3. Look for error messages in command line output

Development Guidelines

Code Organization

  • Commands/ - Command implementations for user interface
  • Reporting/ - Report generation and export logic
  • Plotting/ - PDF plotting utilities
  • Helpers/ - Civil 3D API wrapper utilities
  • Models/ - Data structures for reports

Adding New Report Types

  1. Create a new model class in Models/
  2. Implement build method in ReportBuilder
  3. Create CSV export in CsvExporter
  4. Create HTML export in HtmlExporter
  5. Add command method in ReportCommands

Best Practices

  • Always use transactions for database access
  • Check for null objects before accessing properties
  • Use CivilObjectHelper for safe property access
  • Provide user feedback via Editor.WriteMessage()
  • Include comprehensive XML documentation comments

License

Copyright (c) 2026 Samuel Safahi. All Rights Reserved.

This software is proprietary. It is provided for viewing and reference purposes only. No license is granted for use, modification, or distribution. See LICENSE for details.

For licensing inquiries, contact dev@soapboxsuperapp.com

Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch
  3. Add comprehensive comments to code
  4. Test thoroughly with Civil 3D 2025
  5. Submit a pull request with detailed description

Support & Issues

For bug reports and feature requests, please use the GitHub Issues section.

Disclaimer

This plugin is provided as-is. While tested with Civil 3D 2025, always backup your drawings before using automated tools. Test with non-critical projects first.

Author

Civil 3D Report Engine Contributors

Changelog

Version 1.0.0 (2025-02-26)

  • Initial release
  • Complete alignment, profile, surface, and pipe network reporting
  • CSV and HTML export formats
  • Individual and batch PDF plotting
  • Revision stamp support
  • Batch report generation
  • Comprehensive error handling

References

  • Autodesk Civil 3D .NET API Documentation
  • AutoCAD .NET Developer's Guide
  • PlottingServices API Reference

Keywords: Civil 3D, Report Generator, PDF Plotter, .NET Plugin, Autodesk, Engineering Reports, Alignment Analysis, Profile Analysis, Surface Analysis, Pipe Networks

About

Civil 3D .NET plugin for automated report generation (alignment, profile, surface, pipe network) and batch PDF plotting.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages