Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(model): Add property to pass holes to OSM/IDF #772

Merged
merged 1 commit into from Sep 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 27 additions & 1 deletion honeybee_energy/properties/model.py
Expand Up @@ -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.

Expand All @@ -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.
Expand Down