Divides a curve object into segments of a specified length.
rhinoscriptsyntax.DivideCurveLength (curve_id, length, create_points=False, return_points=True)
rhinoscript.curve.DivideCurveLength (curve_id, length, create_points=False, return_points=True)
curve_id |
Required. String or Guid. The object's identifier. |
length |
Required. Number. The length of each segment. |
create_points |
Optional. Boolean. Create the division points. If omitted or False, points are not created. |
return_points |
Optional. Boolean. Return an array of 3-D points. If omitted or True, points are returned. If False, then an array of curve parameters are returned. |
List of Point3d |
If return_points is not specified or True, then an array containing 3-D division points if successful. |
List of Numbers |
If return_points is False, then an array containing division curve parameters if successful. |
None |
If not successful, or on error. |
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
length = rs.CurveLength(obj) / 4
points = rs.DivideCurveLength(obj, length)
for point in points: rs.AddPoint(point)