Don't bother creation relationships to invalid psets.

An invalid pset can occur when the pset doesn't contain any properties. This can happen when all properties are not part of the pset definition template. This may lead to unwanted data loss, but strictly enforces buildingSMART pset definitions.
This commit is contained in:
Dion Moult
2020-07-12 11:06:14 +10:00
parent 6b07aeb703
commit bdbe988dc7
@@ -2627,10 +2627,11 @@ class IfcExporter():
def relate_objects_to_psets(self):
for relating_property_key, related_objects in self.ifc_parser.rel_defines_by_pset.items():
self.file.createIfcRelDefinesByProperties(
ifcopenshell.guid.new(), self.owner_history, None, None,
[o['ifc'] for o in related_objects],
self.ifc_parser.psets[relating_property_key]['ifc'])
if self.ifc_parser.psets[relating_property_key]['ifc']:
self.file.createIfcRelDefinesByProperties(
ifcopenshell.guid.new(), self.owner_history, None, None,
[o['ifc'] for o in related_objects],
self.ifc_parser.psets[relating_property_key]['ifc'])
def relate_objects_to_materials(self):
if not self.ifc_export_settings.has_representations: