Reduces the number of curve control points while maintaining the curve's same general shape. Use this function for replacing curves with too many control points. For more information, see the Rhino help file for the FitCrv command.
rhinoscriptsyntax.FitCurve (curve_id, degree=3, distance_tolerance=-1, angle_tolerance=-1)
rhinoscript.curve.FitCurve (curve_id, degree=3, distance_tolerance=-1, angle_tolerance=-1)
curve_id |
Required. String or Guid. The object's identifier. |
degree |
Optional. Number. The curve degree, which must be greater than 1. The default is 3. |
distance_tolerance |
Optional. Number. The fitting tolerance. If distance_tolerance is not specified or <= 0.0, the document absolute tolerance is used. |
angle_tolerance |
Optional. Number. The kink smoothing tolerance in degrees. If angle_tolerance is 0.0, all kinks are smoothed. If angle_toleranceis > 0.0, kinks smaller than angle_toleranceare smoothed. If angle_toleranceis not specified or < 0.0, the document angle tolerance is used for the kink smoothing. |
Guid |
The identifier of the new object if successful. |
None |
If not successful, or on error. |
import rhinoscriptsyntax as rs
oldCurve = rs.GetObject("Select curve to fit", rs.filter.curve)
if oldCurve:
newCurve = rs.FitCurve(oldCurve)
if newCurve: rs.DeleteObject(oldCurve)