Set corridor code set style with dynamo

Can you set the “code set style” of a corridor with dynamo?
If I use the “documentExtensions.setstyle”, it sets the style but not the “code set style”.


image

Hi,
I didn’t find a node for that either, but you can do it with python script.

# Load the Python Standard and DesignScript Libraries
import sys
import clr

# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')

# Import references from AutoCAD
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 *

# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

corridorin = IN[0]
stylename = IN[1]

def codesetstyle(corridorin,stylename):

    adoc = Application.DocumentManager.MdiActiveDocument
    editor = adoc.Editor
    
    with adoc.LockDocument():
        with adoc.Database as db:
            with db.TransactionManager.StartTransaction() as t:
                #Get corridor ID
                corridorId = corridorin.InternalObjectId
                # Open corridor object
                corridor = t.GetObject(corridorId, OpenMode.ForWrite)
                #Set code set stlye
                corridor.CodeSetStyleName = stylename
                # Commit before end transaction
                t.Commit()

# Assign your output to the OUT variable.
OUT = codesetstyle(corridorin,stylename)

codesetstyle
corridorcodesetstyle.DYN (6.1 KB)

1 Like

Hi @raf.nelissen2ZW9P

This will work with SetParameterValue toolkit nodes.

2 Likes

Hello,

Both solutions work perfectly!
Thanks Kovacsv and Shahid.