algorithmic modeling for Rhino
Hi Everyone.
I am using a rotary switch with firefly that sends values to a stream gate. I want to remember the last set of data sent via the stream after switching. Can VB scripting do this?
In the image below stream 1 is reading data but stream 2 has lost data. I want stream 2 to remember the last value sent to it.
Tags:
Sorry... I've been out of town and have not had access to the internet for a while. But, this should be really easy to do with a scripting component. Below is one way (I think this will work for your application). I'm using a C# component and the input is renamed to "val" and the type hint is set to double. The code is shown in the screenshot. Let me know if this helps.
Hi Scott... Just trying to figure out exactly what you're after. So, in your example you have a list of three numbers coming into the S-input... and I'm assuming the Gate input is a slider value which will change whether the list coming into the S-input is output to 1, 2 or 3 output nodes. Is this correct? If so, what is the value you're trying to 'remember' (or hold in memory)? Can you provide an example... I don't think what you're trying to do is difficult... just trying to figure out the scenario so I can write the code correctly.
-Andy
Hi Andy, I have attached a GH file. I have values coming from 3 x 10k pots that provide the numbers into Gate Switch. I want to hold these numbers in the script so that the resulting geometry is kept at its current value. A momentary switch (for example) toggles the Gate to adjust the next bit of geometry with the pots. etc. It's like controlling multiple floor plates in a building with 3 sliders (adjust size) and a push button (to move floors), thus allowing you to modify geometry press button and move up.
Scott
This is for a publication that Firefly is referenced in. I will mention you in the Acknowledgments.
Hi Scott,
I think something like this will work... but take a look and let me know.
-Andy
For some reason... it didn't upload the file. Let's try again.
Hi Andy,
Our versions of GH are not compatible I have 0.9.0014 I cannot upgrade at the moment. How can we do this? sorry for the inconvenience.
Scott
The code is pretty simple and you should be able to recreate it using your version. See the image below. The only thing I changed is the name of the input is now "in_list" and it is of type Integer (instead of double) since it's actually going to be one of the ADC values from your potentiometer. I also set the input to use a List instead of a single value. Other than that, it should be pretty straightforward.
HTH,
Andy
Hi Andy,
This works the same as your first suggestion (val) i.e. when the switch is pressed it forgets the values. I have added a link to a screen cast - http://www.screenr.com/xsj7 - you can see the panels loos the in_list values when switched.
I guess I am wanting to internalize the data with out disconnecting the sources?
Hi Scott,
I think you just need to check and make sure (in both if statements) that the in_list is not null and that the List.Count is greater than 0. I think what's happening is that when you push the button it switches the gate... and since the list changes (to nothing), the C# component clears the list. If you check for null or that the count is greater than zero, then you should be able to handle this case. Let me know if you need more help.
-Andy
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