Ad

Sunday, November 23, 2014

Thursday, November 13, 2014

Custom Bench Subassembly

Do you want more control over your bench subassembly? The one that comes with Civil 3D is rudimentary and doesn’t allow you to set the slopes of the benches. I recently updated the Civil 3D 2015 custom subassembly for benching and is now available for sale. The cost for the subassembly is $100 per office. Send an email to get more information (link to the right).

Here is what the contours look like.

image

Here is a picture of what it does.

image

Sunday, November 02, 2014

Alignment Curve Mid Point Coordinates

Remember primary school math? I sure don’t remember all of it. I find I’m relearning the remedial math over and over again since I forget the intricacies of what I learned before. One such concept is similar triangles. I learned it in Middle School math class and then once again during surveying class and once again programming numerous solutions. So sometimes I spend too much time solving other people’s problems. This blog post is one such instance.

The problem is adding Northing and Easting value of the mid point of an alignment curve. I usually break out the problem into parts. The first part is to determine how you want to solve the problem. I could have solved this problem by solving for the equation of line, or utilize the delta angles of a curve. I choose to utilize similar triangles. So first I have to figure out what similar triangle to use. In this case I know the center point location and the PI point, this has a length property that I can use. Here is the expression to get that value:

SQRT(({PI Easting}-{Center Easting})^2+({PI Northing}-{Center Northing})^2)

Next I need to know both the difference in northing and easting between those two values.

ABS({PI Easting}-{Center Easting})

ABS({PI Northing}-{Center Northing})

I need the difference as an absolute value because I need to some checks based on the delta angle later on. Next I need to get the distance of the leg of the triangle I’m solving for. In this case the Northing and Easting expressions are below.

(Radius*(DeltaNorthing/Distance))

(Radius*(DeltaEasting/Distance))

Now I need to figure out how I should subtract or add the expressions above. One solution in this is if the delta angle is larger or smaller then pi (180%%d). The other solution is if center easting is larger or smaller then the PI easting. Once we determine this we can then apply the math correctly. Here is the expressions for the cases.

IF({Delta Angle}<pi,
IF({PI Easting}<{Center Easting},{Center Easting}-EastingDistance,{Center Easting}+EastingDistance),
IF({PI Easting}>{Center Easting},{Center Easting}-EastingDistance,{Center Easting}+EastingDistance))

IF({Delta Angle}<pi,
IF({PI Northing}<{Center Northing},{Center Northing}-NorthingDistance,{Center Northing}+NorthingDistance),
IF({PI Northing}>{Center Northing},{Center Northing}-NorthingDistance,{Center Northing}+NorthingDistance))

Now the ending expression can be used in an alignment label or curve table.

image

Here is a link to a drawing with the expressions.

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.

unnamed

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:

image

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:

image

LinkWithin

Blog Widget by LinkWithin

Ad