From 6d2bb98470f47eca00472fa4061eb2935ea299df Mon Sep 17 00:00:00 2001 From: guille Date: Thu, 4 Jul 2024 09:53:45 +0200 Subject: [PATCH] Correct bug in shadding object creation when no archetype available --- hub/city_model_structure/building_demand/internal_zone.py | 2 ++ hub/exports/building_energy/idf.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hub/city_model_structure/building_demand/internal_zone.py b/hub/city_model_structure/building_demand/internal_zone.py index 8bf2c98b..77d524a7 100644 --- a/hub/city_model_structure/building_demand/internal_zone.py +++ b/hub/city_model_structure/building_demand/internal_zone.py @@ -132,6 +132,8 @@ class InternalZone: _thermal_boundary = ThermalBoundary(surface, surface.solid_polygon.area, windows_areas) surface.associated_thermal_boundaries = [_thermal_boundary] _thermal_boundaries.append(_thermal_boundary) + if self.thermal_archetype is None: + return None # there are no archetype _number_of_storeys = int(self.volume / self.area / self.thermal_archetype.average_storey_height) _thermal_zone = ThermalZone(_thermal_boundaries, self, self.volume, self.area, _number_of_storeys) for thermal_boundary in _thermal_zone.thermal_boundaries: diff --git a/hub/exports/building_energy/idf.py b/hub/exports/building_energy/idf.py index 55faa89c..3f713be3 100644 --- a/hub/exports/building_energy/idf.py +++ b/hub/exports/building_energy/idf.py @@ -513,7 +513,7 @@ class Idf: self._lod = self._city.level_of_detail.geometry for building in self._city.buildings: for internal_zone in building.internal_zones: - if internal_zone.thermal_zones_from_internal_zones is None or len(internal_zone.thermal_zones_from_internal_zones.thermal_boundaries) == 0: + if internal_zone.thermal_zones_from_internal_zones is None: self._add_shading(building) # if the building has not archetype use it as shadow object continue for thermal_zone in internal_zone.thermal_zones_from_internal_zones: