How to Make (Non-Adaptive) Fences Follow Topo

One of the very first Dynamo blog posts I read demonstrated how to place an adaptive fence component so that it would follow Topo. At the time, I thought it was an interesting concept, but not overly useful since I typically use non-adaptive fence components and fences will frequently step (instead of slope) with grade change.

However, not all fences are stepped, and I recently decided to take a look at trying the same concept on a non-adaptive fence. It is quite a bit more complicated than the adaptive version, but there are several reasons why you might not use an adaptive fence component and the concept can also be used to place a stepped fence.

To start out, I wanted to be able to create a fence from a set model lines. And I wanted the definition to work regardless of the order the lines were drawn and also if the lines were open or closed, so I created the node Curves.Reorder.


I also wanted to specify the typical fence span/length, divide the lines by that length, and get then get the remaining span at the end. None of the ootb nodes did this, so I created Curve.DivideByLengthRemainders. It also has the option to put the remainder at the end or split it between the start and end.

fence_end   fence_split

Both of these nodes are available in today’s Landform update.

The rest of the definition can be broken down into several steps: first it places the fence instance (at its midpoint), then it sets the fence length, then it rotates the fence (to match the angle of the line), and finally it sets the angle of the fence (to follow the topo).

Here it is in full:


The trick to making the last part work (setting the angle parameter) is built into the fence family. In order for the angle to work on both up and down slopes, the angle must be able to be negative. This can be achieved with a few simple control parameters.



If you want to try it out, I’ve uploaded both the Dynamo definition and the Revit fence family (click on the links below to download). Also, the definition only works if the lines are drawn below the Toposurface.

Dynamo (0.9.2): Fence Along Lines.dyn

Revit (2015): Fence – Basic.rfa



3 thoughts on “How to Make (Non-Adaptive) Fences Follow Topo

  1. Hi

    I tried the definition with the latest dynamo & it doesn’t seem to work.
    Topography.ToPolySurface has been depreciated and the alternative is Mesh.ToPolySurface
    When i load Mesh.ToPolySurface & link it up I get several errors.
    Internal error please report: Dereferencing a non-pointer (3f47aacd) & a lot of other operation fails.
    I do want to try this out, if you have time to have a look it would really help me out.

    • Yes, it will not work with Dynamo 1.0. I have not yet had a chance to update Landform, so in the meantime I would recommend running this definition in an earlier version of Dynamo (such as 9.2.0). You will also need an earlier version of Spring Nodes- I would check its GitHub page to see which version is compatible with 9.2.

      • I managed to get it to work with spring nodes 82.9.1
        Sometimes the start of the fence position goes in random positions.
        But overall its a great time saver.

        link to the screenshot

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s