Get GUIDs of all components for each plugin

Hi grasshopper devs, hi @DavidRutten,

I’d like to retrive a list of names and guids of all the components for each plugin in my current Rhino/Grasshopper installation. I know the libraries themselves can be found with

Grasshopper.Instances.ComponentServer.Libraries

but I don’t see how I can examine them.

Does anybody have a suggestion on how to proceed?

Thanks a lot and best regards,
Paul

The GH_AssemblyInfo doesn’t contain a list of all the objects it provided, you have to iterate over all the proxies in Instances.ComponentServer.ObjectProxies and for each one ask what library it belongs to. This then allows you to build a look-up table with component/library associations.

There’s also a Instances.ComponentServer.FindAssemblyByObject method which can be used to find the plug-in that owns a specific component.

2 Likes

@DavidRutten your advice is – as always – spot on :slight_smile:
I get all the necessary info in a script component like this:

foreach(var objectProxy in Grasshopper.Instances.ComponentServer.ObjectProxies)
{
  Print("Component: " + objectProxy.Desc.Name);
  Print("   Nick name: " + objectProxy.Desc.NickName);
  Print("   Guid: " + objectProxy.Guid);
  Print("   Library: " + Grasshopper.Instances.ComponentServer.FindAssemblyByObject(objectProxy.Guid).Name);
  Print("   Library id: " + Grasshopper.Instances.ComponentServer.FindAssemblyByObject(objectProxy.Guid).Id);
  Print("   Library version: " + Grasshopper.Instances.ComponentServer.FindAssemblyByObject(objectProxy.Guid).Version);
}  

Thanks a lot!

2 Likes