From cc7732ecbf5ab2e1681af6246529d6166e7cec5b Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 15 Sep 2025 16:47:09 +0500 Subject: [PATCH] Replace `.wrapped_data.header` with `.header` (dfaa8d5) --- src/bonsai/bonsai/bim/export_ifc.py | 8 ++-- src/bonsai/bonsai/bim/ifc.py | 2 +- .../bonsai/bim/module/debug/operator.py | 4 +- src/bonsai/bonsai/bim/module/project/data.py | 2 +- .../bonsai/bim/module/project/operator.py | 40 +++++++++---------- src/bonsai/bonsai/bim/module/project/ui.py | 2 +- src/ifc2ca/_deprecated/ca2ifc.py | 2 +- .../features/steps/application/en.py | 2 +- src/ifcpatch/ifcpatch/recipes/PurgeData.py | 8 ++-- 9 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/bonsai/bonsai/bim/export_ifc.py b/src/bonsai/bonsai/bim/export_ifc.py index 87589b099b..5fe5a1df97 100644 --- a/src/bonsai/bonsai/bim/export_ifc.py +++ b/src/bonsai/bonsai/bim/export_ifc.py @@ -74,12 +74,12 @@ class IfcExporter: json.dump(jsonData, outfile, indent=None if self.ifc_export_settings.json_compact else 4) def set_header(self): - self.file.wrapped_data.header.file_name.name = os.path.basename(self.ifc_export_settings.output_file) - self.file.wrapped_data.header.file_name.time_stamp = ( + self.file.header.file_name.name = os.path.basename(self.ifc_export_settings.output_file) + self.file.header.file_name.time_stamp = ( datetime.datetime.utcnow().replace(tzinfo=datetime.UTC).astimezone().replace(microsecond=0).isoformat() ) - self.file.wrapped_data.header.file_name.preprocessor_version = "IfcOpenShell {}".format(ifcopenshell.version) - self.file.wrapped_data.header.file_name.originating_system = "{} {}".format( + self.file.header.file_name.preprocessor_version = "IfcOpenShell {}".format(ifcopenshell.version) + self.file.header.file_name.originating_system = "{} {}".format( self.get_application_name(), tool.Blender.get_bonsai_version() ) diff --git a/src/bonsai/bonsai/bim/ifc.py b/src/bonsai/bonsai/bim/ifc.py index 3a12de13e1..881de8adf9 100644 --- a/src/bonsai/bonsai/bim/ifc.py +++ b/src/bonsai/bonsai/bim/ifc.py @@ -132,7 +132,7 @@ class IfcStore: def generate_cache_path() -> str: """Generate cache path based on the active file and it's path.""" assert IfcStore.file - ifc_key = IfcStore.path + IfcStore.file.wrapped_data.header.file_name.time_stamp + ifc_key = IfcStore.path + IfcStore.file.header.file_name.time_stamp ifc_hash = hashlib.md5(ifc_key.encode("utf-8")).hexdigest() prefs = tool.Blender.get_addon_preferences() cache_path = os.path.join(prefs.cache_dir, f"{ifc_hash}.h5") diff --git a/src/bonsai/bonsai/bim/module/debug/operator.py b/src/bonsai/bonsai/bim/module/debug/operator.py index 6c6ea29eb2..8a85f24d1e 100644 --- a/src/bonsai/bonsai/bim/module/debug/operator.py +++ b/src/bonsai/bonsai/bim/module/debug/operator.py @@ -60,8 +60,8 @@ class CopyDebugInformation(bpy.types.Operator): { "ifc": os.path.basename(tool.Ifc.get_path()) if os.path.isfile(tool.Ifc.get_path()) else "Unsaved", "schema": tool.Ifc.get().schema, - "preprocessor_version": tool.Ifc.get().wrapped_data.header.file_name.preprocessor_version, - "originating_system": tool.Ifc.get().wrapped_data.header.file_name.originating_system, + "preprocessor_version": tool.Ifc.get().header.file_name.preprocessor_version, + "originating_system": tool.Ifc.get().header.file_name.originating_system, } ) diff --git a/src/bonsai/bonsai/bim/module/project/data.py b/src/bonsai/bonsai/bim/module/project/data.py index d391c172c1..9ced81da06 100644 --- a/src/bonsai/bonsai/bim/module/project/data.py +++ b/src/bonsai/bonsai/bim/module/project/data.py @@ -96,7 +96,7 @@ class ProjectData: if not ifc: return "" try: - save_datetime = ifc.wrapped_data.header.file_name.time_stamp + save_datetime = ifc.header.file_name.time_stamp save_date, save_time = save_datetime.split("T") return f"{save_date} {':'.join(save_time.split(':')[0:2])}" except: diff --git a/src/bonsai/bonsai/bim/module/project/operator.py b/src/bonsai/bonsai/bim/module/project/operator.py index 8ef95b19e1..609611e910 100644 --- a/src/bonsai/bonsai/bim/module/project/operator.py +++ b/src/bonsai/bonsai/bim/module/project/operator.py @@ -850,25 +850,25 @@ class EnableEditingHeader(bpy.types.Operator): props = tool.Project.get_project_props() props.is_editing = True - mvd = "".join(tool.Ifc.get().wrapped_data.header.file_description.description) + mvd = "".join(tool.Ifc.get().header.file_description.description) if "[" in mvd: props.mvd = mvd.split("[")[1][0:-1] else: props.mvd = "" - author = self.file.wrapped_data.header.file_name.author + author = self.file.header.file_name.author if author: props.author_name = author[0] if len(author) > 1: props.author_email = author[1] - organisation = self.file.wrapped_data.header.file_name.organization + organisation = self.file.header.file_name.organization if organisation: props.organisation_name = organisation[0] if len(organisation) > 1: props.organisation_email = organisation[1] - props.authorisation = self.file.wrapped_data.header.file_name.authorization or "" + props.authorisation = self.file.header.file_name.authorization or "" return {"FINISHED"} @@ -897,35 +897,35 @@ class EditHeader(bpy.types.Operator): props = tool.Project.get_project_props() props.is_editing = True - self.file.wrapped_data.header.file_description.description = (f"ViewDefinition[{props.mvd}]",) - self.file.wrapped_data.header.file_name.author = (props.author_name, props.author_email) - self.file.wrapped_data.header.file_name.organization = (props.organisation_name, props.organisation_email) - self.file.wrapped_data.header.file_name.authorization = props.authorisation + self.file.header.file_description.description = (f"ViewDefinition[{props.mvd}]",) + self.file.header.file_name.author = (props.author_name, props.author_email) + self.file.header.file_name.organization = (props.organisation_name, props.organisation_email) + self.file.header.file_name.authorization = props.authorisation bpy.ops.bim.disable_editing_header() return {"FINISHED"} def record_state(self): self.file = tool.Ifc.get() return { - "description": self.file.wrapped_data.header.file_description.description, - "author": self.file.wrapped_data.header.file_name.author, - "organisation": self.file.wrapped_data.header.file_name.organization, - "authorisation": self.file.wrapped_data.header.file_name.authorization, + "description": self.file.header.file_description.description, + "author": self.file.header.file_name.author, + "organisation": self.file.header.file_name.organization, + "authorisation": self.file.header.file_name.authorization, } def rollback(self, data): file = tool.Ifc.get() - file.wrapped_data.header.file_description.description = data["old"]["description"] - file.wrapped_data.header.file_name.author = data["old"]["author"] - file.wrapped_data.header.file_name.organization = data["old"]["organisation"] - file.wrapped_data.header.file_name.authorization = data["old"]["authorisation"] + file.header.file_description.description = data["old"]["description"] + file.header.file_name.author = data["old"]["author"] + file.header.file_name.organization = data["old"]["organisation"] + file.header.file_name.authorization = data["old"]["authorisation"] def commit(self, data): file = tool.Ifc.get() - file.wrapped_data.header.file_description.description = data["new"]["description"] - file.wrapped_data.header.file_name.author = data["new"]["author"] - file.wrapped_data.header.file_name.organization = data["new"]["organisation"] - file.wrapped_data.header.file_name.authorization = data["new"]["authorisation"] + file.header.file_description.description = data["new"]["description"] + file.header.file_name.author = data["new"]["author"] + file.header.file_name.organization = data["new"]["organisation"] + file.header.file_name.authorization = data["new"]["authorisation"] class DisableEditingHeader(bpy.types.Operator): diff --git a/src/bonsai/bonsai/bim/module/project/ui.py b/src/bonsai/bonsai/bim/module/project/ui.py index def94cf0f2..341f463981 100644 --- a/src/bonsai/bonsai/bim/module/project/ui.py +++ b/src/bonsai/bonsai/bim/module/project/ui.py @@ -288,7 +288,7 @@ class BIM_PT_project(Panel): if isinstance(ifc_file, ifcopenshell.sqlite): mvd = ifc_file.mvd_str else: - mvd = "".join(ifc_file.wrapped_data.header.file_description.description) + mvd = "".join(ifc_file.header.file_description.description) if "[" in mvd: mvd = mvd.split("[")[1][0:-1] row.label(text=mvd) diff --git a/src/ifc2ca/_deprecated/ca2ifc.py b/src/ifc2ca/_deprecated/ca2ifc.py index 917ad34eb0..5f9115396e 100644 --- a/src/ifc2ca/_deprecated/ca2ifc.py +++ b/src/ifc2ca/_deprecated/ca2ifc.py @@ -309,7 +309,7 @@ class CA2IFC: return ifcopenshell.guid.new() def create_header(self): - self.f.wrapped_data.header.file_name.name = os.path.basename(self.outputFilename) + self.f.header.file_name.name = os.path.basename(self.outputFilename) def create_global_axes(self): self.xAxis = self.f.createIfcDirection((1.0, 0.0, 0.0)) diff --git a/src/ifcbimtester/bimtester/features/steps/application/en.py b/src/ifcbimtester/bimtester/features/steps/application/en.py index 9248b5d776..b2dbd5ffe7 100644 --- a/src/ifcbimtester/bimtester/features/steps/application/en.py +++ b/src/ifcbimtester/bimtester/features/steps/application/en.py @@ -59,7 +59,7 @@ def step_impl(context, version): ) def step_impl(context, header_file_description): - is_header_file_description = IfcStore.file.wrapped_data.header.file_description.description + is_header_file_description = IfcStore.file.header.file_description.description assert ( str(is_header_file_description) == header_file_description ), "The file was not exported by the new ifc exporter in Allplan. File description header: {}".format( diff --git a/src/ifcpatch/ifcpatch/recipes/PurgeData.py b/src/ifcpatch/ifcpatch/recipes/PurgeData.py index 871120840f..5ef1af6102 100644 --- a/src/ifcpatch/ifcpatch/recipes/PurgeData.py +++ b/src/ifcpatch/ifcpatch/recipes/PurgeData.py @@ -55,16 +55,16 @@ class Patcher: self.logger = logger def patch(self): - self.file.wrapped_data.header.file_name.name = "Rabbit" - self.file.wrapped_data.header.file_name.time_stamp = ( + self.file.header.file_name.name = "Rabbit" + self.file.header.file_name.time_stamp = ( datetime.datetime.utcnow() .replace(tzinfo=datetime.timezone.utc) .astimezone() .replace(microsecond=0) .isoformat() ) - self.file.wrapped_data.header.file_name.preprocessor_version = "Rabbit" - self.file.wrapped_data.header.file_name.originating_system = "Rabbit" + self.file.header.file_name.preprocessor_version = "Rabbit" + self.file.header.file_name.originating_system = "Rabbit" for element in self.file.by_type("IfcApplication"): element.Version = "Rabbit"