How CurveOrientation Enumeration works


#1

Hi all,

i try to reverse curves but first i need to identify which curve is clock or counterclock direction, but i dont know how CurveOrientation Enumeration works.

Thanks in advanced


#2

Ok it can be used as comparison like this.

rh.Geometry.Curve.ClosedCurveOrientation(cu) == rh.Geometry.CurveOrientation.CounterClockwise

But i dont know if its used correct in my example according to this https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_Geometry_CurveOrientation.htm


(Dale Fugier) #3

Hi @flokart,

Here is documentation on the Curve.ClosedCurveOrientation functions. Please read the comments carefully, as they will determine which version you use.

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

Here is simple example:

import Rhino

plane = Rhino.Geometry.Plane.WorldXY
circle = Rhino.Geometry.Circle(plane, 5.0)
curve = Rhino.Geometry.ArcCurve(circle)
orientation = curve.ClosedCurveOrientation()
if (orientation == Rhino.Geometry.CurveOrientation.CounterClockwise):
    curve.Reverse()

– Dale


#4

Thanks Dale,

very clear example and easy to understand.
I have a very hard time to understand the symbols in front of the autocompleted code options.
There seems to be no info about the symbols
But i get better and better thanks to the good support


(Tom) #5

top left symbol = class
top right = protected method -> a method which can be accessed only from within a derived class
bottom left = Enumeration -> listing of states for comparison purposes
bottom right = property -> simplified getter/setter; this concept is known for Python as well,its just not very common

They are .net symbols, you find further explanation on www.msdn.com . IronPython = C# with Python syntax. This means you need to be aware of the fact that you are scripting with C# logic actually.


#6

Thanks Tom

This information with a small example would be so helpful for beginners like me when i search in the RhinoCommonAPi


(Tom) #7

Rhinocommon Api should give information about the library, but not on how to program. If you don’t know about intermediate concepts of programming its not McNeels fault.

https://www.dotnetperls.com/enum ->C#
https://docs.python.org/3/library/enum.html -> Python Equivalent


#8

Thanks again Tom for these links.
I get all information that i need in this forum from poeple like you when i stuck and i am very happy about this option of support provided by mcneel.
Sorry if my comment above sounds like complaining about mcneel.
I am thankfull that companys with open mind like mcneel exists.