Below is a video of the surface created using the code as it is now. You can tell from the subgrade surface created that the subgrade doesn’t have a crisp boundary and additional TIN lines along the boundary are needed to show it crisply.
http://screencast.com/t/tP1bcmDx6N3 (Press link to view video)
To fix this I’m going to move the creation of the subgrade surface to after the polylines are selected. This way I can add hide boundaries to the subgrade surface. This should allow a crisper boundary. Unfortunately it’s not a easy as it sounds. To this I had to add a Function to offset the polyline. First I passed the Handle and area of the polyline to the new Function. I then converted the Handle to an ObjectID, then used the ObjectID to get the polyline. To get the offset of the polyline I had to use the curves and offset the polyline. Not I’m not quite sure where the Curves comes in, but it allows you to do various operations on various objects.
I then have to see if the polyline was offset the correct direction. I choose to check by seeing if the area of the offseted polyline is larger than the original polyline. If it was then I created the polyline in ModelSpace and passed the ObjectID.
I then added code to add the offset polyline to the “FGSurface Subgrade” surface as hide boundaries.
So now running the code creates nice crisp edges, although because I used Hide boundaries I have gaps with not surface information. If I wanted the area filled I should change it from a polyline boundary to a 3DPolyline breakline, which should give the same result.
http://screencast.com/t/rboOVrjJ4X7 (Press link to view video)
I get a fatal error when Civil 3D closes, so I need to fix that and add some more error catching to get the routine to work better.