Remove empty items from lists

These critters are as pesky as Nulls, there should be specific commands to get rid of them or to replace them by a some value, or maybe adding this as an option to “Null item” and “Replace Nulls”, like what is done with “Clean Tree”.

I know about using textlenght as a hack to do this, but it is just that : a hack.

2 Likes

I’d like to see this option too.

Another hack could be to replace empties with nulls, and then replace using the usual methods.

EmptyToNull.gh (5.9 KB)
image

Uhhh, clean tree component has a remove empty input. Make it true. :smiley:

I thought the idea was to replace empty items, not just clean.

there should be specific commands to get rid of them or to replace

Get rid of is stated.

Additionally, I might be wrong about this, but I think replace nulls also can replace empty by just plugging that list in without the python. Not at a computer at the moment. Could be terribly wrong.

Oops. I focused on replace, since clean already gets rid of empties.

I tried replace nulls for empties, but it doesn’t seem to work…unless I’m missing something.

1 Like

Then I probably just imagined it.

@Michael_Pryor

Neither Clean tree or Replace Nulls has any effect on Empty Items. It does not consider it an empty branch with the clean tree as it has an item. And null fails as they are not nulls.

Note: This is tested in GH for V6 not V7

2 Likes

Well damn. 0/2. Could have swore I did this before, guess I just don’t replace nulls / empties enough.

I was pretty sure I had done this too. Guess it’s just empty branches, not empties themselves.

Hi all,

It’s funny that, when requesting for GH enhancements, I often get a whole bunch of suggestions of workarounds.
I know them. I use them. It’s just that I think these issues deserve a proper GH tool, so basically, this kind of message is mainly targeted @DavidRutten

In this precise case, I would not care if “Null”, “Empty”, “Void”, “Nothing”, “Nada”, “Rien du tout” were treated exactly alike ; just like “Deceased”, “is no more”, “has ceased to be”, “bereft of life”, “rests in peace” and “Late” are the exact same thing : the goddamn parrot is dead for Pete’s sake !

4 Likes

It’s funny that, when requesting for GH enhancements, I often get a whole bunch of suggestions of workarounds.

Please don’t take workarounds as a fight against not having the feature. We simply try to offer what knowledge we can to aide in the meantime. Of course everyone wants these features. But if it is targeted just to David and you don’t want to open it to discussion, discourse does have a direct message feature.

Michael,
I am mostly hoping for others to weigh in on my request, you know… like is customary in forums.

BTW, I did heavily insist in my initial post that I did not care about workarounds :

I know about using textlenght as a hack to do this, but it is just that : a hack.

I formally agree with the request. Better? :grinning:

For what it’s worth we don’t know what hacks you know except the one you mentioned. I genuinely thought those components removed empty already and you might have over looked it.

OK Michael… but you nearly made it to my black list :wink:

1 Like

In this precise case, I would not care if “Null”, “Empty”, “Void”, “Nothing”, “Nada”

I agree there should be a case for empty, but I don’t think you can group null and empty, I think it should be different bools. Empty means there is no data (list length is 0). Null has data but it can’t be used (list length is 1) like a null mesh can still exist, you just can’t do anything to it (like baking), but you can actually fix it after the fact to be not null. For this you have the actual programming languages to blame. :grinning:

it does remove empty branches, but an empty string is not the same as empty branch, because it equals ""

1 Like

OK, but then why is a branch full of “Empty” items not considered as an empty branch by “Clean tree” ?

I guess I don’t have a programmer’s mind…

The list length is not zero, as Michael Pryor mentioned. It contains a list of empties.

The clean tree will only clean purely empty branches.

I agree though, it would be nice to have this option on the clean tree component. Clean empty items, and clean empty branches.

image

This is where common sense breaks down in front of algorithmic logic.
In my Neanderthal mind, a set full of empty items is just an empty set.