Grasshopper

algorithmic modeling for Rhino

Hello,

I am trying to extend a curve via the rs.ExtendCurveLength()-function in Python and got it to work with regular Nurbs-Curves. The method looks somehow "dirty" to me; taking the Control-Points of the Curve and combine them with rs.AddCurve just to get a Curve with an id-number...

import rhinoscriptsyntax as rs

c_degree = rs.CurveDegree(Curve)
c_knots = rs.CurveKnotCount(Curve)
c_points = rs.CurvePoints(Curve)
c_neu = rs.AddCurve(c_points, c_degree)
#c_neu = rs.AddNurbsCurve(c_points, c_knots, c_degree)
ExtendedCurve = rs.ExtendCurveLength(c_neu, 0, 1, DeltaL)
C = ExtendedCurve

2 Problems:

- I don't get the rs.AddNurbsCurve() to work (says "runtime Error: len() of unsized object)")

- with rs.Addcurve() Arcs and PolyCurves are obviously not reproduced correctly

any ideas?

Views: 1760

Attachments:

Replies to This Discussion

How about using Curve.Extend(CurveEnd.Start, deltaL, CurveExtensionStyle.Smooth)

Method documentation here: http://4.rhino3d.com/5/rhinocommon/html/M_Rhino_Geometry_Curve_Exte...

Thank You David, that works perfectly!

import Rhino.Geometry as rg

C = Curve.Extend(rg.CurveEnd.Start, DeltaL, rg.CurveExtensionStyle.Line)

Hi Laurena

Check the attached file" I hope this helps

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service