Reverse Curves if start point is higher than end point

I am fairly new to dynamo after giving up the first time.
I have multiple curves come from a dwg file inserted into revit, when in dynamo some have higher start points than end points, so i’m trying to reverse only these ones. been trying for hours now.
Aim is to insert columns along dwg line, in this instance the columns are slanted, and circular so i have no need worry about rotation.


Create Columns from DWG centerlines.dyn (36.1 KB)

Something like this should get you started:

Curve.PointAtParameter(crv,0).Z > Curve.PointAtParameter(crv,1).Z ? Curve.Reverse(crv) : crv

Effectively you’re looking for something like ‘If the curve’s startpoint Z value larger than the curve’s endpoint Z value then reverse the curve, otherwise do nothing.’

Hi, Thanks for the reply, yes that looks exactly like what i need but i’m not sure if i’m putting it into my graph correctly, my coding experience is next to zero, i put that text into a code block, there wasn’t any change in the start or end point Z value, is the “PointAtParameter” looking for a revit parameter value? as the points been generated from a dwg line there is no parameter, i’m a bit out of my depth when it comes to coding in code blocks.

Type out the ‘curve.PointAtParameter’ as it appears to requires a namespace prefix.