Hello,
How to delete the last X number of items from the entire tree, regardless of which branch it falls, while keeping the tree structure (without flattening)?
delete last items in tree.gh (16.0 KB)
Thanks,
Hanan.
Hello,
How to delete the last X number of items from the entire tree, regardless of which branch it falls, while keeping the tree structure (without flattening)?
delete last items in tree.gh (16.0 KB)
Thanks,
Hanan.
But your list of points is flattened, no branches at all Poor data set for the thread title and description. Hidden wires are useless. What does Point Groups have to do with this?
It is a small part of a large code that I am updating, but the point of the grouping is to collect the closer points into a separate list in the tree. this is similar to the structure I have in the code.
Now I wish to reduce the number of elements, for example, to 1125 (from the current 1150), but I want to reduce the extra 25 (for example) from the end of the tree while keeping the structure as it is. I cannot do it before the grouping in the full code.
Is that clearer?
This code deletes the last branches in the tree, which isn’t quite the same as items.
As you can see in this image, if the number to delete is 30, 5 items must still be deleted from the last branch.
Looks promising (: Thanks!
Hi Bensho
Here is another solution. Maybe a little simpler. Also, It will preserve the Data paths as it was inputted. You just need to graft the tree and delete the last N branches that you want. Then use the Shift_path to return to the original structure.
Thanks it seems to work fine!
Oh, that’s simple and really cool and smart use of Graft.
And I managed to keep the deleted points as well.
Cheers, Daniel. Thanks.
I was going to say that keeping the deleted points might be easier with @Danial_Keramat’s solution.