Hello I am not good at programming, but I am just learning. Anyway I am trying to get the ‘evalute curve’ function to work like it does in grasshopper. Here is my code thank you in advance:
domain = rs.CurveDomain( crv1 )
print “curve domain:”, domain[0], “to”, domain[1] #domain is 0 to 10 but I would like to reparamaterize it or unitize it.
pointOnCurve = rs.EvaluateCurve( crv1 , 3, )
ALso, I am not sure why I cannot evaluate multiple curves at the same time? This should be:
Hello Clement thank you for your prompt reply.
Your code does what I wish to achieve and more as I don’t understand the ‘enumerate’ concept. I know its like a king in a card deck, but that is where I am lost.
My question is how can I reference the points created from ‘rs.Addpoint(point_on_curve)’ without using a ‘GetObject()’ function so that I can draw a polyline etc…
Hi @brobes05, it is just a counter which enumerates the curves with a number, in the above example it is the variable named i… Here is one example without it, it appends points to an empty list, to create a polyline:
import rhinoscriptsyntax as rs
def DoSomething():
plane = rs.WorldXYPlane()
rectangle = rs.AddRectangle( plane, 10.0, 10.0 )
explodedCurves = rs.ExplodeCurves([rectangle], True)
pts = []
for curve in explodedCurves:
parameter = rs.CurveParameter(curve, 0.33)
point_on_curve = rs.EvaluateCurve(curve, parameter)
pts.append(point_on_curve)
# for a closed polyline, add first point to end of pts list
pts.append(pts[0])
rs.AddPolyline(pts)
if __name__=="__main__":
DoSomething()
Thanks for the reply. This is much closer to the level I am currently on. I am trying to force python into grasshopper which is not working out so well. Anyway, I coming up with the error ’ unable to draw polyline’. I believe I have written down the proper text. Thanks again for all your help. I understand much better now. The 2nd through 5th lines are indented in python, but I cannot get them to cooperate here.
Yes, the forum sometimes has probs with indents and empty lines. Below should work from within the Python editor. You can open it using _EditPythonScript command and paste. Note that i have indents even in the blank lines.