Grasshopper

algorithmic modeling for Rhino

Hi

is there a cycle operator in GH? Another words. I need to create a number of circles drawn one by another tangented to previous ones.  And I also need this cycle to be repeated on defined curve segment only.

Here are some pics

Is there any way of doing that correctly? thx

Views: 6182

Replies to This Discussion

Are u trying to ask for Recursive, Iterative  process ??? Yes, can be done using plugins like Anemone and Hoopsnake. On a little advanced level scripting. 

Thank you Shridhar!

That's what i'm looking for. I'm only in the beginner level in GS and not really good in scripting at all. So I'm trying to find a kind of readymade solution. Gonna try those plugins today... Thx

That's what scripting is for, here being a distillation of a Python script I found by finding the command TryFitCircleTTT in the Rhinocommon.chk help document and Googling it to discover a Rhino Python script not made for Grasshopper and full of silly error checking. Hey, if it fails, you'll know it anyway, so I stripped that crap out.

I hate how long it still is and wonder what all the fuss is about for so many cases that must need tweaking, which I labeled A to E:

The command TryFitCircleTTT requires three hint parameters just like the equivalent Rhino command itself when you use it, and these parameters are formatted from 0 to 1 for how far along the curve you have selected as your point.

A former thread on this question did have an all Grasshopper solution:

http://www.grasshopper3d.com/forum/topics/tangent-circles-between-2...

Attachments:

Thank you Nik.

I'm definitely meant recursive operations in common. Not only with circles. You know the scripting for me is like chineese arithmetic. Moreover I hope those kind of operations are so frequently required and the good people are have those scripts already made for sharing :)) 

By installing the Python plugin my script becomes just another Grasshopper component you can use, and being Python, it's much easier to understand and thus modify than the usual C# ("c sharp") or VB (visual basic) code that also being in lots of cryptic baggage. To use the language it's quite easy just Googling the word Python with whatever question you have about how to do a loop or make a list etc. You zoom way in in Grasshopper to add inputs/outputs and there's right click options for inputs, especially a submenu telling it what type of data or objects are being passed. The biggest learning curve is learning to figure out Rhinocommon commands from their help pages in Rhinocommon.chk.

Do post it if you get a loop to do this task since it's not obvious to me how that would work, since you aren't just cycling numbers but brand new circles. I'm certainly curious if it can be done with a Grasshopper loop. Anemone breaks the loop into two components which can give a less confusing layout than Hoopsnake.

Sorry, a line went missing as I made a cleaned-up screenshot, namely this line after "import Rhino":

import scriptcontext

Attachments:

I refactored that code to make it clearer and shorter.

Attachments:

What you call "refactored" as a chemist I call "distilled" and thank you, I just knew it was possible to fix that ugly beast but I could barely figure out what the original author was up to, even after stripping out hoards of bizarre error checking. It's now twice as fast too.

Here is the whole Grasshopper file, which now being both short and in Python, most people can modify at will.

Attachments:

This is an example of how to make circles between two curves using anemone. It is not the right way for this purpose, but I think that's what you were looking for.

EDIT:
B.T.W! I just saw on your profile you are in the jewelry sector, this problem is due to gems between two curves? If so, Peacock already has a component for this purpose.
http://www.food4rhino.com/project/peacock?etx

Attachments:

Great! Thanks! 

That's the jewellery problem!  The Peacock Rocks! Diggin' in deeper!

PS: Already got crushed rhino ^_^ 

Peacock "Gems by 2 curves" has an input that seems to require you specify where the gems are instead of having them placed automatically by packing, and nothing outputs if I clear the default values that offer an even spacing of 11 gems from 0.0 to 1.0, and though the Anenome script works it is not as robust to various shapes and sometimes just stops at some point even on mellow curves:

The Hoopsnake script in the other thread: Hoopsnake doesn't want to appear multiple times in a document since resetting one resets them all and it only runs the first instance when I pasted two more copies of the whole script in, so I'll do them separately, and instead of an input reset wire, there is a right click Reset All item in the pop-up menu.

I understand now how the two looping components work, in having a geometry input for the first item, then they accept a second item input as new geometry that then gets looped as the new geometry replaces the original. What a great hack, so I was wrong above about only being able to loop numerical values.

Since I really like Anenome better due to its nice interface, I've converted the old thread Hoopsnake program to Anenome. It still won't handle multiple curve pairs, so I made copies of the whole script.

I learned a lot today. Thanks guys. Given how well these straightforward scripts can work, I'll bet there's a much shorter Python version possible, one that most anybody could understand and thus adapt. If I have time I can start again this time from scratch. Converting the long one taught me about the problem though. Grasshopper makes it easier though, since Circle TTT only needs one center point hint whereas Rhinocommon TryFitCircleTTT needs three.

Attachments:

that was a week of hard brainwork. but i got it made!!!

So, the aim was to have..

1. Gems roadlike setting using only 2 curves.

2. The curves non complanar and have 3D rotations.

3. All the gems have defined size from a list of available sizes.

4. The gap between gems is controlled.

5. Prongs are placed among gems and totally controlled. 

Keep on working on algoithm to make it more universal, controlled and bugs free. 

Thank you guys for showing me THE WAY! ^_^

Here is the subject to discuss. Maybe someone finds interesting turns in my logic. 

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service