Tree problem: Add empty branches to list to match other list

Alright, I found a bug in one of my definitions and I need to match the data tree of the bottom list to the one on the top. Meaning that if there is a branch missing in the bottom list in comparison to the top list (like {1} and {3} in example below), it should create the same branch in the bottom list but without anything actually on that list.

How do I add empty branches to a tree to match the other tree?


190930 Tree matching.gh (8.3 KB)
Thanks!

Oh! And preferably no plug-ins, if possible!
I found a solution on this page using tree sloth which does exactly what I need but Iā€™m trying to make the definition not require any plug-ins.

This could be one way without plugin.
Canvas%20at%2005%3B10%3B24

4 Likes

missing


Tree_matching_2019Sep30a.gh (11.1 KB)

1 Like

Hereā€™s a little more flexible Python recipe that letā€™s you declare a list of desired path that you want to add. It works just like inserting an item into a list.

190930 Tree matching.gh (6.4 KB)

1 Like


Tree_matching_2019Sep30b.gh (11.6 KB)

2 Likes

Thanks @HS_Kim, this might be the easiest and flexible solution for my problem.

@Joseph_Oster I believe Suirify is a standard part of grasshopper1 in Rhino6. Thanks for your solution, though it would require manually adjusting the entwine component if the input changes.
Oh, I just see your second solution now, that could work as well, thanks!

@diff-arch Thanks! Iā€™ll have a look at your python script just for curiosity, but think the other solution might be easier for my purpose.

1 Like

I believe Suirify is a standard part of grasshopper1 in Rhino6.

It is and it rocks! :smiley:

Suirify, hah! :laughing:

I doubt you can find a simpler, more robust, no-friggin-plugin solution that works in both R5 and R6. The errors from the red Branch component are logical and expected:

  1. Path {1} does not exist within this tree
  2. Path {3} does not exist within this tree

Cheers

Tree Stats didnā€™t exist in R4, why you leave out R4?
Capture

2 Likes

Donā€™t feed the bears Michael. :bear:

@Michael_Pryor has been trolling recently, defending the use of a bloated plugin for nothing more than ā€˜X+1ā€™. Now you too? Grow up kids.

your consistent posting against plug-ins isā€¦often distracting. Now, I should take my own advice.

I highly doubt anyone downloaded it just for X+1, it just happened to be there and the user either didnā€™t know it was from the plugin when they used it in their definition or found it mildly convenient. Truth be told some of those smaller ā€œutilityā€ components I add for my self because I donā€™t like repeating the processes, in one update I went through and removed a bunch of them (30 or so) and got many complaints to add them back, so I did. They are not at all the core or main use of my plug-in but people seem to like them. At the end of the day I donā€™t care what people use to do what they do.