.NET API では、Surface の GetBoundedVolumes() メソッドとして Civil 3D Bounded Volumes Utility が開示されており、これによって TIN サーフェスとグリッド サーフェスの両方に対する領域土量を計算できます。このメソッドでは、ポリゴン領域の頂点を定義するポイント、および標高データム(省略可能)を含む Point3dCollection を指定します。標高データムを指定しなかった場合は、0.0 が使用されます。頂点のコレクションの最初と最後のポイントは同一でなければなりません。つまり、ポリゴンが閉じている必要があります。このメソッドは、ネット土量、切土土量、盛土土量の値を含む SurfaceVolumeInfo オブジェクトを返します。
この例では、サンプル TIN サーフェスを作成し、サーフェスの内側にポリゴンを定義し、サーフェス上で GetBoundedVolumes() メソッドの両方のバージョンを呼び出します。
// Create a sample surface ObjectId surfaceId = TinSurface.Create(_acaddoc.Database, "Example Surface"); TinSurface surface = surfaceId.GetObject(OpenMode.ForWrite) as TinSurface; // Generates 100 random points between 0,100: Point3dGenerator p3dgen = new Point3dGenerator(); Point3dCollection locations = p3dgen.AsPoint3dCollection(); surface.AddVertices(locations); // Create a region that is a polygon inside the surface. // The first and last point must be the same to create a closed polygon. // Point3dCollection polygon = new Point3dCollection(); polygon.Add(new Point3d(20, 20, 20)); polygon.Add(new Point3d(20, 80, 15)); polygon.Add(new Point3d(80, 40, 25)); polygon.Add(new Point3d(20, 20, 20)); double elevation = 30.5; SurfaceVolumeInfo surfaceVolumeInfo = surface.GetBoundedVolumes(polygon, elevation); write(String.Format("Surface volume info:\n Cut volume: {0}\n Fill volume: {1}\n Net volume: {2}\n", surfaceVolumeInfo.Cut, surfaceVolumeInfo.Fill, surfaceVolumeInfo.Net)); // If you do not specify an elevation, 0.0 is used: // surfaceVolumeInfo = surface.GetBoundedVolumes(polygon); write(String.Format("Surface volume info:\n Cut volume: {0}\n Fill volume: {1}\n Net volume: {2}\n", surfaceVolumeInfo.Cut, surfaceVolumeInfo.Fill, surfaceVolumeInfo.Net));