I am a developer and am willing to create an open extension to do this but I’m sure there are people here who have guidance or even a solution. I’m not sure if the API can even do this, it may be that the scene state has to be loaded before data can be exported. I attempted to analyse the SketchUp file exports but couldn’t seem to find this scene data.
This library makes creating JSON text dead simple from a Ruby hash (and hence also from a SketchUp API AttributeDictionary.)
require 'json'
dict = obj.attribute_dictionary("Author_SomeExtension")
if dict # nil if it doesn't exist
json_attributes = dict.to_h.to_json
end
The main problem (with your assumptions) is that in SketchUp, a drawingelement entity is “owned” by an entities collection. Ie, either the model itself, or a component or group definition.
Scene page objects are views that look at the model. They do not have an entities collection.
But they can keep track of what entities are hidden or shown when they are the selected (current) scene page.