Grasshopper

algorithmic modeling for Rhino

I have been trying to populate objects inside a circle with little success.  I am working on some badges that will be laser cut from stainless steel.  There will be little fins that will be pushed out (see laser cut cardboard mock-up). I would like to be able to control the rotation of the object (which I know how to do). I will also need to control the distance between the objects and limit the rotation so there will not be over lap (which I can't quite get). I have been able to get close but only with objects that line up in a grid not inside a circle. 

On another side note I have only been able to do this with closed curves.  The fins that will be cut will need an open end. 

Any help would be greatly appreciated. 

Views: 3086

Replies to This Discussion

An approach you might consider, do a circle pack (see discussions, by Dan Piker, and some others, Nick), the once you have the circles, project the items that you want onto the circles. 

Another way might be to do an arbitrary-shape-pack, (new name needed, that's not nearly cool enough).

You put one into the circle, if it doesn't intersect anything, keep it. Repeat until you get n things, or you fail to place y times.

This is how Chris Williams does circle packing too.

It's slower because it's a really terrible algorithm, but who cares if it takes a minute or two to run!

This requires Anemone ("Fast Loop").  Takes ~10 seconds with 'Count' at 600, ~80 seconds with count set at 1600.  Not packed as closely as you might like...?

  • 'Pop2D' populates a square around the circle
  • the 'Shape' is copied to all points
  • shapes are rotated randomly, plus or minus 'Angle' maximum
  • 'Shape In Brep (ShapeIn)' is used to cull shapes that aren't within the circle
  • 'Fast Loop' begins using 'MCX' (Multiple Curves Intersection)
  • first shape is added to 'D1' output and shapes intersecting it are culled
  • results minus first shape are passed to 'D0' of 'FastLoopEnd'
  • loop repeats until 'D0' list is empty
  • 'D1' results are scaled down slightly (0.75) to leave more space around them
  • 'Explode' results and return only the curved part, ignoring the base line that closes the shape

Attachments:

Thank you for all the help.

I am running rhino and grasshopper on a mac. This seems so much harder that it should be. I keeping running into things that I need to do that require GH plug-ins which do not run on a mac. I think I will install a dual boot partition and try out some of these definitions. 

If anyone has a way to do it with out the additional plugins that would be great. 

Anemone is the only plugin I use.  No other way to do looping.

This morning, I'm thinking it's possible to speed this up by doing the 'MCX' only once, before the loop, then looping through the results...

This is a combination of what I was saying, with what Joseph was saying, but only using python.

It's deliberately minimal, it leaves you to add rotation etc to it.

You can control the density with the patience input. More patience gives denser results.

I didn't make it respect the boundary because it's just more of the same, but it'd be easy to do so, either in python or in regular gh.

It actually runs quite fast!

If you wanted to fancy it up a bit, you could add a random rotation inside the search to see if that allowed it to find a new spot, but it's probably not worth the extra complexity. You can just dial up the input possibilities with much less effort.

Attachments:

That's cool, and it should work on a Mac, right?  Fast too, though I believe I could speed up my version based on what occurred to me this morning (using 'MCX' only once).

Still, since our "client" (Arthur Hash) is running on a Mac, let's go with Python.  I merged yours and mine together and came up with this:

I made your "kerf width" a slider - increased to 2.0 for visibility of the holes (above):

I added a 'seed' input to your Python code so that results can be repeatable.

Attachments:

I appreciate all the help you two.  

I am learning on my own here so all of what you are posting really helps.  Thank you.  

I am trying to pick projects that have problems that I believe grasshopper can solve. I try to do it myself a number of ways with what limited GH I know until I come here.  There are a ton of talented GH users here! My problems are often solved, distilled, tweaked, re-invented and then solved again.  It seems like people are just having fun which is great to see. 

After re-reading the "how to ask for help" rules I realize that my more concise/cut and dry format comes off as me just asking someone to do this for me.  

I am learning.  Again, I appreciate all the help. Thank you.  

Feel free not to help of course. 

-"The Client"

Sometimes it's nice to stop worrying about life's big problems and work on something like badges for a bit ;)

Yes.  Hey guys, I just accidentally clicked the wrong link in the email:

To stop following this discussion...

Oops.  So in case I miss further developments in this thread, contact me.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service