Interacting trees with different paths

The question about interacting Trees at some component. In the appended example are two trees the first is the tree of curves with paths of one bitness ({0}, {1} etc), the second one contains length data with paths of two bitness ({0;x}, {1;x} etc). As I know if I want the curve which has a place for instance in placeholder {0} interact with all elements of the second tree in the placeholder {0;x} I have to flatten x level (employing Trim tree for instance). But, in my purpose, I must adhere to the structure of a path of two bitness ({0;x}, {1;x} etc), thus I need to group flattened elements using the Path mapper component, and all are processing great, but there is one annoyance I lose the flow, every time when change quantity of flattened elements I need manually change the number of group elements. Is there another logic (maybe using the power of scripting) to keep it in flow, without flattening and grouping back? (13.1 KB)

In general via code you can do anything imaginable (way more complex stuff than the one in this thread - like nested LINQ queries etc etc). If you are in the C# bandwagon, notify for a small demo.

Yeah, but I am still heavy at using rhino scripting syntax. And wondering about standard solutions at first

Forget that one (in fact … the only thing required is knowledge about dealing with DataTrees [and that is NOT a R SDK thing]). Given the opportunity list here some “freaky” queries - just for the fun of it - as well (i.e. I want to find/classify/organize cats who are talking to dogs and they are pink and they ride a Ducati while the dog is riding a Honda … etc etc).

But hope dies last: let’s wait for a good Samaritan who can address this with native stuff … and if not … have faith to the Dark Side.

Okay, I will try to write the script)

Tip: in general, if you have things with, say, some properties (anything imaginable related with your Curves [static or dynamic]) is highly advisable to declare a custom class, say: CrvInfo, populate a related List (say CrvInfoList) … and then just do any P/LINQ query that comes in mind. If the List is public … you can do something like this:

var query = CrvInfoList.Where(x=> FindSomething(x, … , …). OrderBy (…). Then By(…). ToList();

For instance: find planar curves that yield 4 ccx events with 4 others, have Length in this Interval, are Open, and yield 3 self ccx events … blah, blah.

This is the orthodox way to cut the mustard, mind.

1 Like

Thank you the highly valuable tip

So BEFORE anything … declare the right class (or some more for fun) for the scope and post here the C# (ncluding how the custom type List is populated from your Curves, or cats, or dogs etc etc).

Then it’s just a matter of LINQ (very easy or BIG nightmare depending from the point of view).

As far as I know, and if you have the same number of items in your modified tree, you could use Unflatten Tree. (20.5 KB)

1 Like

OMG! Shame me, I definitely forgot about the functionality of the Unflatten component

BTW: Here’s the tip with some lines of C#: assume that you have some curves derived from some bike CAD models (i.e. they belong to a Panigale or a Blade … etc). How to order them in space with Ducati on top? (obviously). That sort of stuff. (147.7 KB)

1 Like

Oh, huge thank you!