From d09286eeca3de523d03afae2b9c938cf21170565 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Thu, 20 Oct 2022 14:32:43 +1100 Subject: [PATCH] Schema migrator now supports IfcElectricDistributionPoint --- src/ifcopenshell-python/ifcopenshell/util/class_2x3_to_4.json | 3 +++ src/ifcopenshell-python/ifcopenshell/util/schema.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 src/ifcopenshell-python/ifcopenshell/util/class_2x3_to_4.json diff --git a/src/ifcopenshell-python/ifcopenshell/util/class_2x3_to_4.json b/src/ifcopenshell-python/ifcopenshell/util/class_2x3_to_4.json new file mode 100644 index 0000000000..a25456701d --- /dev/null +++ b/src/ifcopenshell-python/ifcopenshell/util/class_2x3_to_4.json @@ -0,0 +1,3 @@ +{ + "IfcElectricDistributionPoint": "IfcElectricDistributionBoard" +} diff --git a/src/ifcopenshell-python/ifcopenshell/util/schema.py b/src/ifcopenshell-python/ifcopenshell/util/schema.py index 214810f880..d4713e9a98 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/schema.py +++ b/src/ifcopenshell-python/ifcopenshell/util/schema.py @@ -70,6 +70,7 @@ class Migrator: def __init__(self): self.migrated_ids = {} self.class_4_to_2x3 = json.load(open(os.path.join(cwd, "class_4_to_2x3.json"), "r")) + self.class_2x3_to_4 = json.load(open(os.path.join(cwd, "class_2x3_to_4.json"), "r")) # IFC4 classes, and their IFC4 attribute : IFC2X3 attributes self.attribute_4_to_2x3 = json.load(open(os.path.join(cwd, "attribute_4_to_2x3.json"), "r")) @@ -151,8 +152,7 @@ class Migrator: if new_file.schema == "IFC2X3": new_element = new_file.create_entity(self.class_4_to_2x3[element.is_a()]) elif new_file.schema == "IFC4": - print("Class migration to IFC4 not yet supported for", element) - pass + new_element = new_file.create_entity(self.class_2x3_to_4[element.is_a()]) return new_element def migrate_attributes(self, element, new_file, new_element, new_element_schema):