Create Railing along CurveLoop

I want to create a railing along a curveloop, but i am not sure how to to implement the function in my script.
This is the function i want to use:

static Railing^ Create(
	Document^ document, 
	CurveLoop^ curveLoop, 
	ElementId^ railingTypeId, 
	ElementId^ baseLevelId

Here is my code in Python so far:

doc = DocumentManager.Instance.CurrentDBDocument
railType = UnwrapElement(IN[0])
curves = IN[1]
level = UnwrapElement(IN[2])


for curve in curves:

cLoop = CurveLoop.Create(revitCurves)

railing = Autodesk.Revit.DB.Architecture.Railing.Create(doc,cLoop,railType,level.Id)


I get the error:
TypeError: expected ElementId, got CurveLoop

If i move around the arguments so that it says:

railing = Autodesk.Revit.DB.Architecture.Railing.Create(doc,railType.Id,level.Id,cLoop)

It says it wants RailingPlacementPosition, so it seems i am trying to use the function:

static ICollection<ElementId^>^ Create(
	Document^ document, 
	ElementId^ stairsOrRampId, 
	ElementId^ railingTypeId, 
	RailingPlacementPosition placePosition

How do i call the correct function given at the top?
and what are the correct inputs?

Here is a screenshot from dynamo to the script:

Edit: forgot to add a screenshot
Edit2: Running Revit 2019 and Dynamo 2.0.1, don’ know if that changes things

Hello Magnus,

Just to double check, have you tried railType.Id here?


1 Like

I have tried that, i get the error:
Exception: The railingTypeId is not a railing type.
Parameter name: railingTypeId

Should i use a polycurve or model curves instead of dynamo curves?

The curve i want the railing to follow looks like this: