algorithmic modeling for Rhino
I have an application where I'd like to generate a sequence of objects based off of a text file containing a sequence of numbers. I would have a file containing the numbers 1-4 in some order, and from that it would generate a sequence containing one of four elements in the same order as the file, each object oriented relative to the object before it.
That is, say I have a list '1214321'. What I'd like grasshopper to do is take a copy of object 2 and orient its front face with the back face of a copy of object 1. Then I'd like the script to take another copy of object 1 and orient its front face with the back face of the copy of object 2. I'd like to continue this until the program runs out of items in the list.
I know how to read files, but I don't know if reading a list sequentially, or if conditionals, for that matter, are possible. Is this the right way of going about it? Is there a more "grasshopper" way of doing this?
Thanks
P.S. here is a screenshot of something I did by hand, which I'd like to automate. you can see one of the objects I'd like to orient here (it's the highlighted one).
Tags:
It would be possible to use a recursive approach to accomplish this - either through hoopsnake or some other way. But I would recommend something a little more "grasshopper":
If you can find the transform for each object in the series to be aligned to the next object in the series
(A -> B) (B -> C) (C -> D) (D -> E)
Then you can use some list manipulation and other tricks to find compound transforms. essentially:
Move object D by the transform (D -> E)
Move object C by the transform (C -> D) + (D -> E)
Move object B by the transform (B -> C) + (C -> D) + (D -> E)
etc.
See the attached definition. The bulk of the work is actually in finding the individual transforms - once you've got them, composing the compound transforms is pretty quick.
Hope that helps - let me know if I can clarify anything!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by