Skip to content

Commit 1c9183a

Browse files
committed
fix(model): Add method to Model for converting all rooms to extrusions
1 parent 7262b63 commit 1c9183a

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

honeybee/model.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,40 @@ def assign_stories_by_floor_height(self, min_difference=2.0, overwrite=False):
18351835
room.story = None
18361836
return Room.stories_by_floor_height(self._rooms, min_difference)
18371837

1838+
def rooms_to_extrusions(self, tolerance=None, angle_tolerance=None):
1839+
"""Convert all Rooms in the model to extruded floor plates with flat roofs.
1840+
1841+
Rooms that already extrusions will be left as they are. For non-extrusion
1842+
rooms, all boundary conditions and windows applied to vertical walls will
1843+
be preserved and the resulting Room should have a volume that matches the
1844+
original Room. If adding back apertures to the room extrusion results in
1845+
these apertures going past the parent wall Face, the windows of the Face
1846+
will be reduced to a simple window ratio. Any Surface boundary conditions
1847+
will be converted to Adiabatic (if honeybee-energy is installed) or
1848+
Outdoors (if not).
1849+
1850+
This method is useful for exporting to platforms that cannot model Room
1851+
geometry beyond simple extrusions. The fact that the resulting room has
1852+
window areas and volumes that match the original detailed geometry
1853+
should help ensure the results in these platforms are close to what they
1854+
would be had the detailed geometry been modeled.
1855+
1856+
Args:
1857+
tolerance: The maximum difference between point values for them to be
1858+
considered equivalent. If None, the Model tolerance will be
1859+
used. (Default: None).
1860+
angle_tolerance: The max angle in degrees that the corners of the
1861+
rectangle can differ from a right angle before it is not
1862+
considered a rectangle. If None, the Model angle_tolerance will be
1863+
used. (Default: None).
1864+
"""
1865+
tol = tolerance if tolerance else self.tolerance
1866+
a_tol = angle_tolerance if angle_tolerance else self.angle_tolerance
1867+
extrusion_rooms = []
1868+
for room in self._rooms:
1869+
extrusion_rooms.append(room.to_extrusion(tol, a_tol))
1870+
self._rooms = extrusion_rooms
1871+
18381872
def convert_to_units(self, units='Meters'):
18391873
"""Convert all of the geometry in this model to certain units.
18401874

honeybee/room.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2492,7 +2492,7 @@ def to_extrusion(self, tolerance=0.01, angle_tolerance=1.0):
24922492
self.identifier, ext_p_face, ground_depth=float('-inf'))
24932493

24942494
# assign BCs and replace any Surface conditions to be set on the story level
2495-
for i, bc in enumerate(self._boundary_conditions):
2495+
for i, bc in enumerate(wall_bcs):
24962496
if not isinstance(bc, Surface):
24972497
ext_room[i + 1]._boundary_condition = bc
24982498
elif ad_bc is not None:

0 commit comments

Comments
 (0)