algorithmic modeling for Rhino
Tags:
I have used slider.Slider.Value to set the value. I think there are two disadvantages. First, once the value is changed ,the slider could not be dragged anymore. Second, to each "slider", I need to use a "expireSolution" method, and this method would spend a lot of time if I program an algorithm (like GA or something). I remembered what David said in a topic that "setSliderValue" in GH_RhinoScriptInterface class could "runsolver()" after all of sliders were reset.
A part of my codes are following. Does anyone know how to use "setSliderValue" in GH_RhinoScriptInterface in GH component programming.
IGH_Param tempPara = this.Params.Input[0].Sources[0];
if (tempPara.GetType() == typeof(Grasshopper.Kernel.Special.GH_NumberSlider))
{
slider = tempPara as Grasshopper.Kernel.Special.GH_NumberSlider;
decimal max = slider.Slider.Maximum;
decimal min = slider.Slider.Minimum;
//change the value of slider
tempfile = this.OnPingDocument();
if (tempfile == null) { return ; }
//myInterface.OpenDocument(this.OnPingDocument().ToString() + ".gh");
//myInterface.SetSliderValue(slider.InstanceGuid.ToString(), 8);
DA.SetData(0, max);
DA.SetData(1, min);
slider.Slider.Value = 8;
slider.ExpireSolution(true);
//tempfile.NewSolution(true);
//MessageBox.Show(slider.InstanceGuid.ToString());
}
I used Double click to active the component. You could change the SolveInstance(IGH_DataAccess DA) method to test other setting slider value methods.
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