Grasshopper

algorithmic modeling for Rhino

Hello all, I am hoping someone could help with what I am trying to achieve here.

The definition arrays progressively rotating blocks along a curve, packing them tightly.
To do this it takes a "block 0" and performs a polar array. It then takes the index 1 item of the array and arrays it along the path very densely and through a collision check it only keeps the first item of the list of the arrayed blocks that do not collide with block at index 0. It then merges index 0 and 1 for the next collision check and runs again with index 2 and so on and on and on until the whole curve path is covered.

I have managed to achieve this by means of copying and pasting part of the definition over and over but surely there has to be a better smarter way.

I looked into hoopsnake but I am having trouble understanding how to use it in this context. Any help/pointers to useful tutorials on recursive definitions would be greatly appreciated!

 

Best

Gio

Views: 1632

Attachments:

Replies to This Discussion

Anemone: http://www.food4rhino.com/project/anemone

And read other Q/A threads on the same question: iteration a specific number of times

Thank you!

I looked at your code and would strongly suggest that you find a better algorithm.  The one you have appears to be profoundly inefficient, placing 1000 bricks along the curve and checking for collisions when anything further away than one brick length will never collide.

I'm not sure how to do it myself but will give it some thought.  I used Anemone only once and don't remember how to make it work...

I would think along these lines:

  1. rotate one brick twelve degrees.
  2. move that brick along the curve in small increments until it doesn't collide with previous bricks.
  3. repeat

But that might require two loops, one nested inside of the other?

Thank you Joseph, am I correct in saying that this would require boolean operators? I will look into that, haven't approached them yet.

best

Got it!  Or at least a good start - might need some refinement...  Anemone is VERY COOL!  Great tutorial, great piece of code.

I used two loops, one nested inside the other.  A few key points:

  1. Like 'List Item' and some other components, Anemone is able to accept multiple data inputs ('D0', 'D1', etc.) using the "+" sign (zoom in to see it).
  2. 'Loop End' on the inner loop must be configured (right click) to "Output after the last".
  3. I got stuck for awhile because I was using 'D0' on the inner loop as geometry input to 'Orient G' when I needed to ignore that and use 'Rotate G' directly from the outer loop.  This is a little tricky to understand...  I need 'D0' as output from the inner loop and as input for the outer loop, so it is passed directly as 'D0' output from the outer loop too, but must ignore it as input for the inner loop.  This is crucial!

P.S.  Curve is internalized, no need for Rhino file.

P.P.S.  "boolean operators"?  To terminate the loop?  Yes.

Attachments:

I belatedly realized why my first effort above (incrementing the 't' value for a reparameterized curve) had poor spacing between the bricks; I made the same mistake with 'D1' that I explained in '3.' for 'D0'.  I needed to use the "global" 'D1' from the outer loop as input for 'A+B' instead of the "local" 'D1' from the inner 'Loop Start'.

This is a fairly subtle point but again, IMPORTANT!  Hope you can see why because it's not easy to explain...

Attachments:

Here is a variation on the same idea but instead of incrementing the 't' value (zero to one) for a reparameterized curve, it uses 'DivLength' to divide the curve into equal length segments which results in a list of points.  That list is then used as the basis for 'Orient', resulting in what appears to be a smoother and "tighter" distribution of bricks:

Attachments:

And one last (for now) refinement, strictly cosmetic.  Instead of counting on the outer loop 'Record data' feature (right click 'Loop End') to obtain the list of bricks, this one adds a 'D2' input/output and builds the list explicitly with 'Ins (Insert Items)'.  This keeps them visible while the loops are running instead of just flashing and having to wait until it's done before seeing them all clearly.

Attachments:

Ha ha wow!! Thank you so much! I'm going to be busy for a while figuring all of this out!

Truly, thanks a million!

best

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service