algorithmic modeling for Rhino
I have been trying to create clusters with optional inputs, which when empty have a default value and an override value when not empty. I am thinking this is probably a quick scripting exercise, but even then I'm not sure if it would work at the beginning of a cluster.
I thought it would be something like:
Cluster input -> Null Item -> stream filter
So if the item is null (no input) the filter would get one value, and if it is not null, it would get another.
Any easy way to achieve this? If not, it would be a cool feature david :)
Tags:
Hi Brian, sorry for the very late reaction, I only just found your question:
I had the same question, and was almost gonna ask in the recent null/empty related discussions.
But I think I have figured out an acceptable way, where everything will still work when clustered. (And I think the only other option is to have a bit of the definition outside the cluster, which we don't want.)
I can't write VB or C# so I can't say anything sensible about that (I'm referring to this).
I hope the screenshot will explain how I tackled this as neatly as I could, using only native GH components:
Either of the string components could be hooked up to the cluster input of coarse..
And I agree: it would be a great feature, if this could be done without this (still visible) trick on the input.
If anybody can come up with a cleaner way to achieve this (Allow for empty inputs in clusters, without any warnings or breaking of the definition), please do respond!
Still, for now I hope this helps a bit.
Hey Pieter,
I thought I posted a response to this when I figured out a way (but I guess I didn't). Once the cluster is created you can simply plug in whatever default value you want and then internalize it (right click, select "internalize data")
This way when no input is supplied the "default" internalized value passes through, but when an input is supplied it will override the internalized data.
Edit: although I know David's been re-working clusters for some time now, so I'm not sure if this will work or if there will be a better way in GH 0.9
Of coarse I should have kept my default value Panel empty to get a cluster input that's allowed to be (faked) empty. Anyhow:
That's great Brian, because now hovering over the input, it just shows the discription and "1 locally defined value". That's quite a bit cleaner than my way, which was really a sort of workaround for the Internalise Data. That was the key to solve the issue, and though I am aware of that option, I somehow didn't apply it here, maybe because I am Internalising the output of an emptied out Panel (empty branch). But hey, it works, thanks:)
And Jonah, thanks for your idea for this, too bad I'm such a nono at scripts that I don't even know how to get this script to stay in the component after closing the editor.. I will do a search on how to do that later. I think probably when GH9 will become available, given the discussion I referred to in my response earlier...
Thanks guys!
P.S.: I was making this:
Pieter I couldn't get this to work. Did you get this to work inside a cluster? I cant get it to pass through the default value with no input.
"Either of the string components could be hooked up to the cluster input of coarse.."
well, of coarse that is not true, (and the cluster input in the image is indicated wrong also) because the stream filter nr 1 input would alway just pass my string InputA...
Sorry about the slovenliness. No wonder you couldn't get it to work.
-----
Here is what I meant to upload:
and the definition:
Hey Igor,
I tried that too - once you try to put it in a cluster it doesn't work. Like if you were to make that integer component a cluster input, the cluster wouldn't substitute the default value if it were null/empty (for some reason).
Really the best way is internalizing the data. It's super clean and reliable.
It's a good idea but unfortunately the Stream Gate component only accepts one input to G. No lists
That's also true.
Wouldn't it be great if Ning could employee the scribbling pen like Skype to indicate when someone else is answering at the same time as you. :)
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by