Create Railing along CurveLoop

Hi!
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:

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

http://www.revitapidocs.com/2018.1/34a36770-964a-60eb-5ad7-c013913dfd05.htm

Here is my code in Python so far:

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

TransactionManager.Instance.EnsureInTransaction(doc)

for curve in curves:
	revitCurves.append(curve.ToRevitType())

cLoop = CurveLoop.Create(revitCurves)

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

TransactionManager.Instance.TransactionTaskDone()

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:

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

http://www.revitapidocs.com/2018/1c9de88b-8038-4ac9-37bd-9b6fd5e1f801.htm

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?

image

1 Like

Hi
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: