Hi, Is there anyway in GH 0.9 to search based on explanation for a component. This will be helpful because sometimes you do not know the name of the component you are after. however, you can write few words to explain it. Any idea? Thanks
you can set alias for each component, just right click on the icon of the component in the ribbon, then you can search with that alias
If you can accept typing the search term into a Text Panel then you can use a custom script.
In the description text below there’s a word “area” (although also in the NickName, but I used what I had on screen when reading this post), and the script visibly selects all components on the canvas with this word in the component description:
The code:
private void RunScript(string SearchTerm, ref object A)
{
var cmp_list = new List<GH_Component>();
for (var i = 0; i < GrasshopperDocument.ObjectCount; i++)
{
var obj = GrasshopperDocument.Objects[i];
if (obj is GH_Component)
{
GH_Component cmp = obj as GH_Component;
// using regular string function, case sensitive search
if (cmp.Description.Contains(SearchTerm))
{
cmp_list.Add(cmp);
cmp.Attributes.Selected = true; // Visibly select
}
}
}
A = cmp_list; // output also the component list
}
SearchDescriptionText.gh (12.7 KB)
// Rolf
oh, did I misunderstand the question?
Thanks for your tricks. I think I have not been clear enough in my question. I would like to be able search between all of my components based on their description and find components with the words that I type.
Please see below.
By “…all of my components…” do you mean all components that are in the ribbon or the components placed on the canvas. It is still unclear.
double click on the empty canvas, brings you a search bar where you type, but I don’t think it is based on description rather it is searching for alias and names of the components. As mentioned above you can set alias to each component.
Perhaps @DavidRutten can say more, of what is possible and if search of description is supported.
OK, my example only checked the components on the canvas.
So then the loop in the script should be completed with loops through all the installed plugins and their components and check their descriptions.
// Rolf