Handrail Generator

Hello all.

First I want to say I know full well this is a very very dumb way to use Dynamo! It’s the verbose versions verbose version. However, it illustrates what kind of end result I’m after.

I’m looking to create a ‘handrail generator’ that will be used for stairs that loop back on top of themselves (Which Revit doesn’t at present handle very well).

First simple version would be: Landing - Flight - Landing - Flight - Landing - Flight.

Second, harder version would use if/then statements to allow for: landing - Flight (X-axis) - mini landing - mini flight (Y-Axis) - mini landing - Flight (X-axis) and so on.

The image showcases my verbose variant. Would any have any pointers?






Many thanks,


sol, as your levelheight is the same for the definition and the number of stairs obviously is the same i would just create on flight and then copy.


Oh right, that makes total sense. I’ll pursue that avenue Peter! Thanks.

Here’s where I have got to so far regarding it. I’ve decided to create 2x definitions. One is a standard stair (parallel), the next would be offset one step, to be tackled after I get the first one working.

I will then simply mirror the geometry upwards based off a user choice of levels as per your suggestion Peter.

I am however running into a couple of syntax issues with my Code Block.

In terms of troubleshooting - I’m missing a ‘}’ somewhere and my List.Create isn’t functioning but beyond that i’m a little stumped.










You need only curly brackets to define a list like so: { content, more content }

Ah brilliant, thanks Dimitar. I’m still getting the first error message of:

Error “}” expected, so I’m assuming it’s something to do with my ‘def’ but for the life of me can’t figure it out as my syntax is the same as the Tips and Tricks version.

Unless my NurbsCurve is failing…

Remove the semicolon on your first line - the one after “HandrailHeight:double)” and hopefully it will work :slight_smile:

I had tried that before! It then states - Error: “;” is expected. Can’t win :smiley:

There really shouldn’t be a need for a semicolon there. I noticed that you’re defining your points as pt1,2,3 but you’re adding them to the list as ptS1,2,3, that will definately cause some issues as well.

Try the following structure:


Right, so it was the List.Create that I had in incorrectly. Thanks Dimitar! It’s now working.

Hello all. As a follow up, I’ve now got code that functions reasonably well. The problem is if I connect the ‘sweep’ profile into my generator it either crashes or takes a very long time (10+ mins) to populate a sweep over a path… which shouldn’t happen.

Does anyone have any idea why this would happen?

Also, is there a way to push this path out to Revit as model lines or reference lines? So I could do the sweep in Revit. Ideally it would be able to be put into an In-Place Model so that I could control it with the ‘Railing’ category but so far (As per Andrea’s suggestion) I can only push it into a ‘Generic Model’ family.


Handrail_Generator Handrail_Generator2

Anyone have any thoughts on why populating my path with a sweep would cause it to crash and/or lag out for 20 minutes?

I’m wondering if I need to change the geometry of my path into something else than a Nurbscurve?

Your function returns a PolyCurve. Unfortunately it seems that solid constructors freak out when you feed them a non-planar PC. I’m not sure what’s the best alternative here. You could extract the individual curves and create a solid at each and then unify them, but that seems to end up pretty choppy at the curve connections. Or you could try running a NURBSCurve through your points, but that will give you a curvy/groovy looking railing.

Also if you just want to export the PC to Revit lines, extract the PC’s curves and feed them into a “ModelCurve.ByCurve” node.


Hello Dimitar,

I’ve tried a Nurbscurve with a degree of 1 which gives a non-curvaceous line (Win) but still runs into the same issue with performance (Lose).

Maybe parsing it to Revit Lines and back in is the best option. Unless I can parse out the linework into a Generic Model family file and simply use it to create a Sweep in Revit?

From what I understand, you should avoid passing NURBSCurves with a degree of less than 3 to Revit as discussed here:

Also my understanding is that Dynamo’s geometry engine doesn’t handle NURBS curves and surfaces with a degree of 1 very well:



Ah, that makes sense. I’ll try an alternative solution then! Thanks man.