Fix Migrate not migrating ifc file header #5903

This commit is contained in:
Andrej730
2024-12-23 12:33:28 +05:00
parent d0e2995a84
commit 6edc6cec71
2 changed files with 30 additions and 0 deletions
@@ -312,6 +312,7 @@ class Migrator:
}
def preprocess(self, old_file: ifcopenshell.file, new_file: ifcopenshell.file) -> None:
new_file.assign_header_from(old_file)
to_delete = set()
if old_file.schema == "IFC2X3" and new_file.schema == "IFC4":
+29
View File
@@ -0,0 +1,29 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2022 Dion Moult <dion@thinkmoult.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcpatch
import ifcopenshell
import test.bootstrap
class TestMigrate(test.bootstrap.IFC4):
def test_migrate_header(self):
old_file = self.file
old_file.header.file_name.name = "test"
new_file = ifcpatch.execute({"file": old_file, "recipe": "Migrate", "arguments": ["IFC4"]})
assert new_file.header.file_name.name == "test"