Add type to constructions to avoid collisions in constructions names

This commit is contained in:
Guille Gutierrez 2024-07-16 07:24:22 +02:00
parent 998df80b63
commit abc3fc48dd

View File

@ -321,7 +321,7 @@ class Idf:
if construction.Name == vegetation_name: if construction.Name == vegetation_name:
return return
else: else:
if construction.Name == thermal_boundary.construction_name: if construction.Name == f'{thermal_boundary.construction_name} {thermal_boundary.parent_surface.type}':
return return
if thermal_boundary.layers is None: if thermal_boundary.layers is None:
for material in self._idf.idfobjects[self._MATERIAL]: for material in self._idf.idfobjects[self._MATERIAL]:
@ -340,7 +340,8 @@ class Idf:
for i in range(0, len(layers) - 1): for i in range(0, len(layers) - 1):
_kwargs[f'Layer_{i + 2}'] = layers[i].material_name _kwargs[f'Layer_{i + 2}'] = layers[i].material_name
else: 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): for i in range(1, len(layers) - 1):
_kwargs[f'Layer_{i + 1}'] = layers[i].material_name _kwargs[f'Layer_{i + 1}'] = layers[i].material_name
self._idf.newidfobject(self._CONSTRUCTION, **_kwargs) self._idf.newidfobject(self._CONSTRUCTION, **_kwargs)
@ -717,7 +718,7 @@ class Idf:
if boundary.parent_surface.vegetation is not None: if boundary.parent_surface.vegetation is not None:
construction_name = f'{boundary.construction_name}_{boundary.parent_surface.vegetation.name}' construction_name = f'{boundary.construction_name}_{boundary.parent_surface.vegetation.name}'
else: else:
construction_name = boundary.construction_name construction_name = f'{boundary.construction_name} {boundary.parent_surface.type}'
_kwargs['Construction_Name'] = construction_name _kwargs['Construction_Name'] = construction_name
surface = self._idf.newidfobject(self._SURFACE, **_kwargs) surface = self._idf.newidfobject(self._SURFACE, **_kwargs)