Skip to content

Commit

Permalink
fix(cleanup): Temp fix for HB extension_attribute bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ed-p-may committed Nov 10, 2022
1 parent 0214f36 commit 1e1c3dd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions PHX/from_HBJSON/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,27 @@ def _get_room_exposed_faces(_hb_room: room.Room, _bc_types: Tuple = (Outdoors, G
--------
* list[face.Face]: The list of Exposed Honeybee Faces.
"""

exposed_faces = []
for original_face in _hb_room.faces:
if not isinstance(original_face.boundary_condition, _bc_types):
continue

new_face = original_face.duplicate()
new_face._properties._duplicate_extension_attr(original_face._properties)

# -- Note, this is required if the user has set custom .energy constructions
# -- or other custom face-specific attributes
# -- Duplicate any extensions like .ph, .energy or .radiance
for extension_name in original_face.properties._extension_attributes:
original_extension = getattr(original_face._properties, f'_{extension_name}')
new_extension = original_extension.duplicate()
setattr(new_face._properties, f'_{extension_name}', new_extension)
# -- use try except to avoid the bug introduced in HB v1.5
# TODO: fix Honeybee and then remove this try...except...
try:
original_extension = getattr(original_face._properties, f'_{extension_name}', None)
new_extension = original_extension.duplicate()
setattr(new_face._properties, f'_{extension_name}', new_extension)
except:
pass

exposed_faces.append(new_face)

Expand Down

0 comments on commit 1e1c3dd

Please sign in to comment.