I’m trying to make a recursive solution based on a layerlist content. Since each layer could have many objects, I’m trying to fire them using a timer for each entity and record them. After counter for each layer achives its lengh, increase +1 using anemone, and staring over and over, until it reaches the lengh of layer list total count.
I’m trying to accomplish this because I don’t want to duplicate the solution fifith times or more for each layer.
It’s not working on anemone adding my initial list (always 0) to the next (1, 2, 3… lengh total).
Also the timer stop working after the first fire. Is it possible to make it again for each time?
I want to get geometry from rhino through my layer list. But I can’t do this getting all of them at the same time, I need to get one by one using a trigger timer. So, after getting the content of layer A, I move to layer B and so on…
That is just a simplified example. My major concern is how to perform a recursive solution just by adding a counter. I know it not possible to to using only grasshopper, so I choose Anemone, but it’s not working.
no worry,
but it is still not clear to me.
Maybe you can elaborate what you want to do after getting the geometry in GH(which is easy doable for example with human or elefront-without recursion)
Get the layer content isn’t the problem @Baris, the main issue is how to perform a layername selection on by one. Why? Let me give you a better example, I want to subdivide each polyline using the definition attached. Since the subdivion work using a surface, it only could be done one after another. So that’s the reason I’ve take a timer. So my listitem component can take each number by another from by layerlist content lengh.
If I dont do this, this definition will never work. OR I should to copy the entire definition for each layer. If I have 50 layers, imagine how this document would be crowd and not efficienty.
I’m currently reading through your script and can’t quite understand what is the purpose.
From what I see, the issue is having a loop inside a loop, rather than smart use of trees.
Based on what I can execute, it is a packing algorithm of some sort, so I don’t understand why each surface can’t be treated as it’s own object, run with a flat list and then using partition list to make it back into the original tree shape?
The way of the subdivision logic was designed it just accept a single surface. If I have a set of polylines, it doesn’t work. So I need to figure out a way of recurse my ListItem component to retrieve my list of indexes one by one.
Here is my take on it:
Exiting without outputting the final surface in the inner loop
The inner loop needs to be redone, but it will atleast calculate everything. loopLayerCount2v2.gh (70.2 KB)
When you flat all layers and fire them without giving time to function properly subdivide the polyline you risk yourself having wrong subdivisions as you see in your take.
I imagine the best way to solve this “breath time” it is to “read” one layer by another and firing each polyline using a timer. So if I have 5 polylines in first layer, and my timer is set to 500 miliseconds, the definition has time to process each one without errors. When timer reacher the limite (list lengh), it move to next layer and so on…
Why does it take time to subdivide? I read it in all at once.
The problem is the exit condition of the inner loop is not right and the merge I used to join was done wrong.
Oh yes, totally! But in my case I need to give a timer for my definition “works properly”. I can’t handle my input as individual unfortunately, it need to be in parts.
Not actually. They only need to be in the same branch (layer) as the beginning. For example, the polylines of layer A as result into 9 subdivision, so these 9 polyline as to be stacked in the same branch (layer correspondent).
Much easier to loop through a flat list, hence I flattened it first and then regrouped it based on the initial tree. It was just a mistake with the maximum loop iteration and adding the result to the wrong output.