Automatic distance space (Abstandsflächen), is there a better solution than mine?

I can feel your anger. When I started scripting(I didn’t have any knowledge of any language) I tried P, but the rhinoscriptsyntax and rc thing confused me even more. That’s basically why I started with c#

By the way, it’s an honor for me, I found something you consider worth using a scripting component:)
Here is how it could be in C#, also I thought a plane input could be useful.

  private void RunScript(Curve crv, Plane plane, ref object A)

    bool isCCW = crv.ClosedCurveOrientation(plane) == CurveOrientation.Clockwise ? true : false;

    A = crv;

File: (2.4 KB)

I really tried to hide it but yes, I am beyond frustrated. Happens almost every time I mess with Rhino API methods. Despite being a professional programmer (retired) with extensive experience in a vast list of programming languages, the Rhino APIs have always blocked me.

More comments in the new thread but your updated C# is the only thing that works so far!
(though it always returns a CCW curve instead of both CW and CCW)

Some “pro tips” to improve it:

  1. Internalize a World XY plane on the ‘P’ input as a default.

  2. Instead of this:

bool isCCW = crv.ClosedCurveOrientation(plane) == CurveOrientation.Clockwise ? true : false;

you need only this:

bool isCCW = crv.ClosedCurveOrientation(plane) == CurveOrientation.Clockwise;

  1. Since you are using ‘isCCW’ only once, you could it this way:
if(crv.ClosedCurveOrientation(plane) == CurveOrientation.Clockwise) crv.Reverse();
A = crv;

Thanks. :sunglasses:

Probably also some exception handling and maybe Casting could be useful too.I am always too lazy for these ones

That’s nicer indeed.

No need for that after all since ‘ClosedCurveOrientation()’ assumes ‘World XY’ plane when the plane parameter is undefined.