mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Replace .wrapped_data.header with .header (dfaa8d5)
This commit is contained in:
@@ -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()
|
||||
)
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user