Reporting Success

Just the other day I got a call about the possibility of adding information to a report. Specifically the AutoCAD® Civil 3D® user wanted to know if the coordinate system information of the drawing could be included in the output of an alignment report. Truth be told I didn’t know if it was possible, but I suspected it was since the coordinate system information is included in the LandXML file used in the alignment report creation.


LandXML is developed by the Industry Consortium. The consortium is a group of companies and government agencies that determine a common format for sharing data related to civil engineering projects. This way, any program that outputs to LandXML may import it and generally get the information to come over correctly. This may not happen if the software is not programmed correctly to import the data.

The consortium’s website has additional information on the topic as well as open source software examples, workshop papers from more than six years ago, and links to web applications that let you validate LandXML files. If you come across an issue while importing data you might want to try the validator to see which party in the data transfer is tripping it up.

The Structure

Modifying the report information takes no more than a text editor, although there are some Integrated Development Environment programs available for providing a method to step through the creation of the reports.
For Civil 3D 2014, the files used to create the report are located in the Program Data folder in Windows:

C:\ProgramData\Autodesk\C3D 2014\enu\Data\Reports\xsl

This folder consists of XML Documents and XSL Style Sheets. XML documents contain constant information that does not change based on what information is being reported. One example of this is the GeneralLegalPhrasings.xml file, which contains the strings used to create a legal description. The text doesn’t change and then when the report is run the appropriate text string is extracted from the XML file and utilized. The curve or line information is added in the appropriate location. If you wanted to customize the language used, this would be the file to change.

The XSL Style Sheets provide instructions on what is included in the report and in what order the information should be output. The file includes instructions on which other files should be utilized in the output of the report. One may find the appropriate style sheet by locating the file of the same name as the report option in Civil 3D. If you need to know, access to the reports in Civil 3D may be done from the Toolbox in Toolspace.

To do the heavy work, XSL style sheets utilize JavaScript to process the data. JavaScript is a programming language that works on most operating systems and is really bad at math. In some of the stock reports the bad math shows up in small rounding errors. But for the most part it does a decent job of extracting the information.

Modifying the Report

As mentioned earlier, the reports may be modified with a text editor and I want to add information regarding the coordinate system of the drawing. Before you start, ensure you either have the installation disk for Civil 3D handy or backup the files you are changing to provide a way to go back to the original if something goes drastically wrong. To modify the report, I first locate the portion of the style sheet that collects the templates or instructions on what is included.

Figure 1

The section is indicated with </xsl:call-template> tags. Figure 1 includes pointers to the alignment template found below and indicated with the same name. This is where the alignment information is collected and then included in the report. Below this is the CoordGeom template. The CoordGeom template converts the alignment from LandXML into the format required by the report.

Figure 2

I want to include the coordinate geometry information so I’ll create my own template to show the information and give it the name of Coordinate System. I added the information that I want included by specifying the name of the template which is the same as the heading found in the XML file—in this case CoordinateSystem. The format of the report is <p> tags which indicate text to be shown, the text I want to show as the label information, and then a tag to extract the information from the LandXML file. This is indicated by the “@desc” string in the case of description.

After adding the template, the template needs to be called to be included in the report. This happens on line 47 in Figure 2. Saving the file allows it to be utilized the next time the report is run. Now run the report to verify the information is presented correctly and in the correct location.

It is also possible to skip the template creation and go straight to grabbing the information from the LandXML file and placing it as a line. To do this, use a line similar to the one in Figure 3.

Figure 3

Instead of having the template specify the name of the object we want to get, we include the name of the coordinate system in the list with two forward slashes and then specify the name of the property we want to export.
I now have modified the report to include additional information required to show the coordinate system of the drawing at the time the report was exported. This same process may be done for other report information.

Appears in these Categories