Grasshopper

algorithmic modeling for Rhino

Hi guys,

I haven't been able to get rid of empty items in this list although i tried using clean, null item or dispatch...

Any idea what else i could do?

many thanks,

Arthur

Views: 15581

Replies to This Discussion

Hi Arthur,

zero is not the same as null. Zero is a perfectly valid (and rather common) number, whereas a null is a lack of a number.

If you want to remove specific values from a tree, you should create a cull pattern that is FALSE for those values and TRUE for everything else. In this particular case it should be easy, because when you feed ZERO into a boolean parameter it is automatically converted to FALSE, and anything else is converted to TRUE.

Oh wait! That's not what you meant. You want to remove empty branches from a structure. You have to use the Clean component for this and make sure you set the [E] input to True:



--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thank you David, it worked but i am a bit confused:
Empty branch is not the same as null?
No,

An empty branch contains no items, it has no room for any items. If it had room (say N = 3), but it did not contain any values, then we say it contains 3 "null" items.

The Clean component can remove both null items AND empty branches.

--
David Rutten
david@mcneel.com
Poprad, Slovakia

What about when you have "<empty>" as an item inside of a list? I see that is not considered empty, right? Neither is that considered null.... tried both already....

 

how would you get rid of those values?

 

Thanks!!

D.

<empty> means you have a string (text) there with no characters. Basically "".

 

You can remove these like you would remove any arbitrary piece of data, using culling operations. You can use the String Length component to find all zero-length strings, then cull them accordingly.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

David

I am trying to do this:

"If you want to remove specific values from a tree, you should create a cull pattern that is FALSE for those values and TRUE for everything else. In this particular case it should be easy, because when you feed ZERO into a boolean parameter it is automatically converted to FALSE, and anything else is converted to TRUE."


but I am not sure how to feed the "P" value for the cull pattern.

Should I feed it with a expresion?

Thanks!

Should I feed it with a expresion?

Yes and No. You need to generate a culling pattern of Booleans i.e. 0's and 1's or TRUE and FALSES

 

To generate this pattern you can either use [Equality], [Similarity], [Larger Than] or [Smaller Than] etc. see below for example. Say you wanted to cull everything that was not greater than 0 (-ve)

Of you can add an more complicated expression with the Fx component

thank you man! you are always saving my ass! :)

I could really use a "cull if null" button on the output rightclick menu of components. Not sure if it is a general enough request, though.

although this topic is rather old, here is my way since it took me some time to realize that:

you can just use "text length" and "cull pattern" as David already mentioned. Although Cull Pattern works with Bolleans (True and False) you can also input numbers - everything with the value of 0 will be taken as False and all other numbers will be taken as True.

This means every data with at least a String (or Text) length of 1 will stay while all empty data will be removed.

Attachments:

and 5 years later :) Thank you for this one .)

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service