How to orient profile curve perpendicular to rail curve (python)

I am looking for the right method to orient a profile curve perpendicular to the rail curve for making a sweep1, any pointers?

Hi Gijs,

Just off the top of my head, if the curve profile is planar, get the curve plane, then figure out where on the curve you want to touch the profile and set the plane origin to that…

Once that’s done you need to get the rail curve’s perpendicular frame (plane) at the start point, and create a transformation from the profile curve plane to the rail curve frame. then you can transform the profile curve.

The problem is the orientation of the profile curve. It can still rotate 360° in its own plane, so it will end up perpendicular to the rail, but you can’t predict the orientation in the ā€œaroundā€ direction.

The only way I know of to nail this absolutely is to enforce the creation of the profile curve relative to WorldXY so that say the world Y axis will always be mapped to the Y axis of the rail curve’s frame (which should be vertical)…

thanks,

that makes sense. I can find the Curve.GetCurvePlane() method, but what’s the method for finding the perpendicular plane at the start of a curve?
In the meantime I found another way because I wanted to sweep along a helix, so I simply calculate the angle of the ā€˜slope’ and rotate the profile, since starting direction and start position of a helix are known.

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Curve_PerpendicularFrameAt.htm

1 Like