Align fence(3Dobject) to a feature line

Hello, I’ve created a script to place objects along a feature line from a corridor. It works well for placing individual elements as light poles. But when I’m trying to place a fence, the end of one element doesn’t connect with the following element neither on plane view nor in Z value. The feature line is an offset of the baseline from the corridor, so the stations are not exactly the same.
¿Any ideas of how to resolve this? Thank you.

Really good example of what I think about in our daily work.
At my company we have a subassembly that creates the fence but if we don’t use that sub it would be good to be able to create the fence using dynamo instead :slight_smile:

I’m not there at all but have you tried to insert the fence as a separate object and then add poles at a certain distance along the corridor feature line?

For example, if I would do it manually instead of with dynamo I would extrude the fence from featureline and then insert poles with array.


The placement looks correct to me. The coordinate systems of the alignment and/or feature line should have the Y axis tangential to the curve, which looks exactly what the fence segments are doing. It would probably line up more how you’d expect if the insertion point is at the middle of the fence instead of one end.

I would create the points in Dynamo rather than the coordinate systems, then find the vector from each point to the next one in the sequence, and use that rather than the tangent direction at the point. Otherwise you’ll almost always have a disconnect.


Good point Jacob. I guess it depends if you want the fence segments on the inside or outside of the curve…

1 Like

Thanks Patrick that is something I’ve been working around. For that particular case, it’s pretty easy because it’s a simple fence having only 2 horizontal bars connecting the poles. I can model those bars within a customized subassembly. But if I have to include a more complex fence, that’s when I’m having issues.

Thanks, @jacob.small and @mzjensen for your tips. That’s exactly my main problem. When the fence elements are outside the curve there’s a gap between them. When they are inside, there’s overlapping, because the stations are not the same in the feature line compared to the baseline from the corridor. Also, I’ve noticed that at the beginning of the list which has the calculated angles the first value is duplicated. I drop this item and then the positioning works better. Finally, I made a calculation of the angles using Excel and I don’t get the same values as in dynamo. I’m using the following equation A= atan(dy/dx)

I think I could make it work if I had the possibility to use an extracted feature line from the corridor.

But this tool only works with CorridorFeatureLine, if I point to a feature line I get an error.