Grasshopper

algorithmic modeling for Rhino

Hey guys, I'm wondering if there is a way to extract a series of list items from a multiple tree branch so that each branch with say 6 "flat" items will become (0,1) (1,2)(2,3)... and so on.. as seen in the picture.. the problem is that the tree structures clash together and I can't think of a way to do this..I created a series but it needs to be applied on each branch seperately , otherwise the tree structures don't match.. any idea of a component that does this?

Views: 1594

Attachments:

Replies to This Discussion

Hello kipodi,

"(0,1)(1,2)(2,3)... and so on..." might have two different meanings:

1. (0,1)(1,2)(2,3)...(n,0)

or

2. (0,1)(1,2)(2,3)...(n-1,n)

Cheers,

Nikos

thanx for your reply ( to both posts) basically, I'm trying to extract list item 0,1 and 1,2 and 2,3

and 3,4 (as you can see in the picture I posted) .. the problem is that the lists are not compatible.. if I take just one branch from the list I want to manipulate (point list) it will work.. but when I have many branches it fails.. so I need to do a' for each' operation which is where I"m stuck.. if every branch was flat on its own I could just map each one to a differrent path.. but because it has sub branches , I think I need to add a branch for each extraction.. (extraction I mean getting list items from the point list)

Oh, so you just want the pairs up to 3,4 no matter how long the branches are?

How about something like this then?

YOU GOT IT.. the end result is what Im looking for.. but imagine the data recorder gets a differrent list  list every itteration. I want it to create an extra branch to store each itteration.

so you can't connect the entwine manually.. it have to be outcome of the itteration.

itteration1:

[ (0;0 , 0;1 )( 0;1, 0;2) (0;2 , 0;3)]

itteration2:

[ (1;0 , 1;1 )( 1;1, 0;2) (1;2 , 1;3)]

itteration3:

[ (2;0 , 2;1 )( 2;1, 2;2) (2;2 , 2;3)]

As I told you in your other post you will have to upload your definition if you want to get some help. You can't expect people to imagine what you are trying to do, or to have someone who will do your entire work step by step, with new information coming up at each step.

right on.. I simplified the problem to a gh definition of something more clear (hopefully).. I am not certain that I need a loop, perhaps its a data tree manipulation which is one degree higher than my current tree editing knowledge..

I appreciate the help.

Attachments:

Hello kipodi,

There is no loop involved in your definition. 

So, depending on what you actually want (you have told me 2 or 3 different things by now), one of the 3 definitions I posted will do the job.

1. If you want ALL the pairs of your list, INCLUDING the pair (last item, first item) you can use the first definition (this is what you do in your file btw).

2. If you want ALL the pairs of your list, EXCEPT the pair (last item, first item) you can use the second definition.

3. If you want the pairs from (0,1) until (3,4), NO MATTER how long your lists are, you can use the third definition.

And yes, there is some basic data tree manipulation involved in the definitions. That is why the output has 2 levels of branches {A;B}, with A being the branch number of your original list of points and B being the number of pairs you want.

thank you very much, the third one performs the task for this given operation. my generic question is weather this operation can be performed  by taking the definition that works for one branch and say 'do this for each branch' without having to make local adjustments, and without regard to the number of items or branches.. sort of like a 'for each' programming command, only in grasshopper. I would assume it adds an extra branch for each branch and stores them together in the same list.. is that so hard to do? it seems only logical. Im not a programmer so maybe my syntax is somewhat lacking..  :) I just feel that this option would give a user a lot of stregth inside grasshopper as I often find myself achieving an operation for a single branch but when I apply it to  multiple branches I have to think of a whole new ( and more complex) logic. sometimes I just make a loop using the itteration counter to create new branches and store each itteration in a differrent branch (this only works if the branches are flat) otherwise I run into the same problem as in our case .

The thing with GH is that it doesn't support loops inside the definitions (at least without a plugin). If you search the forum for "loop" or "iterations" you will find a lot of discussions about why and how...

So, keeping that in mind, when designing a gh definition you always have to keep track of the data structure and anticipate where you might have a data tree instead of just a list or an object, and prepare your definition accordingly.

The safest way is to set up your definition for data trees and then it will work on a single list as well.

As for loops, I believe you should use plugins (like Anemone or Hoopsnake) only when you actually have an iterative process, where the result of your first pass needs to be brought in again and take part in the second pass, and so on. Btw what is the "iteration counter" and how do you "make a loop"?

So, yes, data manipulation in GH is a pain in the ass (until you get familiar with its logic) but imo it's worth it if you consider that it provides an opportunity for non-programmers to program!

cheers,

nikos

thanx for the explanation :) as for how to make a loop, I use the itteration counter  from hoopsnake,, and make an itteration for each branch number which is n+1..(starting at -1) so first is branch zero, then branch 1, then branch 2 and so on..   each itteration is being recorded to a differrent branch with the path input from the flatten component..

but again.. to assign it to a branch I need to flatten it which is a pain.. I wonder if there is an 'assign to path' which doesn't require  flattening so that it just creates a new branch infront of the old structure. so 0,1 will become 0,0,1.(without path mapping)

I can't exactly get the picture without an example file but have you tried Anemone plugin? I believe it has a little better functionality regarding output data structure.

I just uploaded a question about a simple manipulation of adding a branch.. once I solve that , the definition will be complete and I will post all of it.

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