Create Corridors from FeatureLines

Hi!
Dear experts!

Please tell how i can create a corridor from a feature lines, without using a alignment and profile.

I assume that there is no built-in node for this feature?

Maybe this can be done using the API and Python Script?

Thanks!

1 Like

No-one has an idea about this issue how to create corridor from a feature line by using Dynamo?

No, it isn’t possible to do this through Dynamo because the Civil 3D API doesn’t provide any way to do it. The only way to accomplish it is to first create an alignment and profile from the feature line and then create the corridor with a standard alignment/profile baseline.

1 Like

Hello,
now it’s possible.

So, Can I create a corridor from a featue lines by Dynamo now?

No

ok, thanks!

Something changed with create corridor from a featurelines by Dynamo i new version Civl 2024.2??

New in 2024.2

  • Added support to create corridors based on feature lines by the API.
    • CorridorCollection.Add(String corridorName, String baselineName, ObjectId featurelineId). This creates a corridor with a given corridor name, baseline name, and feature line.
    • CorridorCollection.Add(String corridorName, String baselineName, ObjectId featurelineId, String baselineRegionName, ObjectId assemblyId). This creates a corridor with a given corridor name, baseline name, feature line, baseline region name, and assembly.
    • BaselineCollection.Add(String baselineName, ObjectId feturelineId). This creates a baseline with a given baseline name and feature line.
    • Baseline.SetFeatureLine(ObjectId featureLineId). This sets a baseline as feature line-based.
    • OffsetBaseline.SetFeatureLine(ObjectId horizontalFeatureLineId, ObjectId verticalFeatureLineId). This sets the offset baseline as feature line-based.
    • OffsetBaseline.FeatureLineIdVertical(). This gets the feature line object ID of an offset vertical baseline.
1 Like

Thx for this … it works very well : )
The feature lines in this example provided paths for walls, and … the corridors built the walls …

import sys
import clr
from traceback import format_exc
from datetime import datetime

clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')

from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *

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

elog = []

an = IN[1]

dts = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
adoc = Application.DocumentManager.MdiActiveDocument
cdoc = CivilDocument.GetCivilDocument(adoc.Database)
editor = adoc.Editor

tv0 = TypedValue(0, 'AECC_FEATURE_LINE')
tva = []
tva.append(tv0)

selFltr = SelectionFilter(tva)
psr = editor.GetSelection(selFltr)
selset = psr.Value

c = 0
sc = 0

with adoc.LockDocument():
    with adoc.Database as db:
        with db.TransactionManager.StartTransaction() as t:
            daID = cdoc.AssemblyCollection[an]
            for s in selset:
                id = s.ObjectId
                try:
                    dFL = t.GetObject(id,OpenMode.ForWrite)
                    if len(dFL.Name.strip()) < 1:
                        c = c + 1
                        fn = dts + "-" + str(c).zfill(4)
                        dFL.Name = fn
                    c = c + 1
                    cn = dts + "-" + str(c).zfill(4)
                    dcID = cdoc.CorridorCollection.Add(cn,dFL.Name,id,dFL.Name,daID)
                    dcr = t.GetObject(dcID,OpenMode.ForWrite)
                    dcr.Rebuild()
                    sc = sc + 1
                except:
                    elog.append(format_exc())
            t.Commit()

Application.ShowAlertDialog('Corridors created by this process: ' + str(sc))

OUT = elog

4 Likes