Đổi Code Set Style Corridor bằng Dynamo | Set corridor code set style with dynamo

Python Ccript :

# 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

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *