サーフェス境界のリストを取得する

コリドー サーフェスの境界を定義するには、境界とマスクという 2 種類のオブジェクトを使用します。境界は、サーフェスの外側の端またはサーフェス内にある穴の内側の縁を表すポリゴンです。マスクは、サーフェスの表示可能な部分を表すポリゴンです。サーフェスのすべての境界のコレクションは CorridorSurface.Boundaries プロパティに格納され、すべてのマスクのコレクションは CorridorSurface.Masks プロパティに格納されます。

境界(CorridorSurfaceBoundary 型)とマスク(CorridorSurfaceMask 型)は、どちらも同じ基本インタフェース(CorridorSurfaceBaseMask)から派生し、どちらもほぼ同じメソッドとプロパティを備えています。境界のポリゴンを構成するポイント配列は、PolygonPoints() メソッドを呼び出すことによって取得できます。計画線のセグメントを選択することで境界が定義された場合、そのような計画線コンポーネントのコレクションは FeatureLineComponents プロパティに含まれます。

コリドー サーフェス境界とマスクを修正する方法の詳細は、「サーフェス境界を修正する」を参照してください。

次の例では、コリドー サーフェスのすべての境界を調べ、各サーフェスに関する情報を表示します。

// List boundaries
foreach (CorridorSurfaceBoundary oCorridorSurfaceBoundary in oCorridorSurface.Boundaries)
{
    if (oCorridorSurfaceBoundary.BoundaryType == CorridorSurfaceBoundaryType.InsideBoundary)
        ed.WriteMessage("Inner Boundary: ");
    else
        ed.WriteMessage("Outer Boundary: ");
 
    ed.WriteMessage(oCorridorSurfaceBoundary.Name);
 
    // Get the points of the boundary polygon
    Point3d[] oPoints = oCorridorSurfaceBoundary.PolygonPoints();
    ed.WriteMessage("\nNumber of points: {0}\n", oPoints.Length);
    // Print the location of the first point. Usually corridors
    // have a large number of boundary points, so we will not
    // bother printing all of them.
    ed.WriteMessage("Point 1: {0},{1},{2}\n",
        oPoints[0][0],
        oPoints[0][1],
        oPoints[0][2]);
 
    // Display information about each feature
    // line component in this surface boundary.
    ed.WriteMessage("Feature line components \n Count: {0}\n",
        oCorridorSurfaceBoundary.FeatureLineComponents.Count);
 
    foreach (FeatureLineComponent oFeatureLineComponent in oCorridorSurfaceBoundary.FeatureLineComponents)
    {
        ed.WriteMessage("Code: {0}, Start station: {1}, End station: {2}\n",
            oFeatureLineComponent.FeatureLine.CodeName,
            oFeatureLineComponent.StartStation,
            oFeatureLineComponent.EndStation);
    }
}