mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +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"])
|
patcher = recipe.Patcher(args["input"], ifc_file, logger, args["arguments"])
|
||||||
print("# Patching ...")
|
print("# Patching ...")
|
||||||
patcher.patch()
|
patcher.patch()
|
||||||
ifc_file = patcher.file
|
ifc_file = getattr(patcher, "file_patched", patcher.file)
|
||||||
if is_library is True:
|
if is_library is True:
|
||||||
return ifc_file
|
return ifc_file
|
||||||
print("# Writing patched file ...")
|
print("# Writing patched file ...")
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ class Patcher:
|
|||||||
self.args = args
|
self.args = args
|
||||||
|
|
||||||
def patch(self):
|
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()
|
migrator = ifcopenshell.util.schema.Migrator()
|
||||||
for element in self.file:
|
for element in self.file:
|
||||||
|
migrator.migrate(element, self.file_patched)
|
||||||
print("Migrating", element)
|
print("Migrating", element)
|
||||||
print("Successfully converted to", migrator.migrate(element, self.new))
|
print("Successfully converted to", migrator.migrate(element, self.file_patched))
|
||||||
self.file = self.new
|
|
||||||
|
|||||||
Reference in New Issue
Block a user