Hello everyone,I encountered a strange problem.When I use rs.OffsetCurve () function is offset a polygon, rs.OffsetCurve () function does not offset negative.When the function returns a null offset negative.This is rs.OffsetCurve () function bug?
code:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve", rs.filter.curve)
if rs.IsCurve(obj):
A = rs.OffsetCurve( obj, [0,0,0], 10.0 )
B = rs.OffsetCurve( obj, [0,0,0], -10.0 )
print A,B
Below examle uses a point which is in the plane of the rectangle but far away to set the outside direction and the curve’s area centroid to set the inside direction. Both offset distances used can then be positive:
import Rhino
import rhinoscriptsyntax as rs
def OffsetRectangle():
id = rs.GetObject("crv", 4, True, False)
if id:
plane = rs.CurvePlane(id)
point = rs.XformCPlaneToWorld([10000,10000,0], plane)
crv_1 = rs.OffsetCurve(id, point, 10.0, plane.ZAxis)
ac = rs.CurveAreaCentroid(id)
crv_2 = rs.OffsetCurve(id, ac[0], 10.0, plane.ZAxis)
OffsetRectangle()