Getting component guids for **all** components available to user

Hello all,

I’m struggling with this one and wondering if anyone out there could help at all.
I can get the guids of any components that are on the canvas by simply using Document.ActiveObjects() of course and getting the componentguid, assuming they are indeed components…

…however I was wondering if there is a quick way of getting a list of all component guids available to the current user (i.e. standard issue + any installed user libraries and even user objects if possible)? Possible routes in are evading my grasp, hence turning for help. The idea is to place a random component on the canvas, and to do this I need to compose a list to pick from.

Anyway, any help much appreciated.

Many thanks,

John.

For anyone obscure enough to need a similar thing, I have found the answer through a bit of trial and error. You can access the tabs, panels, items and associated component IDs thus:

Guid myId = Instances.ComponentServer.CompleteRibbonLayout.Tabs[1].Panels[0].Items[0].Id;
GH_Component myComponent = (GH_Component) Instances.ComponentServer.EmitObject(myId);
this.GrasshopperDocument.AddObject(myComponent, false);

Best, John.

InstancesComponentServer gives access to all loaded objects as proxies. The tabs may not actually include a bunch of obsolete or otherwise hidden components. Or maybe that’s what you want?

A proxy is just enough information about a component/parameter to show it on toolbars and instantiate it, but it doesn’t contain an instance of the component in question.

1 Like

Sorry for the year old thank you reply David.

I wanted to write a component that would generate a random component on the canvas, so it was actually beneficial in some ways to not include obsolete or hidden components. A kind of grasshopper version of discovering components you never knew existed, or to generate an idea dada-style.

1 Like

You could hook them up in random ways as well.

reminds me of this: https://www.youtube.com/watch?v=9QA_64-k6vY

Ah very nice. Yes I tried to do this a few years back with Embryo (David might remember my obscure questions), but I never quite finished it so it was really ‘usable’. It took components from a specific part of the campus rather than randomly though. I then switched my attention to the Biomorpher plugin. I must return to it at some point and finish things off properly. https://www.food4rhino.com/app/embryo

off topic, sorry, but what do you still need to do?