TIN サーフェスにブレークラインを追加する

ブレークラインは、TIN サーフェスの三角形を作成するために使用します。各 TIN サーフェスは、TinSurface.BreaklinesDefinition プロパティに含まれるブレークラインのコレクション(SurfaceDefinitionBreaklines オブジェクト)を備えています。ブレークラインには複数の種類があり、それぞれ若干異なる方法で作成します。

注: ブレークライン タイプの詳細は、 AutoCAD Civil 3D ユーザ ガイド』を参照してください。

SurfaceDefinitionBreaklines クラスを使用すると、標準ブレークライン、地形作成ブレークライン、近接ブレークラインを同じ方法で追加することができます。各ブレークライン タイプには、独自の Add*() メソッド(たとえば、標準ブレークラインの場合は AddStandardBreaklines)があり、各メソッドには、ブレークラインの作成元のオブジェクトのタイプに応じて、3 つのバージョンがあります。ブレークラインは、1 つまたは複数の 3D 線分、グレーディング計画線、スプライン、または 3D ポリラインを含む Point2dCollectionPoint3dCollection、または ObjectIdCollection から追加することができます。ブレークラインの各タイプでは、曲線の分割方法を決定する指定のパラメータが必要です。

標準ブレークラインは、3D 線分または 3D ポリラインの配列で構成されます。各線分終点はサーフェス内のポイントとなり、ブレークラインの周囲にサーフェス三角形が再作成されます。AddStandardBreaklines() メソッドでは、中央縦距に加えて、最大距離、間引き距離、間引き角度を指定する必要があります。maximumDistance パラメータは AutoCAD Civil 3D GUI の[補間距離]に相当し、weedingDistanceweedingAngle は、それぞれ間引き距離と間引き角度に相当します。

近接ブレークラインは、サーフェスに新しいポイントを追加しません。代わりに、各ブレークライン終点に最も近いサーフェス ポイントが使用されます。サーフェスを構成する三角形が再計算されて、これらのポイントが接続されます。

地形作成ブレークラインは、三角形の辺を削除しません。このブレークラインは三角形の辺との交点に新しいポイントを配置し、新しい三角形が計算されます。

次の例は、標準ブレークライン、地形作成ブレークライン、近接ブレークラインを追加する方法を示しています。

[CommandMethod("SurfaceBreaklines")]
public void SurfaceBreaklines()
{
    using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
    {
        // Prompt the user to select a TIN surface and a polyline, and create a breakline from the polyline

        ObjectId surfaceId = promptForEntity("Select a TIN surface to add a breakline to", typeof(TinSurface));
        ObjectId lineId = promptForEntity("Select a 3D polyline to use as the breakline", typeof(Polyline3d));
        TinSurface oSurface = surfaceId.GetObject(OpenMode.ForWrite) as TinSurface;
        ObjectId[] lines = { lineId };

        PromptKeywordOptions pKeyOpts = new PromptKeywordOptions("");
        pKeyOpts.Message = "\nEnter the type of breakline to create: ";
        pKeyOpts.Keywords.Add("Standard");
        pKeyOpts.Keywords.Add("Non-Destructive");
        pKeyOpts.Keywords.Add("Proximity");
        pKeyOpts.Keywords.Default = "Standard";
        pKeyOpts.AllowNone = true;
        PromptResult pKeyRes = editor.GetKeywords(pKeyOpts);

        try
        {
            switch (pKeyRes.StringResult)
            {
                case "Non-Destructive":
                    oSurface.BreaklinesDefinition.AddNonDestructiveBreaklines(new ObjectIdCollection(lines), 1);
                    break;
                case "Proximity":
                    oSurface.BreaklinesDefinition.AddProximityBreaklines(new ObjectIdCollection(lines), 1);
                    break;
                case "Standard":
                default:
                    oSurface.BreaklinesDefinition.AddStandardBreaklines(new ObjectIdCollection(lines), 10, 5, 5, 0);
                    break;
            }
        }

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

        // commit the transaction
        ts.Commit();
    }
}