土量サーフェスを作成する

土量サーフェスは、ドキュメント内の 2 つの TIN サーフェスまたはグリッド サーフェス間の差または複合を表します。土量サーフェスは、TinVolumeSurface または GridVolumeSurface クラスの Create() メソッドを使用して作成することができます。

この例では、ユーザは基準サーフェスと比較サーフェスを選択するように求められ、それらから新しい TinVolumeSurface が作成されます。promptForTinSurface() の実装は、分かりやすくするために省略されています。

CommandMethod("CreateTinVolumeSurface")]
public void CreateTinVolumeSurface()
{
    using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
    {
        string surfaceName = "ExampleVolumeSurface";
        // Prompt user to select surfaces to use
        // promptForTinSurface uses Editor.GetEntity() to select a TIN surface
        ObjectId baseId = promptForTinSurface("Select the base surface");
        ObjectId comparisonId = promptForTinSurface("Select the comparison surface");

        try
        {
            // Create the surface
            ObjectId surfaceId = TinVolumeSurface.Create(surfaceName, baseId, comparisonId);
            TinVolumeSurface surface = surfaceId.GetObject(OpenMode.ForWrite) as TinVolumeSurface;
        }

        catch (System.Exception e)
        {
            editor.WriteMessage("Surface create failed: {0}", e.Message);
        }

        // commit the create action
        ts.Commit();
    }
}