From 3490b1b388f7562be28e88e290130c4649d50f0e Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Mon, 2 Sep 2019 19:43:11 +1000 Subject: [PATCH] Report exceptions about spatial structure --- export.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/export.py b/export.py index da8c0aefe9..8add5efbf7 100644 --- a/export.py +++ b/export.py @@ -308,7 +308,11 @@ class IfcExporter(): def create_products(self): for product in self.ifc_parser.products: - placement_rel_to = self.ifc_parser.spatial_structure_elements[product['relating_structure']]['ifc'].ObjectPlacement + try: + placement_rel_to = self.ifc_parser.spatial_structure_elements[product['relating_structure']]['ifc'].ObjectPlacement + except Exception as e: + print('The product "{}/{}" could not be placed on a spatial structure {}'.format(product['class'], product['attributes']['Name'], e.args)) + continue placement = self.file.createIfcLocalPlacement(placement_rel_to, self.create_ifc_axis_2_placement_3d(product['raw'].location)) representation = self.file.createIfcProductDefinitionShape(