切土と盛土を計算する

コリドー サーフェスの重要な用途の 1 つは、それらを既存の現況地盤サーフェスと比較することです。これにより、計画コリドーに合わせて地形を変更するために必要な切土と盛土の量を決定します。

次の例では、既存の現況地盤とコリドーの計画サーフェスの差異から土量サーフェスを作成し、切土、盛土、および土量の統計を計算します。類似の TinVolumeSurfaceCorridorSurface から直接作成されませんが、CivilDocument サーフェス コレクション(同じ名前を共有する getSurfaceIds() で取得)内の対応する Surface から作成されます。

string baseSurfaceName = "EG";
 string corridorSurfaceName = "Corridor - (1) Top";
 string corridorName = "Corridor - (1)";

 // get the CorridorSurface by name:
 ObjectId corridorId = _civilDoc.CorridorCollection[corridorName];
 Corridor corridor = ts.GetObject(corridorId, OpenMode.ForRead) as Corridor;
 CorridorSurface corridorSurface = corridor.CorridorSurfaces[corridorSurfaceName];

 // Get the oid of both the base surface and the drawing surface corresponding to the
 // corridor surface:
 ObjectId baseId = ObjectId.Null;
 ObjectId corridorSurfaceId = ObjectId.Null;
 foreach (ObjectId oid in _civilDoc.GetSurfaceIds())
 {
Surface surface = ts.GetObject(oid, OpenMode.ForRead) as Surface;
if (surface.Name == baseSurfaceName) baseId = oid;
if (surface.Name == corridorSurfaceName) corridorSurfaceId = oid;
 }



 // Create TinVolumeSurface from which to obtain cut and fill analysis:
  ObjectId compareSurfaceId = TinVolumeSurface.Create("Corridor Cut And Fill", baseId, corridorSurfaceId);
  TinVolumeSurface compareSurface = ts.GetObject(compareSurfaceId, OpenMode.ForNotify) as TinVolumeSurface;
 VolumeSurfaceProperties volumeSurfaceProperties = compareSurface.GetVolumeProperties();
 _editor.WriteMessage("Cut and fill analysis: \n Cut: {0} \n Fill: {1}\n Net: {2}\n", volumeSurfaceProperties.AdjustedCutVolume, volumeSurfaceProperties.AdjustedFillVolume, volumeSurfaceProperties.AdjustedNetVolume);