I’ve trouble finding a solution to the following problem:
I’ve got three data trees(not intended hehe) which consits of n branches. These data trees all have the same amount of branches. I want to weave these branches in n seperate data trees like the picture shown below:
I’ve tried putting the leaves of the branches into groups and weaving them together. This solves part of the problem but i cannot figure out how to iteratively seperate the branches into n trees again. Als the trees in this example only has 3 branches, but i would like for the script to work with any amount of branches.
I just noticed that your three data trees each have duplicate branches All branches for each tree are the same Are these point coordinates, by any chance?
Regardless, there are many ways to organize data trees, which is partly why they get confusing.
You might want to look at Num2Pt and Pt2Num.
This is only your first data tree but offers several ways to organize all three:
Yes i’m quite aware that the data is just numbers instead of points. I just needed some quick placeholder data. The real data is indeed points. The group component functions just as well with only numbers apparently hehe. Nice trick in converting numbers to points and visa versa!
But unfortunately its not quite what I was looking for. I want to create a x amount of separate data trees depending on the amount of branches of the 3 starting data trees.
So when i start with 3 data trees with 4 branches each, i want to weave those branches together and create 4 separate new data trees.
For just a few data trees its alright to use the explode tree, but the the amount of branches will be varying and can reach quite large numbers. That’s why i cannot use the explode tree component.
Do you have any idea how to do this with native grasshopper components? Or do i have to use scripting for this?
…it might not be OK to bang it when branches are 250
main point: what are you going to do with those branches that you want to isolate one by one?"
because, for instance, let’s say that you want to move each branch by a different Vector, then the best solution is to create a matching data tree with those vectors, and just apply those simultaneously to your data tree of points
if you really need something like “I want to move points of only branch {3}” then you can move everything else by a {0,0,0} vector (which is not very good practice -of course- if you have thousands of points to be moved by zero, it’s still processing time)… so in that case you might want to Split Tree and merge back afterwards, like:
If this is what you want to achieve, maybe pathmapper is what you’re looking for.
You still have to connect any new tree to the entwine component, and you can leave open inputs empty (to reduce clicks).
It is not so much about the data or the application of the script. I just want to figure out how to do this kind of data tree manipulation. I want to build an adaptive script that could weave the branches of 3 main data trees together with any amount of branches into new data trees with 3 branches each. The amount of new data trees created depends on the number of branches of the original data trees. So this can be 5 branches, which could be done with explode tree or the data mapper, or 500 branches, which become really tedious is working with entwine or explode tree.
Although it is clear in text, i think the example file is not the greatest explanation of what i want to achieve because a lot of people are misunderstanding it haha.
I have the feeling this could be very difficult with native components only, i think i ll to take a programming course in python hehe
Oh yess that will work for a set and low amount of branches, but if I want to sort 3 trees with 500 branches each into 500 new trees with three branches each, than it would become very messy.
Python or not, how do you expect to get “new trees” without separate outputs for each new tree? Not sure if this is a terminology problem or a conceptual problem but I’m more sure now that I made the correct decision to give up on it.
Not sure if I understood exactly what you want to do, but here is something to get you started if you want to try a C# approach. What this does is to take the first branche of each tree and put them in the first branch of the result, then it does the same for the following branches.
The algorithm proposed only works if you have as many tree as the number of branch per tree, but if you’re familiar with basic coding, you should be able to tweek it to suit your need.