algorithmic modeling for Rhino
Hey guys,
I have 10 curves and I want to divide them in increasing order:
1st curve - 1 division
2nd curve - 2 divisions
3rd curve - 3 divisions
I managed to do it in Grasshopper and trying to recreate it in GhPython
In Python I tried to use For loop, but it divides all the curves 10 times. Seems that there is a problem in data matching.
Here is the code:
import rhinoscriptsyntax as rs
ptList = []
for i in range(1,10):
pt = rs.DivideCurve(crv, i)
print (i)
ptList.append(pt)
a = pt
Here is the screenshot of GH scrypt and the result I want.
Thanks!
Tags:
Thanks, Tom!
I am exploring Python, thus, trying to recreate the scrypt made in GH, but using Python. Rhinocommon is the next to dive into.
Hi Ayk
this is an example that follows Tom's nice illustration, but this time in Python and using rhinoscriptsyntax. I also took a powerful Python function that transforms nested lists of lists into GH DataTrees, thereby relieving you from all datatree code pain. (:
I hope this helps,
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Hi Giulio,
Thanks a lot for help! That was what I wanted. Actually, I didn't know that you can easily import Grasshopper as a library.
What if you want to divide curves in the geometric progression? Let's say first curve is divided by 1, the second one by 3, the third one by 9, then by 27 and etc. I tried to raise (i+start) to the power of 3: 3**(i+start). It kinda worked, but not sure if it's the correct way.
Hi Ayk,
Yes, you can remove the start parameter and just raise 3 to the power of i.
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
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