diff --git a/src/ifcpatch/ifcpatch/__init__.py b/src/ifcpatch/ifcpatch/__init__.py index 1af72f9bf0..d8cf8fa5e4 100644 --- a/src/ifcpatch/ifcpatch/__init__.py +++ b/src/ifcpatch/ifcpatch/__init__.py @@ -17,7 +17,7 @@ def execute(args, is_library=None): patcher = recipe.Patcher(args["input"], ifc_file, logger, args["arguments"]) print("# Patching ...") patcher.patch() - ifc_file = patcher.file + ifc_file = getattr(patcher, "file_patched", patcher.file) if is_library is True: return ifc_file print("# Writing patched file ...") diff --git a/src/ifcpatch/ifcpatch/recipes/Migrate.py b/src/ifcpatch/ifcpatch/recipes/Migrate.py index 610cb4934d..7d238e2204 100644 --- a/src/ifcpatch/ifcpatch/recipes/Migrate.py +++ b/src/ifcpatch/ifcpatch/recipes/Migrate.py @@ -10,9 +10,9 @@ class Patcher: self.args = args def patch(self): - self.new = ifcopenshell.file(schema=self.args[0]) + self.file_patched = ifcopenshell.file(schema=self.args[0]) migrator = ifcopenshell.util.schema.Migrator() for element in self.file: + migrator.migrate(element, self.file_patched) print("Migrating", element) - print("Successfully converted to", migrator.migrate(element, self.new)) - self.file = self.new + print("Successfully converted to", migrator.migrate(element, self.file_patched))