Move Point if Z is Greater Than Distance

I’m running into some difficulty with finishing the development of my latest sketch. What I’m trying to achieve is the following:

I have multiple Points that are currently equally spaced along a Curve. I then took those Points and Projected them up to a Topography. So now I have Points that are equally spaced along my Curve, but with different Z Values following the Topo. I then take my Points and determine if their Z Value, for example of Point A to Point B is more than 6”. If it is, I moved them to a separate list. So now I have my Points separated into two different lists, one for Points that are Over the 6" rule and one for Less.

This is where I am getting stuck:

If a Point is listed in the Over 6" list, I need to shift that Point, along with all the consecutive Points along the same Curve Segment ONLY, by 2". If the Point is in the Less Than 6" list, then no change is needed and I can go to the next Point and rinse & repeat, etc.

These points will eventually be used to locate Elements once I get all the above calculations figured out. Any ideas on how I can accomplish this? I would upload a sketch, but I don’t even know where to begin. So I’ve uploaded a sample drawing that hopefully helps clarify it a little better.


Thanks in advance.

Group your points by segment (if they’re not already). Check to see if Z > 6.

That’s the easy part. See if you can get that working then post back with your graph.
The next step would be to move only the necessary points.

Okay, I’ve got my points grouped and sorted by their respective curve. I’ve also got my points filtered into 2 lists, one greater than 6" and one less than 6". Where do we go from here?


Run your check for Z values.

But after that we’ll need to specify exactly how these points are moving. From your image it looks like if a point is over 6" it should be spaced at 6’-2" while anything under 6" stays at 6’-0". Essentially the shift for each point is a rolling total to keep spacings the same.

So in your example, Point[0] and Point[1] have no change (0"+0"). Point[2] moves 2" (2"+0"). Point[3] moves 4" (2"+2"). And Point[4] moves 4" (4"+0").

Does this sound correct to you?

Yes, that is exactly what they need to do.

In that case I would test your points for Z>6" and return 0" if false and 2" if true. That will get you half way there. The second half will likely require a little Python or maybe a DesignScript function.

Nick, thanks for all your help so far. I believe I’m down to the last couple of steps now.

I’ve got my point list values and the amount that each point needs to shift along my curve. How do I tell dynamo to shift each point in the direction of the curve it is located?

Oh perfect you even got the rolling totals worked out too. Great.

Line.Direction will get you the vector direction of the line. This should be all you need except that (depending on how the geometry was created) you might get the inverse vector. I would suggest converting your lines to a polycurve then back to lines. This will ensure that all lines are pointed in the same direction (though there’s still a chance it’s the wrong direction, but it’s at least all consistent.)