Sort elements from blocks with various element count

Hi,

I’m working with on sorting of blocks by using Elefront plug-in. I’m able to sort the elements inside the blocks, if the blocks have the same number of items. But if I have blocks with various number of elements, I’m not able to sort the elements.
I would like to know how to add empty branch to block (if there is a way) in order to be able to sort the elements inside the block, so they have the same branch index? @andheum or @krahimzadeh any ideas please?

Thank you for your answer.

I’m a bit unsure of what you’re trying to do, but it sounds like this is more of a tree issue than a block issue. For example, in your “Not Sorted” tree, the paths look like {0;A} but in the “sorted” tree, they look like {A;0}. So then you may be getting unexpected results when using “Tree Item”.

I can’t tell from this excerpt whether those tree structures are deliberate, or could be resolved using Shift / Simplify. Any chance you could post the definition so we can get more context about what you’re trying to do?

Hi @krahimzadeh,

my intention is to be able to filter the elements (same type) from the blocks based on its index which is currently not possible due the various element count in each block

sort blocks.3dm (36.1 KB)
sort blocks.gh (20.3 KB)

It seems like you are trying to filter by type, but you want to be able to change the filter using a slider, in which case you can use the solution in the green group below.

Another solution to achieve what you’re after, without using the Filter by Type, would be to use the native Stream Filter component, like in the blue group.

This is also much more robust, because you’re operating on the tree structures directly, rather than relying on the block definition to store objects in a specific order.