algorithmic modeling for Rhino
Tags:
public GH_NumberSlider FindSlider(string name)
{
   //Get the document that owns this object.
   GH_Document doc = OnPingDocument();
   //Abort if no such document can be found.
   if (doc == null) { return null; }
   //Iterate over all objects inside the document.
   for (int i = 0; i < doc.ObjectCount; i++)
   {
     IGH_DocumentObject obj = doc.Objects[i];
     //First test the NickName of the object against the search name.
     if (obj.NickName.Equals(name, StringComparison.Ordinal))
     {
     //Then try to cast the object to a GH_NumberSlider.
     GH_NumberSlider sld_obj = obj as GH_NumberSlider;
     if (sld_obj != null) { return sld_obj; }
     }
   }
   return null;
}public bool SetSlider(GH_NumberSlider sld, double min, double max, double val)
{
   sld.set_MinValue(false, min);
   sld.set_MaxValue(false, max);
   sld.SliderValue = val;
   sld.ExpireSolution(true);
}David,
This is a very useful bit of code to see. To limit the updates an event trigger would seem appropriate. I have a couple of questions.
1. Is it possible to track events for when an input is touched?
For example if a slider were attached to the second input of a custom component can is there a way to track the relevant event?
2. Is there any sample code for this that is available?
this is a old post but i had to use
owner.OnPingDocument();
instead of
OnPingDocument();
To make it work...
Thanks Again David...
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
    © 2025               Created by Scott Davidson.             
    Powered by
    