mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
Fix bug where sometimes migrating an IFC file schema version can explode in filesize
This commit is contained in:
@@ -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 ...")
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user