algorithmic modeling for Rhino
I think I have a general misunderstanding of how python, grasshopper, and rhino keeps up with geometry.
To learn python, I'm writing a script that will generate GCode for my schools router for surfaces, contours, pockets, etc.
I have been inputting my geometry as List Access and accessing it through a for loop because if I do not, then I get the error "Parameter must be a Guid or string representing a Guid". So using this for loop method seemed to work with the rs.CurveEndPoint method.
When I try to iterate through a list of geometry with a for loop and then use the rs.TrimCurve to create subcurves of the original curves, I get the error "Parameter must be a Guid or string representing a Guid" once again.
So what is the difference between CurveEndPoint and TrimCurve that causes this to happen?
Thanks for any help,
Jackson
Tags:
Hi Jackson,
the difference of the two is, that TrimCurve has an optional parameter which deletes the existing curve. So when the original curve is deleted in your case (Virtual Geometry), the function will not find the original geometry for trimming anymore on a second step.
This third option has to be set to FALSE in Grasshopper, otherwise it will not work. Only in Rhino you can leave it blank (or set to TRUE).
so this will work:
import rhinoscriptsyntax as rs
import Rhino as rhino
Contour2dEndPoints = []
Contour2dSubCurve = []
SubCrvInterval = [0, 0.99999999]
for x in Contour2d:
Contour2dEndPoints.append(rs.CurveEndPoint(x)[2])
for x in Contour2d:
Contour2dSubCurve.append(rs.TrimCurve(x, SubCrvInterval, False))
a = Contour2dSubCurve
Hope i explained it right. Cheers,
FF
Florian,
Worked like a charm! Thanks for the help,
Jackson
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by