Sunday, November 02, 2014

Reports Dirty Little Secret

There is a little dirty secret regarding reports in Civil 3D; they are not intended to be used out of the box without modification. The expectation by Autodesk is that you go in and modify them to meet your needs and requirements. I recently got a request to modify one of the reports and I thought I’d make it into this block post.

Their complaint is that Civil 3D for some reason puts the units behind a distance number. So a meters drawing will get a “m” behind, for feet it will get “ft”. Autodesk also puts a comma grouping in the numbers.


Now this goes  back to the little dirty secret of reports. You are supposed to go in and program the reports to get what you want. In this case I have a problem on how Autodesk implemented the reports. Autodesk creates a string value and when you save to Excel you get the string value. Autodesk could have chosen to be nice to us users and placed the number in the Excel Spreadsheet and then formatted the numbers using Excel formatting.

So to fix this issue I’m going to use the same method as Autodesk since I’m doing it for free. When I do a report for a fee I do the report correctly and place the numbers in Excel and then format it utilizing Excel formatting. This way as a user you don’t have to find a replace to make the numbers into real numbers and not dumb strings.

To fix the report in this case I created a new method.

Public Shared Function GetCustomFormatToFourPlaces(ByRef numberToConvert As Double) As String
    Return Math.Round(numberToConvert, 4, MidpointRounding.AwayFromZero).ToString("#.0000")
End Function

In the report I then converted where it is needed. Here is one example:


So now when it is run the report will use raw numbers formated to the correct decimal place rather then the string value that is hard to convert.

Here is the revised file that I changed from the .NET reports. The compiled dll is provided at this link.

To replace this reports with the previous go to this location on your machine: C:\ProgramData\Autodesk\C3D 2015\enu\Data\Reports\Net

Change the name of the original C3DReport.dll file to C3DReport_Old.dll and then copy the new file from the above link. You might have to unblock the file by going into it’s properties in Windows and at the bottom of the General Tab press the Unblock button. The report then should run with the revised report and formatting.

Then the report should output like this:



Anonymous said...

how did u convert .ddl file ? I want to change point_station_offset precision

Christopher Fugitt said...

You have to use Visual Studio. There should be a blog post on the steps.


Blog Widget by LinkWithin