First time here? Check out the Help page!
1 | initial version |
@Julien Marrec "I'm still interested in knowing how one can return the object from its handle"
If I am interpreting your question correctly here is what you need to know. Basically you need the Model::getObject(Handle) method. Here are the details.
m = OpenStudio::Model::Model.new
plant = OpenStudio::Model::PlantLoop.new m
h = plant.handle
optional_model_object = m.getObject h
# optional_model_object will be a generic (optional) ModelObject
# if you want to know what specific type it is consider optional_model_object.get.iddObject.name
# You can cast back to plant like this
plant = optional_model_object.get.to_PlantLoop.get
# Watch out, either of the previous calls to "get" could crash the program if your call to getObject failed or the cast to PlantLoop failed.