mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
Fix Migrate not migrating ifc file header #5903
This commit is contained in:
@@ -312,6 +312,7 @@ class Migrator:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def preprocess(self, old_file: ifcopenshell.file, new_file: ifcopenshell.file) -> None:
|
def preprocess(self, old_file: ifcopenshell.file, new_file: ifcopenshell.file) -> None:
|
||||||
|
new_file.assign_header_from(old_file)
|
||||||
to_delete = set()
|
to_delete = set()
|
||||||
|
|
||||||
if old_file.schema == "IFC2X3" and new_file.schema == "IFC4":
|
if old_file.schema == "IFC2X3" and new_file.schema == "IFC4":
|
||||||
|
|||||||
@@ -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"
|
||||||
Reference in New Issue
Block a user