mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 07:28:38 +00:00
Deprecate purge_module_data in favour of newer refresh_ui_data function.
This commit is contained in:
@@ -177,30 +177,20 @@ def refresh_ui_data():
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if isinstance(tool.Ifc.get(), ifcopenshell.sqlite):
|
# TODO: deprecate prop purge functions and refactor into data classes.
|
||||||
tool.Ifc.get().clear_cache()
|
|
||||||
|
|
||||||
|
|
||||||
def purge_module_data():
|
|
||||||
from blenderbim.bim import modules
|
|
||||||
|
|
||||||
refresh_ui_data()
|
|
||||||
for name, value in modules.items():
|
|
||||||
try:
|
|
||||||
getattr(getattr(getattr(ifcopenshell.api, name), "data"), "Data").purge()
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
getattr(value, "prop").purge()
|
getattr(value, "prop").purge()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if isinstance(tool.Ifc.get(), ifcopenshell.sqlite):
|
||||||
|
tool.Ifc.get().clear_cache()
|
||||||
|
|
||||||
|
|
||||||
@persistent
|
@persistent
|
||||||
def loadIfcStore(scene):
|
def loadIfcStore(scene):
|
||||||
IfcStore.purge()
|
IfcStore.purge()
|
||||||
purge_module_data()
|
refresh_ui_data()
|
||||||
if not IfcStore.get_file():
|
if not IfcStore.get_file():
|
||||||
return
|
return
|
||||||
IfcStore.get_schema()
|
IfcStore.get_schema()
|
||||||
@@ -212,7 +202,7 @@ def undo_post(scene):
|
|||||||
if IfcStore.last_transaction != bpy.context.scene.BIMProperties.last_transaction:
|
if IfcStore.last_transaction != bpy.context.scene.BIMProperties.last_transaction:
|
||||||
IfcStore.last_transaction = bpy.context.scene.BIMProperties.last_transaction
|
IfcStore.last_transaction = bpy.context.scene.BIMProperties.last_transaction
|
||||||
IfcStore.undo(until_key=bpy.context.scene.BIMProperties.last_transaction)
|
IfcStore.undo(until_key=bpy.context.scene.BIMProperties.last_transaction)
|
||||||
purge_module_data()
|
refresh_ui_data()
|
||||||
tool.Ifc.rebuild_element_maps()
|
tool.Ifc.rebuild_element_maps()
|
||||||
|
|
||||||
|
|
||||||
@@ -221,7 +211,7 @@ def redo_post(scene):
|
|||||||
if IfcStore.last_transaction != bpy.context.scene.BIMProperties.last_transaction:
|
if IfcStore.last_transaction != bpy.context.scene.BIMProperties.last_transaction:
|
||||||
IfcStore.last_transaction = bpy.context.scene.BIMProperties.last_transaction
|
IfcStore.last_transaction = bpy.context.scene.BIMProperties.last_transaction
|
||||||
IfcStore.redo(until_key=bpy.context.scene.BIMProperties.last_transaction)
|
IfcStore.redo(until_key=bpy.context.scene.BIMProperties.last_transaction)
|
||||||
purge_module_data()
|
refresh_ui_data()
|
||||||
tool.Ifc.rebuild_element_maps()
|
tool.Ifc.rebuild_element_maps()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import webbrowser
|
|||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from blenderbim.bim.handler import purge_module_data
|
from blenderbim.bim.handler import refresh_ui_data
|
||||||
|
|
||||||
|
|
||||||
class AddCsvAttribute(bpy.types.Operator):
|
class AddCsvAttribute(bpy.types.Operator):
|
||||||
@@ -251,7 +251,7 @@ class ImportIfcCsv(bpy.types.Operator):
|
|||||||
)
|
)
|
||||||
if not props.should_load_from_memory:
|
if not props.should_load_from_memory:
|
||||||
ifc_file.write(props.csv_ifc_file)
|
ifc_file.write(props.csv_ifc_file)
|
||||||
purge_module_data()
|
refresh_ui_data()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class PurgeIfcLinks(bpy.types.Operator):
|
|||||||
context.scene.BIMProperties.ifc_file = ""
|
context.scene.BIMProperties.ifc_file = ""
|
||||||
context.scene.BIMDebugProperties.attributes.clear()
|
context.scene.BIMDebugProperties.attributes.clear()
|
||||||
IfcStore.purge()
|
IfcStore.purge()
|
||||||
blenderbim.bim.handler.purge_module_data()
|
blenderbim.bim.handler.refresh_ui_data()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ class ConvertToBlender(bpy.types.Operator):
|
|||||||
m.BIMMaterialProperties.ifc_style_id = False
|
m.BIMMaterialProperties.ifc_style_id = False
|
||||||
bpy.context.scene.BIMProperties.ifc_file = ""
|
bpy.context.scene.BIMProperties.ifc_file = ""
|
||||||
IfcStore.purge()
|
IfcStore.purge()
|
||||||
blenderbim.bim.handler.purge_module_data()
|
blenderbim.bim.handler.refresh_ui_data()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -720,7 +720,7 @@ class OverrideDuplicateMove(bpy.types.Operator):
|
|||||||
tool.Boundary.decorate_boundary(new_obj)
|
tool.Boundary.decorate_boundary(new_obj)
|
||||||
# Recreate decompositions
|
# Recreate decompositions
|
||||||
tool.Root.recreate_decompositions(relationships, old_to_new)
|
tool.Root.recreate_decompositions(relationships, old_to_new)
|
||||||
blenderbim.bim.handler.purge_module_data()
|
blenderbim.bim.handler.refresh_ui_data()
|
||||||
|
|
||||||
|
|
||||||
class OverrideDuplicateMoveLinkedMacro(bpy.types.Macro):
|
class OverrideDuplicateMoveLinkedMacro(bpy.types.Macro):
|
||||||
@@ -788,7 +788,7 @@ class OverrideDuplicateMoveLinked(bpy.types.Operator):
|
|||||||
old_to_new[tool.Ifc.get_entity(obj)] = new
|
old_to_new[tool.Ifc.get_entity(obj)] = new
|
||||||
# Recreate decompositions
|
# Recreate decompositions
|
||||||
tool.Root.recreate_decompositions(relationships, old_to_new)
|
tool.Root.recreate_decompositions(relationships, old_to_new)
|
||||||
blenderbim.bim.handler.purge_module_data()
|
blenderbim.bim.handler.refresh_ui_data()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -1076,7 +1076,7 @@ class OverrideDuplicateMoveAggregate(bpy.types.Operator):
|
|||||||
|
|
||||||
tool.Root.recreate_decompositions(relationships, old_to_new)
|
tool.Root.recreate_decompositions(relationships, old_to_new)
|
||||||
|
|
||||||
blenderbim.bim.handler.purge_module_data()
|
blenderbim.bim.handler.refresh_ui_data()
|
||||||
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -1223,7 +1223,7 @@ class RefreshAggregate(bpy.types.Operator):
|
|||||||
|
|
||||||
tool.Root.recreate_decompositions(relationships, old_to_new)
|
tool.Root.recreate_decompositions(relationships, old_to_new)
|
||||||
|
|
||||||
blenderbim.bim.handler.purge_module_data()
|
blenderbim.bim.handler.refresh_ui_data()
|
||||||
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
@@ -429,7 +429,7 @@ class AppendLibraryElement(bpy.types.Operator):
|
|||||||
except:
|
except:
|
||||||
# TODO Remove this terrible code when I refactor this into the core
|
# TODO Remove this terrible code when I refactor this into the core
|
||||||
pass
|
pass
|
||||||
blenderbim.bim.handler.purge_module_data()
|
blenderbim.bim.handler.refresh_ui_data()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
def import_material_from_ifc(self, element, context):
|
def import_material_from_ifc(self, element, context):
|
||||||
@@ -1079,7 +1079,7 @@ class ExportIFC(bpy.types.Operator):
|
|||||||
save_blend_file = bool(bpy.data.is_saved and bpy.data.is_dirty and bpy.data.filepath)
|
save_blend_file = bool(bpy.data.is_saved and bpy.data.is_dirty and bpy.data.filepath)
|
||||||
if save_blend_file:
|
if save_blend_file:
|
||||||
bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath)
|
bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath)
|
||||||
blenderbim.bim.handler.purge_module_data()
|
blenderbim.bim.handler.refresh_ui_data()
|
||||||
self.report(
|
self.report(
|
||||||
{"INFO"},
|
{"INFO"},
|
||||||
f'IFC Project "{os.path.basename(output_file)}" {"" if not save_blend_file else "And Current Blend File Are"} Saved',
|
f'IFC Project "{os.path.basename(output_file)}" {"" if not save_blend_file else "And Current Blend File Are"} Saved',
|
||||||
|
|||||||
@@ -58,17 +58,13 @@ class AddPsetTemplateFile(bpy.types.Operator):
|
|||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
template = ifcopenshell.file()
|
template = ifcopenshell.file()
|
||||||
filepath = os.path.join(
|
filepath = os.path.join(context.scene.BIMProperties.data_dir, "pset", self.props.new_template_filename + ".ifc")
|
||||||
context.scene.BIMProperties.data_dir,
|
|
||||||
"pset",
|
|
||||||
self.props.new_template_filename + ".ifc",
|
|
||||||
)
|
|
||||||
|
|
||||||
pset_template = ifcopenshell.api.run("pset_template.add_pset_template", template)
|
pset_template = ifcopenshell.api.run("pset_template.add_pset_template", template)
|
||||||
ifcopenshell.api.run("pset_template.add_prop_template", template, pset_template=pset_template)
|
ifcopenshell.api.run("pset_template.add_prop_template", template, pset_template=pset_template)
|
||||||
template.write(filepath)
|
template.write(filepath)
|
||||||
self.props.new_template_filename = ""
|
self.props.new_template_filename = ""
|
||||||
blenderbim.bim.handler.purge_module_data()
|
blenderbim.bim.handler.refresh_ui_data()
|
||||||
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
|
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
|
||||||
context.scene.BIMPsetTemplateProperties.pset_template_files = filepath
|
context.scene.BIMPsetTemplateProperties.pset_template_files = filepath
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
@@ -227,7 +223,7 @@ class SavePsetTemplateFile(bpy.types.Operator):
|
|||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
IfcStore.pset_template_file.write(IfcStore.pset_template_path)
|
IfcStore.pset_template_file.write(IfcStore.pset_template_path)
|
||||||
blenderbim.bim.handler.purge_module_data()
|
blenderbim.bim.handler.refresh_ui_data()
|
||||||
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
|
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -241,7 +237,7 @@ class RemovePsetTemplateFile(bpy.types.Operator):
|
|||||||
os.remove(IfcStore.pset_template_path)
|
os.remove(IfcStore.pset_template_path)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
blenderbim.bim.handler.purge_module_data()
|
blenderbim.bim.handler.refresh_ui_data()
|
||||||
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
|
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
@@ -212,4 +212,4 @@ class CopyClass(bpy.types.Operator, Operator):
|
|||||||
objects = [bpy.data.objects.get(self.obj)] if self.obj else context.selected_objects
|
objects = [bpy.data.objects.get(self.obj)] if self.obj else context.selected_objects
|
||||||
for obj in objects:
|
for obj in objects:
|
||||||
core.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=obj)
|
core.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=obj)
|
||||||
blenderbim.bim.handler.purge_module_data()
|
blenderbim.bim.handler.refresh_ui_data()
|
||||||
|
|||||||
@@ -33,10 +33,6 @@ from bpy.props import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def purge():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def get_ifc_predefined_types(self, context):
|
def get_ifc_predefined_types(self, context):
|
||||||
if not IfcClassData.is_loaded:
|
if not IfcClassData.is_loaded:
|
||||||
IfcClassData.load()
|
IfcClassData.load()
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class CopyToContainer(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
old_to_new[tool.Ifc.get_entity(obj)] = result_objs
|
old_to_new[tool.Ifc.get_entity(obj)] = result_objs
|
||||||
# Recreate decompositions
|
# Recreate decompositions
|
||||||
tool.Root.recreate_decompositions(relationships, old_to_new)
|
tool.Root.recreate_decompositions(relationships, old_to_new)
|
||||||
blenderbim.bim.handler.purge_module_data()
|
blenderbim.bim.handler.refresh_ui_data()
|
||||||
|
|
||||||
|
|
||||||
class SelectContainer(bpy.types.Operator, tool.Ifc.Operator):
|
class SelectContainer(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
|
|||||||
@@ -31,10 +31,6 @@ from bpy.props import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def purge():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def update_active_specification_index(self, context):
|
def update_active_specification_index(self, context):
|
||||||
TesterData.load()
|
TesterData.load()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user