LayerTable-like dictionary in a grasshopper plug-in

Hi everyone, I need some advise on implementing a kind of a flat’s library in my plugin.

Here’s a little background. There is a bunch of apartment objects with tons of data in each (curves, walls etc.). And there are ‘house’ objects which contain lots of apartments inside. User creates and manipulates houses in his grasshopper definition and saves the result in a json file.

At the moment json files are enormous because each house contains every apartment and there’s a lot of repetitive data. What I want to implement is to store only the flatName in the house objects and to have some kind of ApartmentsTable where I can keep all apartments’ data in a single place.

I see it as some kind of MyPluginDoc.Apartments.FindName() method similar to RhinoDoc.Layers.FindName().

Basically I want to initialize MyPluginDoc class once and make it visible to every component on the grasshopper canvas. For now I don’t see any other way but manually wiring MyPluginDoc component to every single component using apartments. And that would involve a huge rework of existing grasshopper files.

I thought there might be a smarter way. Any thoughts would be much appreciated.