Extract Solids from corridors with shape codes

Hi everyone,

I’m currently working with Dynamo for Civil 3D and trying to extract solids from a corridor.

At the moment, I am using a script (which I downloaded from the forum) that successfully exports corridor solids, but it extracts all subassembly shapes (base, subbase, pavement layers, etc.). What I actually need is to extract only one specific layer corresponding to the Finished Grade (FG) — the top layer of the corridor.

From what I understand, this should be related to filtering Shape Codes or possibly Classification Codes before running the ExportSolids method, but I’m not sure how to properly implement this in Dynamo.

Has anyone managed to:

  • Filter corridor solids by Shape Code?
  • Export only a specific layer (e.g., FG / top surface)?
  • Or control which shapes are included/excluded in ExportCorridorSolids?

Any guidance, examples, or suggestions would be greatly appreciated.

Thanks in advance!

Hi
Perhaps by sorting the centroids by decreasing altitude

you could then get the index of each sublist

I don’t use Civil 3D

Regards, Christian Stan

I don’t know which script you are using, but there are parameters to be defined before the export.

There, you can set what to export.
Example from our approach to export selected codes into new file in Python:

def exportcorridorsolids(corridorin,exportshapes,exportlinks,excludedcodesin,includedcodesin,database,path):
    try:
        with adoc.LockDocument():
            with adoc.Database as db:
        
                with db.TransactionManager.StartTransaction() as t:
                    # Place your code below
                    if not database:
                        outdb = db
                    else:
                        outdb = acaddbs.Database()
                    corridornames = []
                    for i in range(len(corridorin)):
                        exlcodes = Array[str](excludedcodesin)
                        inlcodes = Array[str](includedcodesin)
                        # Open corridor object
                        corridor = t.GetObject(corridorin[i].InternalObjectId, 
                        acaddbs.OpenMode.ForWrite)
                        if isinstance(corridor, Corridor):
                            corridorname = corridor.Name
                            param = ExportCorridorSolidsParams()
                            param.ExportShapes = exportshapes
                            param.ExportLinks = exportlinks
                            param.ExcludedCodes = exlcodes
                            param.IncludedCodes = inlcodes
                            export = corridor.ExportSolids(param,outdb)
                            corridornames.append(corridorname)
                        else:
                            pass
                    if database:
                        newcivdoc = CivilDocument.GetCivilDocument(outdb)
                        dwgsettings = newcivdoc.Settings.DrawingSettings
                        dwgsettings.UnitZoneSettings.CoordinateSystemCode = "HD72/7Pa.EOV";
                        EOV = dwgsettings.UnitZoneSettings.CoordinateSystemCode
                        dwgunits = dwgsettings.UnitZoneSettings.DrawingUnits
                        outdb.Insunits = acaddbs.UnitsValue.Meters
                        units = outdb.Insunits
                        outdb.SaveAs(file,acaddbs.DwgVersion.AC1032)
                    else:
                        pass
                    # Commit before end transaction
                    t.Commit()
                    pass
    except:   ##whatever message you want to display