In the context of an Add-on, I am trying to access the icon bitmap of a component that will be created by a part creator, in order to display it on a button. I want to access it from the .Net part of the code.
Since I want to display the icon before starting the simulation, no part is yet created in the simulation world by the part creator.
I haven’t been able to find a way to achieve this. I tried using the part creator properties, but they only provide access to the part URI, and I couldn’t figure out how to retrieve the icon bitmap from this information.
Does anyone have an idea of how I could access the bitmap of the part?
You need to load the component from the Uri into the simulation world and can then access its internals and metadata through ISimComponent.
See IApplication.LoadLayout(…)
Or what icon are you referring to? The ones shown in eCat UI?
Yes, exactly, I am referring to the one shown in the eCatalog UI. I wanted to avoid loading the part into the world, as it can be inconvenient for the user to wait for the part to load.
Is there any possible alternative? Since the icon bitmap is displayed in the eCatalog, I feel like there should be a way to access it without loading the part into the world.
If the component is known to the eCat indexer / local database, you can probably find the metadata using the database directly. Basically need to find Item object with corresponding VCID / URI and get the icon file path from it. This isn’t part of the VC public API, though so it might change or cease to exist.
The database may also contain multiple matching items and the VCID resolving order is complicated, so you might not be able to reliably figure out the correct component which the part creator will actually create.