From abc3fc48dd8ec25176c19014db0363102d72633a Mon Sep 17 00:00:00 2001 From: guille Date: Tue, 16 Jul 2024 07:24:22 +0200 Subject: [PATCH] Add type to constructions to avoid collisions in constructions names --- hub/exports/building_energy/idf.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hub/exports/building_energy/idf.py b/hub/exports/building_energy/idf.py index 3480d803..d01ab391 100644 --- a/hub/exports/building_energy/idf.py +++ b/hub/exports/building_energy/idf.py @@ -321,7 +321,7 @@ class Idf: if construction.Name == vegetation_name: return else: - if construction.Name == thermal_boundary.construction_name: + if construction.Name == f'{thermal_boundary.construction_name} {thermal_boundary.parent_surface.type}': return if thermal_boundary.layers is None: for material in self._idf.idfobjects[self._MATERIAL]: @@ -340,7 +340,8 @@ class Idf: for i in range(0, len(layers) - 1): _kwargs[f'Layer_{i + 2}'] = layers[i].material_name else: - _kwargs = {'Name': thermal_boundary.construction_name, 'Outside_Layer': layers[0].material_name} + _kwargs = {'Name': f'{thermal_boundary.construction_name} {thermal_boundary.parent_surface.type}', + 'Outside_Layer': layers[0].material_name} for i in range(1, len(layers) - 1): _kwargs[f'Layer_{i + 1}'] = layers[i].material_name self._idf.newidfobject(self._CONSTRUCTION, **_kwargs) @@ -717,7 +718,7 @@ class Idf: if boundary.parent_surface.vegetation is not None: construction_name = f'{boundary.construction_name}_{boundary.parent_surface.vegetation.name}' else: - construction_name = boundary.construction_name + construction_name = f'{boundary.construction_name} {boundary.parent_surface.type}' _kwargs['Construction_Name'] = construction_name surface = self._idf.newidfobject(self._SURFACE, **_kwargs)