How to add your knowledge

Listing Corridors

    Table of contents
    No headers

    The collection of all corridors in a document are held in the CivilDocument.CorridorCollection property.

    The following sample displays the name and the largest possible triangle side of every corridor in a document:

    public static void ListCorridors()
    {
        CivilDocument doc = CivilApplication.ActiveDocument;
        Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
       
        using (Transaction ts = Application.DocumentManager.MdiActiveDocument.
            Database.TransactionManager.StartTransaction())
        {
            foreach (ObjectId objId in doc.CorridorCollection)
            {
                Corridor myCorridor = ts.GetObject(objId, OpenMode.ForRead) as Corridor;
                ed.WriteMessage("Corridor: {0}\nLargest possible triangle side: {1}\n", 
                    myCorridor.Name, myCorridor.MaximumTriangleSideLength);
            }
        }
       
    }