I’m trying to write something that removes the last item from various different branches, but am finding it difficult. I’m not quite sure ho
w to go about it as the number in each branch could be different each time.
Sorry that I’m not really explaining this very well but I’m still trying to figure out branches. I basically want to remove the top surface from each of the three stacks. I’ve managed to simplify and split into the three piles, but now I’m not sure how to remove the top item…
I feel like this is a very simple fix so feel kinda silly asking, but how do I now take this list of untrimmed surfaces, minus the last, and bring them back in as actual geometry the same as they started? As I mentioned I’m sure it’s incredibly simple to do but I’m just not seeing it…
Do you mean baking gh geometry into Rhino? If that’s the case just right-click on the component and select “bake” (see image below), otherwise try to explain yourself a bit better.
Sorry for not being clear, my Grasshopper terminology still isn’t great!
Basically I have a Geometry component that contains the surfaces, which in this case represent floor slabs. I am wanting to essentially create a copy of this component, but without the top most element in each branch so that I can then feed it into a different script. I am not looking to bake the surfaces, I merely want to be able to see the reduced piles as a grasshopper element and not just text within a panel.
Ok so I was being a bit slow and hadn’t been turning previews back on! I can now see the planes manifested as grasshopper objects, except the bottom plane is the one being removed. Is there a way to reverse the order of the branches so that it removes from the other end?
Alternatively, if there is a cleaner way to carry out this seemingly simple procedure, I’d love to hear it please!
P.S. I hadn’t even bothered to look at the geometry until you mentioned turning previews back on… Now that I have, I’m really confused??? I see three stacks of surfaces but…???
AHA! Now I can see it. If you want to remove the bottom of each stack, you need to remove the first branch of the tree after PShift:
Hmm, I’m still not getting the correct output, and I think it’s maybe because I’m not understanding the hierarchy of the branches properly. I’ve downloaded your script Joe, but I’m still not having much luck. Rather than remove the top surface as indicated in the image of the original geometry, it removes an entire stack.
See above. Each branch of the tree (after PShift) is one layer of all three stacks. You can see that branches {4}, {5} and {6} have only two surfaces because the short stack has only four layers while the others have seven.
The Split Tree ‘M’ (Mask) input is a little fragile as it will break if the data tree changes; perhaps a good place to use ‘Simplify’, or maybe a wildcard?
While not getting the exact result I was looking for, that last script was very helpful for me to get my head around data trees and branches (and also masks which I’m only just learning about), so thank you! For now I’ll just need to settle with something a little more simplistic that evaluates each size of stack individually.
What’s wrong with it? Do you want to remove the top item in each stack instead of the bottom one? It sure would help if each stack was one of three branches in a data tree, which is what the earlier Shift List version assumed.
Sorry if I hadn’t been explicit. Yeah, it’s the top item that I am wanting to remove. I thought the issue was as a result of each stack having different numbers of items, not my poor communication skills.
I added an extra layer of filtering into your last script to take the top item from the largest script, and then select the specific item from the shortest list. Isn’t perfect, but it’s getting there.
Yeah, that’s pretty ugly, isn’t it… I’ve struggled and failed so far to organize the stacks into three branches (one list/branch per stack) instead of seven branches (one list/branch per layer). Very tricky!
I honestly think that these stacks/blocks of slabs should be constructed in a different way in a very beginning, so that later on it would be possible to gain proper control over data structure. Here is an example below, not necessarily the best way, just an example.
That looks infinitely easier, thanks for the advice. I actually inherited the data tree from someone else and so wasn’t involved in the original structuring of it, but in future will be sure to try and keep things as simple as possible from the outset.