Create Slope Pattern on Corridor


I’m trying to create a dynamo routine that adds slope patterns on every corridor in my drawing.
So far i figured out that the the “Corridor.SlopePatterns.add” method uses two feature lines and a style id, but i can´t figure out how to find out the id of the style i want to use.

Anyone has any tips or examples on that?


Still trying this.
but i now get an TypeError: expected CorridorFeatureLine, got CorridorFeatureLine
with the code below.

Some variables are named in portuguese, sorry

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

# Add Assemblies for AutoCAD and Civil3D

# 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 *

adoc = Application.DocumentManager.MdiActiveDocument
civdoc = CivilApplication.ActiveDocument
editor = adoc.Editor

def create_corridor_Slope_Patterns(corNames,FeatLines,TaludeID):

	output = []
	errorReport = None
	i = 0
	check_out = []
	Procura_feat = ""
	if corNames is None or FeatLines is None:
	if not isinstance(corNames, list):
		corNames = [corNames]
	if not isinstance(FeatLines, list):
		FeatLines = [FeatLines]
	global adoc
	global civdoc
	global editor
	with adoc.LockDocument():
		with adoc.Database as db:
			with db.TransactionManager.StartTransaction() as t:
				bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite)
				btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)

				for corName in corNames:
					# Get corridor from corridor collection               
					corId = civdoc.CorridorCollection[corName]
					cor = t.GetObject(corId, OpenMode.ForWrite)
					Features_Fil = FeatLines[i]
					Features_Cor = Features_Fil[0]
					for Feat_Line in Features_Cor:
						# Check if feature line is the last one
						#check_out = dir(Feat_Line)
						Teste_nome = Feat_Line.Code[-4:]
						if Teste_nome[:2] == "33":
							Procura_feat = ""
							if Feat_Line.Code[:5] == "Aterr":
								Feat_Sl_2 = Feat_Line
								Feat_Number = str(int(Feat_Sl_2.Code[-1]) - 1)
								Procura_feat = "AterroBanEsq-" + Feat_Number
								for Feat_Line_2 in Features_Cor:
									if Feat_Line_2.Code == Procura_feat:
										Feat_Sl_1 = Feat_Line_2
							if Feat_Line.Code[:5] == "Corte":
								Feat_Sl_1 = Feat_Line
								Feat_Number = str(int(Feat_Sl_1.Code[-1]) - 1)
								Procura_feat = "CorteBanEsq-" + Feat_Number
								for Feat_Line_2 in Features_Cor:
									if Feat_Line_2.Code == Procura_feat:
										Feat_Sl_2 = Feat_Line_2	
							#Create the slope Pattern
							#check_out = dir(cor)
							#check_out = dir(cor.SlopePatterns)
							cor.SlopePatterns.__add__(Feat_Sl_1, Feat_Sl_2, TaludeID)
					#Next Corridor		
					i =+ 1
	if errorReport == None:
		return check_out
		return errorReport
OUT = create_corridor_Slope_Patterns(IN[0],IN[1],IN[2])

@henrique.foster Hello, did you solve your problem?
if not
Please share a example dyn file
until I try

Yeah, i finally got it.
the problem is that i was using the corridor feature lines a i got from a dynamo block and the python script was expecting a corridor feature line selected from the block table record.
once i managed to do that the error disapeared.