Grasshopper

algorithmic modeling for Rhino

I was studying RhinoPythonPrimerRev3, there is an example about smoothing curve.

But when I try to do it in grasshopper there is an error occured which I dont quite understand.. 

Views: 383

Attachments:

Replies to This Discussion

i thought the problem is that the code applied the function (smoothingvector) to all points and then adding them to new List (newcurvepoints) while forgetting to add the endpoints .. therefore the number of curve points is less expected. you can add the start and end points and the error is gone.

newcurvePoints.append(rs.CurveStartPoint(curve))

for i in range(1,len(curvePoints)-1):
   vm = smoothingvector(curvePoints[i],curvePoints[i-1],curvePoints[i+1],s)
   tempPoint = rs.PointAdd(curvePoints[i],vm)
   newcurvePoints.append(tempPoint)

newcurvePoints.append(rs.CurveEndPoint(curve)

Attachments:

Hi Peter, 

Thank your for your help and its really great to find out the problem XD. I made many dumb mistakes with my code.Thank you very much.

you are welcome .. i am glad it helped 

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service