algorithmic modeling for Rhino
Is there a way to store data values set by number sliders so that a single set of controls can be used for multiple "stations"? For example, I have sliders and knobs that define a curve for a boat hull cross-section and want to re-use these controls to define multiple "stations" (cross-sections at different X locations from bow to stern).
At present, I have to duplicate the controls for each station, which makes it clumsy to have an arbitrary number of stations.
I searched for "persistent data in Grasshopper" before asking this question but didn't find the issue expressed this way. Thanks.
Tags:
Solution -> Save State menu? I may have completely misunderstood though.
That's an interesting feature, thanks, but unless I can save and restore state using Grasshopper components(?), it doesn't help.
What I want is the ability to define multiple curves in GH that are lofted to create a surface.
The two screen shots below show different control settings for a curve in the YZ plane (the 'Right' viewport) that determines a cross-section shape. I'd like to use the same single set of controls with an 'X' slider to define multiple curves/stations and then be able to access the curves to loft them to create a hull shape.
By the way, the 'Save State' feature gave me unexpected results... It wouldn't save the initial state (the semi-circle) from the .gh file but seemed to save the first mod after that? Also, the default state names (MM:DD:HH:MM) should include seconds to avoid duplicates (MM:DD:HH:MM:SS).
Thanks again.
With no way to set slider values within GH, I guess what I'm asking for is impossible? Too bad.
I guess what I want is a 'Save State' GH component that would:
Using multiple 'Save State' components would allow different groups of input sliders to each record multiple states. Sliders would be constrained to connect to only one 'Save State' component. There would need to be a way to purge/reset a 'Save State' component to empty.
It can't be done without some custom code component then. There are no standard components that modify the state of other components (other than Galapagos, which is not going to help you).
However it can be achieved with a small amount of C#/VB code and maybe a Value List to select the state you want. It would take more code to make a state saver, though that can also be done manually.
I'll see if I can come up with something before the lasagne is ready.
See attached. I hope the input is self-explanatory because I don't have time to explain it now (lasagne in 3 minutes!)
Whoa! I thought you were kidding!!
I got a couple of errors when I opened your file:
But the file opened anyway and seemed to work:
Choosing from the list of presets in the 'Value List' drop-down applies the appropriate param values to the sliders and knob, generating the different shapes. Impressive.
But the content of the "Presets" panel is entered by hand, not by using the sliders - right? So it doesn't really do what I need... I looked at your C# code and get what you're doing; I've been programming for many decades but not in C or VB and really don't want to go there now, myself.
Any chance of eventually getting a generic component, as described, for the rest of us? No hurry. Thanks very much.
Probably not, certainly not for GH1. I think a better state manager interface would be preferable for GH2, perhaps something which lives on the canvas rather than in the menu, so it can certainly work roughly like you describe.
It is possible to also generate the preset texts through code, it would be roughly the same amount of logic, basically just the inverse of what I wrote earlier.
Think a C# component which takes a single text field (preset name), an input where all relevant sliders and dials are connected, and a boolean SAVE input. It can then find a panel called "Presets" in the file and append a correct line of text to it representing the current state. You could even go nuts on the code and make the C# component pop up a state saving window, though that's probably a bit of a steep order without the cushioning IDE that is Visual Studio.
Well, on further reflection, this isn't nearly as "simple" as it seemed... My "spec" is close but to generate the set of curves for lofting, there needs to be a way to access the whole list of saved states collectively, as well as individually.
In other words, a list of 'X' values, a list of 'Beam' values, a list of 'Draft' values, etc.
Will have to ponder this further... Thanks again.
P.S. As a canvas component, it would be important to have 'Saved State' collect/save data only from the sliders/knobs connected to it - in effect, to mimic the checkbox toggles in the menu 'Save State' feature.
Hello Josheph, David,
The list of sliders' values for all sections could be created, using a [data recorder].
I put together an example file with simple rectangles as cross-sections.
Being a total noob at C# I didn't even try to mingle with David's script, so the sliders cannot be changed automatically, but if you set the X slider to a value where a section has already been created, you get a feedback of the X, Y and Z values for this section and you can also change them (by pressing the [create section] button again). You also get a panel that displays the X values of all available sections.
A major problem is that after closing the file, nothing is saved, so you would have to do this manually before exiting (internalize the created list inside a [Txt] container, or stream its contents to a .txt file through a panel, or something similar...)
Still, I believe that if you are familiar with C# you could merge the two definitions together and make it actually work as you want it to!
the file...
Definitely on the right track, thanks. Nice code! Will study it.
Would be cool if the data to replicate the resulting shapes could be "shared", even using copy/paste or a .csv file?
Ideally, the array of saved states would stay with the .gh file automagically, yes.
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