Error handling improvement for lod2

This commit is contained in:
Guille 2020-12-14 10:51:10 -05:00
parent 46a88bf890
commit 0d93c4ccb0
2 changed files with 12 additions and 3 deletions

View File

@ -370,7 +370,10 @@ class Surface:
if self.type != 'Wall' or surface.type != 'Wall':
return
if self._geometry_helper.is_almost_same_surface(self, surface):
intersection_area = self.intersect(surface).area
try:
intersection_area = self.intersect(surface).area
except ValueError:
intersection_area = 0
self.add_shared(surface, intersection_area)
surface.add_shared(self, intersection_area)

View File

@ -6,7 +6,7 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
class OccupancyHelper:
occupancy_function = {
occupancy_pluto_function = {
'C1': 'C-12 Residential',
'C5': 'C-12 Residential',
'D3': 'C-12 Residential',
@ -17,6 +17,9 @@ class OccupancyHelper:
'U0': 'C-10 Warehouse',
'W4': 'C-9 School',
}
occupancy_function = {
'residential': 'C-12 Residential'
}
@staticmethod
def pluto_occupancy_function(building_pluto_function):
@ -25,4 +28,7 @@ class OccupancyHelper:
:param building_pluto_function: str
:return: str
"""
return OccupancyHelper.occupancy_function[building_pluto_function]
try:
return OccupancyHelper.occupancy_pluto_function[building_pluto_function]
except KeyError:
return OccupancyHelper.occupancy_function[building_pluto_function]