In this article, we will take a look at some of the design concepts we used during the implementation of the Surfaces .NET API for the 2012 release of Civil 3D. The goal is to give you an overview of the main classes and basic concepts that will allow you to use the API and port the code to .NET if you were using the previous COM API.
As you may already know, there are four types of surfaces in Civil 3D. These types are the result of combining a couple of concepts, the first one being TIN (Triangulated Irregular Network) vs. Grid surfaces. TIN surfaces contain a set of points within the surface boundary, which are triangulated to generate the surface faces. Grid surfaces contain points at specific distances, each one of them containing an elevation. These two different behaviors are exposed through a couple of interfaces: ‘ITinSurface’ and ‘IGridSurface’.
The second concept with surfaces in Civil 3D is Terrain vs. Volume surfaces. Terrain surfaces represent a single layer of terrain where Volume surfaces represent the elevation delta between two surfaces. These two representations are exposed in the API through the ‘ITerrainSurface’ and ‘IVolumeSurface’ interfaces.
All surface types in the API derive from a common base class ‘Surface’, which exposes properties and methods common to all surfaces. Each individual surface type will implement the necessary interfaces according to their representation. The following diagram shows the design of the main classes and interfaces.
As you can see, the design allows you to work with concrete surface types, the ‘Surface’ base type, and through the exposed interfaces. This gives you a lot of flexibility in the way you can operate with the different surface objects depending on your needs.
In subsequent posts, we will take a deeper look at the different properties and methods exposed by the ‘Surface’ class as well as the provided interfaces.