Orient closed curve (planer sectional profile) on a path curve in RhinoCommon

If there is any method for oriented closed planer curve(planer sectional profile) on a path curve in RhinoCommon, then please let me know.

I need to orient the sectional profiles on a path curve.
It works with grasshopper very well. But I need to create a RhinoCommong plugin.

we know there is something called

CurveOrientation crv_orient = profile.ClosedCurveOrientation(plane);

I guess above method gives the current orientation of the curve. But I have to orient this given profile curve to a given point and on a given plane.

Best regards

Nobody replied …ok … Looks like I have to use transformation matrix.
I did not want to do Transformation matrix, so was looking for an easy way other than using Grasshopper.
I use grasshopper. But this particular tool must need to be in RhinoCommon.

Why would you want to avoid that?
If I’m not mistaken its fairly easy if you have the 2 planes
1: get the plane of the sectional profile
2: get the frame of the curve at the parameter:

frame = curve.FrameAt(parameter) 

3: transform from one plane to the other:

xform = Rhino.Geometry.Transform.PlaneToPlane(initial_plane, final_plane)
scriptcontext.doc.Objects.Transform(object_id, xform, not copy)

HTH
-Willem

1 Like

I can see Willem has already sorted this out, just a small addition:

The above crv.ClosedCurveOrientation has nothing to do with Grasshopper’s Orient component. It simply returns CurveOrientation (clockwise or counterclockwise) based on curve’s direction. To replicate the Orient component, you have to use transformation matrix.

2 Likes

Thank you so much Willem !! It is a big help !! :smile:

I actually had forgotten how to do it… It was wiped out if my head completely.

Thanks so much! for the additional information ! :smile: