Get Band Name from a Profile View Bandset

Hi, I’m new to the Civil3D API and to this forum and I’ve recently explored the Civil3D API library.

I want to get the band style names included in my bandset so I’m trying to extract the bandstyleid from the bandsetitem. How can I get a bandstyleid from a profile view bandset style? I keep trying to get the bandstyleid of the band item directly from the enumerated bandsetitem but it doesn’t seem to work.

Here’s the code for my python node in dynamo:

import sys
import clr

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 *
from Autodesk.Civil.DatabaseServices.Styles import *

dataEnteringNode = IN

adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor

with adoc.LockDocument():
    with adoc.Database as db:

        with db.TransactionManager.StartTransaction() as t:
            # Place your code below
            # 
            #
            cBandSet=IN[0]
            outlist=[]
            idBandSet=cBandSet.InternalObjectId
            objBandSet=t.GetObject(idBandSet, OpenMode.ForRead)
            iBandItems=objBandSet.GetBottomBandSetItems()
            
            bandlist=list(iBandItems.GetEnumerator())
            
            for i in bandlist:
                idBandStyle=i.BandStyleId
                outlist.append(idBandStyle)
        
            # Commit before end transaction
            t.Commit()
            #pass

OUT = outlist

Might be my lack of Civil 3D expertise showing, but I feel like attaching a DWG with the profile view bandset in it would help for testing. If you can’t attach here then you can use another file hosting service, such as box, dropbox, onedrive, google drive, etc… It’d take me a few hours at least to figure out how to build the base data set, and a lot of other Dynamo experts are in a similar boat.

Get Bandset Names.dyn (11.1 KB)

I’m currently training myself hands-on in Python to access Civil3D APIs so I’ve attached my Dynamo script here.

I’m just using civil3d blank standard template files for testing this. Currently the string name to be tested is in the dynamo script. I’m using the AMR_CivilDynNodes package to access the civil bandset object to be inserted in my node.

My expected outcome as of the moment should be a list of band style IDs but I can’t seem to make line 47 in the python node work.

image

hi
only set
348605004_1425343578221594_1103436587651087596_n

https://help.autodesk.com/view/CIV3D/2022/ENU/?guid=de07b49e-ae9c-18bd-2b02-fc481928e767

Thanks for the insight but is there a way to get the band style id or band style name from the profile view band set?