Iterating through OpenStudio Objects to get their "Types" and "Attributes"
Hi All,
For context this is being done using Python. I'm trying to see if there's a built-in method where I can load an existing OpenStudio model, use specific_object = osm.getObject(an_object_handle).get()
to isolate a specific object (where osm is the whole model), and then pick apart and inspect what's in the object. If I use print(specific_object)
I get a nice human-readable block of text. However I can't seem to figure out how to iterate through these fields beyond just specific_object.name()
.
I'd like to iteratively return if possible the type of object (Space, Thermal Zone, Construction, etc.), and its attributes. Like in the case of a space, returning Space Type Name, Default Construction Set Name, Default Schedule Set Name, etc.
I put types and attributes in quotes in the title because I think the nomenclature in OpenStudio is a little different which might be part of my problem.
I really appreciate any suggestions you all might have. I think if all else fails I could use str(specific_object)
to get that human-readable output and then parse through that with other python tools. I just wasn't sure if there was a built-in way. My end goal for this project is to generate some reporting for myself about the model so I don't necessarily need to hang onto the OpenStudio objects themselves nor am I necessarily trying to change them. However, it would be nice to know what options I have should I want to later.
Thanks!
I'm having a very similar issue. In python lots of objects can have their attributes described by
object.__dict__
but that has not been implemented here and it's frustrating.I think a wrapper model is probably needed. Something that takes the openstudio module and provides added context and documentation for the functions and objects. You could subclass the objects and then add documentation and description. It's not a small undertaking by any stretch but may be the best way to pythonify the openstudio module.