Grasshopper

algorithmic modeling for Rhino

Here's the problem I'm trying to solve: I have a list of radii, and an arbitrary curve. I want to draw circles of those radii along the curve, centered on the curve, such that the circles touch exactly. So in effect, I need to convert the curve to a polyline, with the vertices on the curve (those would be my circle centers), and each successive chord length would be the sum of the last radius and the next radius.

 

My normal strategy would be to draw a circle of radius = lastr + nextr, intersect it with the curve, then use that for my next center, and repeat.

 

The trouble I'm having is that I can't know the next circle center until I've found the last one, so I somehow need to feed back in the information from a previous calc, crawling along the curve. But Grasshopper abhors recursion.

 

Is there a way to do this in Grasshopper? Or do I write a script? Or is there a cleverer strategy to do this I haven't thought of?

 

Any thoughts welcome.

 

 

 

Views: 365

Replies to This Discussion

Garcia del Castillo has done something very similar to this with the new Hoopsnake recursion component. See here for examples: http://www.grasshopper3d.com/video/hoopsnake-tests. I think you could easily modify his definition to let the radii come from a list rather than being consistent.

 

I was going to make the same recommendation.  I haven't checked out Hoopsnake myself yet, but the examples I've seen suggest that it is a great place to start for your problem.  The only thing I would add is that because you have to generate the radii consecutively (not all at once), you will definitely have to include any of the components you are using to generate radii within the Hoopsnake recursion loop.  Maybe when I get a minute I'll give it a shot myself, sounds like a fun way to get to know Hoopsnake.

Thanks for the recommendation, Hoopsnake looks excellent. I went ahead and wrote a script anyway, as a learning experience (I have a programming background, but know very little about rhino and grasshopper internals). Here it is, in case anyone else finds it useful or can learn something from it. Just a C# component that takes a curve and a list of diameters, and finds the points on the curve that are the circle centers.

 

Now I'm off to look at Hoopsnake...thanks again.

 

Dave

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service