diff --git a/city_model_structure/attributes/surface.py b/city_model_structure/attributes/surface.py index 168b8eb8..65be7837 100644 --- a/city_model_structure/attributes/surface.py +++ b/city_model_structure/attributes/surface.py @@ -50,11 +50,13 @@ class Surface: :return str """ if self._id is None: - self._id = self.name.replace('-', '').replace('a', '').replace('b', '').replace('c', '').replace('d', '') - self._id = self._id.replace('e', '').replace('f', '') - print(self._id) + raise ValueError('Undefined surface id') return self._id + @id.setter + def id(self, value): + self._id = value + @property def swr(self): """ diff --git a/city_model_structure/building.py b/city_model_structure/building.py index 71d2282f..cc6916e8 100644 --- a/city_model_structure/building.py +++ b/city_model_structure/building.py @@ -59,10 +59,11 @@ class Building(CityObject): self._thermal_zones.append(ThermalZone(zone_surfaces)) for t_zones in self._thermal_zones: t_zones.bounded = [ThermalBoundary(s, [t_zones]) for s in t_zones.surfaces] - for surface in self.surfaces: + for surface_id, surface in enumerate(self.surfaces): self._min_x = min(self._min_x, surface.bounds_lower_corner[0]) self._min_y = min(self._min_y, surface.bounds_lower_corner[1]) self._min_z = min(self._min_z, surface.bounds_lower_corner[2]) + surface.id = surface_id if surface.type == 'Ground': self._grounds.append(surface) elif surface.type == 'Wall':