Hi,
This is a simple example script from python to flip the curve direction:
import rhinoscriptsyntax as rs
def CurveDirection():
master = rs.AddCurve(([0,0,0],[0,100,0],[100,100,0],[100,0,0],[0,0,0]))
curves = rs.GetObjects("Select closed curves to set directions CW",4)
for curve in curves:
if rs.IsCurvePlanar(curve) and rs.IsCurveClosed(curve):
if rs.CurveDirectionsMatch(curve, master):
print "Curve direction allready CW"
else:
print "Curve direction flipped"
rs.ReverseCurve(curve)
else:
print "Curve not closed or planar"
rs.DeleteObject(master)
CurveDirection()
I discovered that there is a difference in python for the CW or CCW direction of a closed curve and the “world” normal direction.
With rs.ReverseCurve the direction is changed, but when I have two curves with a rs.CurveNormal of (0,0-1) and two with (0,0,1) the curves don’t have the same CW or CCW direction.
- So is it true that I have the set all Normal the same and than check the direction?
- How do I get all normals the same? (rs.CurveNormal does only return the normal)
- How do I get rid of the physical master curve?
Thanks!
-regards