Tuesday, February 03, 2009

Slope Ranges

In the last post I provided a link to a site that had the formula, in relatively simple terms, to figure the slope of a TIN triangle. Civil 3D uses the formula (or a similar one) to draw a water drop path or shade the TIN triangle based on the surface's slope analysis style. On thing you can't do in the surface style is exclude portions of a surface that are under a certain area. Some municipalities require an exhibit showing of all slopes within a certain range, but more than a given area value. For instance they may require showing slopes that are greater than 25% and more than 500 SF in area.

By using Civil 3D's API it is possible to extract the information from the surface to create the required exhibit. The OutputTriangles method for an AECCTINSURFACE object contains all of the points that make up the TIN. By taking the points that make up the triangle's one can use the formulas to calculate the slope of the triangles. Once the triangle slopes are known, the boundary's of the triangles that meet the slope range can be merged into a boundary polyline and then checked to see if it meets the minimum area.

The link below contains the program that I came up with to do the task. The program only works in 2009 and completes the task at hand really, really, really slowly. The slowness is in the code and could be optimized. The code portion of the dvb file is password protected, but feel free to use the program if you like. The program hasn't been fully checked and may contain bugs, so please check the output. The way I checked it was setting the style of the surface to show the same slope range and then checked to make sure all of the big areas had polylines around them.

http://style.civil3dreminders.com/SurfaceSlope.dvb