Stream Gate to identify Text and allow values accordingly

Dear all,

Is it possible to use the Stream Gate option against text? For instance, I want to connect it to a panel that can have two text strings (mm or m) against millimeters and meters so if the input is mm, it will allow a value of 1000 and if it is m, it will pass a value of 1.

Could you please help me in this? I will highly appreciate it.

Thanks a lot :slight_smile:

Hi @UsmiH ,
not sure if I understood correctly, but you could use a value list component.
Something like this…


Gate.gh (6.0 KB)

1 Like

Aewsome. That is so cool. You understood perfectly. Thanksss

Why not just use the Value List to output the number? You could just do

mm = 1000
m = 1

in the value list and it will output those numbers.

I understood it so, that the actual value of the “1000” might change… So the value is not hard coded.

If it’s just either 1000 or 1, then yeah…

1000 is just an example. I have to use stream filters at various locations so 0 and 1 provide me more flexibility to let only values corresponding to 0 or 1 stream. So, the idea is clear for me now and I can adapt it according to my script. Thanks Armin for your remarks :wink:

Ah yes, makes sense. I would say the Stream Gate component is probably one of the most used components in my scripts. You need it for so many things.

Since you had the example with the mm and m, so obviously you are working with different units: There is a component (I think it might come with a plugin) that outputs the current document units in Grasshopper. That way you can have a script that works with different Rhino files and can automatically adjust values depending on the document units. Might be handy for what you are doing.

Happy grasshoppering.

1 Like

You are right. Actually, I would probably also do it that way with the stream gate, but I wanted to mention that it is possible to output anything in a value list. You can even output strings again.

Lastly, there are some cool ways to actually update value lists “remotely” using Metahopper.

Yes Armin, this is quite helpful, otherwise i’d have thought that only 0 and 1 works in stream node :smiley:
Cheers!!

For the stream gate it’s only 0, 1, 2, etc… (you can add more inputs when you zoom in and click on the plus). Of course, a Boolean value of true or false also get’s interpreted as 0 and 1. But the value list can output any value so you might not need a stream gate to output different numbers if you are using a value list anyways.

1 Like

This node has eased my work a lot!!! Awesomeee