Select data from a tree in the same order as items in mask

Hi,

I have got the following challenge:

  1. There is a data tree (A.) which contains a lot of data

  2. I would like to retrieve data from (A.) using a panel (B.)

  3. The panel (B), can consist of multiple items ánd items which describe multiple items (rules) e.g. {0;0;1 to 3} --> {0;0;1} + {0;02} + {0;03}

  4. It is essential that the output C. is in the same order as the panel (B) order. so
    B.0 = C.0
    B.1 = C.1
    B.2 = C.2
    etc.

I have tried the following commands.
When using the split tree command --> the order of items input = output is NOT in order
When using Tree Branch command --> the order is correct, however I cant use input rules

Is there anybody who knows how to solve this problem, or combine the benefits of these commands?

Thank you very much! :slight_smile:

See the GH file attached, many thanks! :slight_smile:Split data data tree command.gh (34.6 KB)


Tree Branch.gh (8.8 KB)

Had to give this one a little extra thought!
The problem is that once you use Split Mask, you lose any way of identifying where each item came from (ie. the order you want to preserve).

So my (not very elegant) way of getting round this, is to do each one of your inputs one by one, in an Anemone loop, and build the list like that.

I haven’t made the output exactly as you wanted it, because I thought it might be more useful to know which input produced what result (ie. input 1 is at tree branch {1})

Hope that helps, let me know

200406 Split data data tree command.gh (45.3 KB)

Hi!
Haha thanks again! It looks like it does the trick!
However, when I try to open your file, I got the message that I dont have the Anemone plugin. (also after I downloaded the plugin and put it in the component folder), which version of anemone do you have. latest version is from dec 2015 correct?

Regarding the solution, the only thing that I am a bit scared of is that it would make the script slower because of the
iteration. But lets first find out! :slight_smile: Below is also my ‘Work around solution’ but really whant to get rid of/ugly and limits the number of inputs. :slight_smile:

Thanks again!


image

It might be that you need to unlock the files first ( right-click > properties > unlock > accept ), have you tried that?

In terms of speed, it only iterates as many times as inputs it has - in a way, it’s doing exactly what your solution is doing, except the Bang! can stretch dynamically to however many inputs you have. So shouldn’t take longer (or at least in a way that you could perceive)

One thing I would mention, since I notice the blue background in your screen capture, is that I’ve never managed to get Anemone working inside clusters…

Hi!
Thanks again :slight_smile:
ahh haha, you are right, long tima ago since I added a new plugin, sorry for that :sweat_smile:.
It works and its fairly quick/ acceptable.
haha but thanks for you latter comment, because in the end it will definitely endup in a cluster component… And you are right it is not working anymore somehow :expressionless:.
So there is still a challenge ago :sweat_smile:

I just had an idea!
Maybe with your help we can finally solve it!
Idea: Lets split the problem in half:

1st. half: ‘Translating the input rules’ into single lines, using the split tree command, against a ‘virtual/dummy list’. whereby the list consists of items with identical names as the tree branches*
This way, the command retrieves all the branches (with the correct commands)

2nd half: because we have now all the ‘single/simpel’ command, the tree branch command (renumber) can retrieve the items ánd in the good orde!

only question:
*Do you know how to make a Dummy/shadow list, whereby all the branch names are also there as list item?
something like the flip matrix command/ deconstruct path branch, but thats not doing it.
Have you any suggestions?
Thanks Again!

Sorry, just came to the conclusion this would work eater, because the order of ‘simple command lines’ after the split tree command is ofcourse still not correct, sorry :sweat_smile:

I don’t think the dummy list would help (but I’ve absolutely used them in the past: Tree Statistics > Unflatten Tree, is my tip :wink: )

The underlying problem is that you want two different ‘features’ from two different nodes;

  • you want the lexical rules from the Split Tree component, and
  • the ‘renumber’ function from Tree Branch…

And the only way of doing both, is by doing them one by one, in the loop!

I would suggest:

  1. cluster everything except the two Anemone nodes? If that’s acceptable in your script
  2. Keep adding outputs to your Bang! solution, to a maximum number of inputs you ever will need to use… (I promise not to tell anyone)
  3. Get someone to code it for you. I suspect this isn’t too hard to do, but is out of my coding knowledge, unfortunately…

Hi!
That summary is spot on.
I did option 2 :expressionless:
It is workable and I will put it away in a Cluster anyway.
But still doesnt feel good.

Anyway lets try to forget :sweat_smile:.

Thanks for your help, learnt a lot, that is for sure/and very important!

Thanks again! :+1: :+1:

1 Like