From 25a26db3609fc8b8f3c3e8f9b03af45bf42de0fa Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Wed, 25 Nov 2020 20:35:11 +1100 Subject: [PATCH] Exporting classifications to IFC2X3 (including downgrading) is now supported --- src/ifcblenderexport/blenderbim/bim/export_ifc.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ifcblenderexport/blenderbim/bim/export_ifc.py b/src/ifcblenderexport/blenderbim/bim/export_ifc.py index b371777790..62c7d2002b 100644 --- a/src/ifcblenderexport/blenderbim/bim/export_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/export_ifc.py @@ -1629,14 +1629,22 @@ class IfcExporter: def create_classifications(self): for classification in self.ifc_parser.classifications.values(): - classification["ifc"] = self.file.add(classification["raw_element"]) + if self.file.schema == "IFC4": + classification["ifc"] = self.file.add(classification["raw_element"]) + else: + migrator = ifcopenshell.util.schema.Migrator() + classification["ifc"] = migrator.migrate(classification["raw_element"], self.file) self.file.createIfcRelAssociatesClassification( - ifcopenshell.guid.new(), None, None, None, [self.ifc_parser.project["ifc"]], classification["ifc"] + ifcopenshell.guid.new(), self.owner_history, None, None, [self.ifc_parser.project["ifc"]], classification["ifc"] ) def create_classification_references(self): for reference in self.ifc_parser.classification_references.values(): - reference["ifc"] = self.file.add(reference["raw_element"]) + if self.file.schema == "IFC4": + reference["ifc"] = self.file.add(reference["raw_element"]) + else: + migrator = ifcopenshell.util.schema.Migrator() + reference["ifc"] = migrator.migrate(reference["raw_element"], self.file) def create_constraints(self): for constraint in self.ifc_parser.constraints.values():