From 6087f20ea30ff766bd5fa161519efc3d1d03460e Mon Sep 17 00:00:00 2001 From: Chris Mackey Date: Sun, 26 Sep 2021 19:51:33 -0400 Subject: [PATCH] fix(model): Add property to pass holes to OSM/IDF We will just pass the single list of vertices as a property to the honeybee-openstudio-gem. --- honeybee_energy/properties/model.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/honeybee_energy/properties/model.py b/honeybee_energy/properties/model.py index 2eb2020f5..2f40fd962 100644 --- a/honeybee_energy/properties/model.py +++ b/honeybee_energy/properties/model.py @@ -621,7 +621,8 @@ def to_dict(self): def add_autocal_properties_to_dict(self, data): """Add auto-calculated energy properties to a Model dictionary. - This includes Room volumes and ceiling heights. These properties are used + This includes Room volumes, ceiling heights, and (in the case of Faces + and Shades with holes) vertices. These properties are used in translation from Honeybee to OpenStudio to ensure that the properties in Honeybee are aligned with those in OSM, IDF, and gbXML. @@ -637,6 +638,31 @@ def add_autocal_properties_to_dict(self, data): for room, room_dict in zip(self.host.rooms, data['rooms']): room_dict['ceiling_height'] = room.geometry.max.z - room.geometry.min.z room_dict['volume'] = room.volume + self._add_shade_vertices(room, room_dict) + for face, face_dict in zip(room._faces, room_dict['faces']): + self._add_shade_vertices(face, face_dict) + if face.geometry.has_holes: + face_dict['geometry']['vertices'] = \ + [pt.to_array() for pt in face.vertices] + if len(face._apertures) != 0: + for ap, ap_dict in zip(face._apertures, face_dict['apertures']): + self._add_shade_vertices(ap, ap_dict) + if len(face._doors) != 0: + for dr, dr_dict in zip(face._doors, face_dict['doors']): + self._add_shade_vertices(dr, dr_dict) + if len(self.host._orphaned_shades) != 0: + for shd, shd_d in zip(self.host._orphaned_shades, data['orphaned_shades']): + if shd.geometry.has_holes: + shd_d['geometry']['vertices'] = \ + [pt.to_array() for pt in shd.vertices] + + @staticmethod + def _add_shade_vertices(obj, obj_dict): + if len(obj._outdoor_shades) != 0: + for shd, shd_dict in zip(obj._outdoor_shades, obj_dict['outdoor_shades']): + if shd.geometry.has_holes: + shd_dict['geometry']['vertices'] = \ + [pt.to_array() for pt in shd.vertices] def simplify_window_constructions_in_dict(self, data): """Convert all window constructions in a model dictionary to SimpleGlazSys.