Extract (auto)Corridor Featurelines

Hi @JPS,

First of all, that documentation is for the COM API, which is probably not what you want. The correct place to look is the AutoCorridorFeatureLine .NET class. There is a property to get the region name. Like @kovacsv mentioned, you’ll have to pay attention to how the Feature Lines are joined across regions. If all of the regions are joined together, the output will be “All”. If they are joined between two or more regions (but not all), then the output will be the name of the first region.

Here’s an example:

import clr

clr.AddReference('AcMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AeccDbMgd')

from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

autoFeatureLine = IN[0]
adoc = Application.DocumentManager.MdiActiveDocument

with adoc.LockDocument():
    with adoc.Database as db:
        with db.TransactionManager.StartTransaction() as t:
            oid = autoFeatureLine.InternalObjectId
            obj = t.GetObject(oid, OpenMode.ForRead)
            region = obj.CorridorFeaturelineRegionName
            t.Commit()
            pass
OUT = region
5 Likes