GH: Improve command search algorithm

You can get a list of all loaded components like this:

private void RunScript(ref object Names, ref object NickNames)
  {
    var objects = Grasshopper.Instances.ComponentServer.ObjectProxies;
    var names = new List<string>();
    var nickNames = new List<string>();
    foreach(var obj in objects)
    {
      var desc = obj.Desc;
      names.Add(desc.Name);
      nickNames.Add(desc.NickName);
    }
    Names = names;
    NickNames = nickNames;
  }


Components.gh (15.9 KB)

Here I tried to experience how it would feel using String.StartsWith to search for components:


ComponentsStartsWith.gh (19.9 KB) (RealTimeTextBox)

2 Likes