mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
You can now choose whether to use a cache / force reload a linked model
This commit is contained in:
@@ -856,12 +856,15 @@ class LinkIfc(bpy.types.Operator):
|
|||||||
directory: bpy.props.StringProperty(subtype="DIR_PATH")
|
directory: bpy.props.StringProperty(subtype="DIR_PATH")
|
||||||
filter_glob: bpy.props.StringProperty(default="*.ifc", options={"HIDDEN"})
|
filter_glob: bpy.props.StringProperty(default="*.ifc", options={"HIDDEN"})
|
||||||
use_relative_path: bpy.props.BoolProperty(name="Use Relative Path", default=False)
|
use_relative_path: bpy.props.BoolProperty(name="Use Relative Path", default=False)
|
||||||
|
use_cache: bpy.props.BoolProperty(name="Use Cache", default=True)
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
pprops = context.scene.BIMProjectProperties
|
pprops = context.scene.BIMProjectProperties
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
row.prop(self, "use_relative_path")
|
row.prop(self, "use_relative_path")
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
|
row.prop(self, "use_cache")
|
||||||
|
row = self.layout.row()
|
||||||
row.prop(pprops, "false_origin_mode")
|
row.prop(pprops, "false_origin_mode")
|
||||||
if pprops.false_origin_mode == "MANUAL":
|
if pprops.false_origin_mode == "MANUAL":
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
@@ -882,7 +885,7 @@ class LinkIfc(bpy.types.Operator):
|
|||||||
except:
|
except:
|
||||||
pass # Perhaps on another drive or something
|
pass # Perhaps on another drive or something
|
||||||
new.name = filepath
|
new.name = filepath
|
||||||
status = bpy.ops.bim.load_link(filepath=filepath)
|
status = bpy.ops.bim.load_link(filepath=filepath, use_cache=self.use_cache)
|
||||||
if status == {"CANCELLED"}:
|
if status == {"CANCELLED"}:
|
||||||
error_msg = (
|
error_msg = (
|
||||||
f'Error processing IFC file "{self.filepath}" '
|
f'Error processing IFC file "{self.filepath}" '
|
||||||
@@ -960,6 +963,7 @@ class LoadLink(bpy.types.Operator):
|
|||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
bl_description = "Load the selected file"
|
bl_description = "Load the selected file"
|
||||||
filepath: bpy.props.StringProperty()
|
filepath: bpy.props.StringProperty()
|
||||||
|
use_cache: bpy.props.BoolProperty(name="Use Cache", default=True)
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
self.filepath = self.filepath.replace("\\", "/")
|
self.filepath = self.filepath.replace("\\", "/")
|
||||||
@@ -991,6 +995,9 @@ class LoadLink(bpy.types.Operator):
|
|||||||
blend_filepath = self.filepath + ".cache.blend"
|
blend_filepath = self.filepath + ".cache.blend"
|
||||||
h5_filepath = self.filepath + ".cache.h5"
|
h5_filepath = self.filepath + ".cache.h5"
|
||||||
|
|
||||||
|
if not self.use_cache and os.path.exists(blend_filepath):
|
||||||
|
os.remove(blend_filepath)
|
||||||
|
|
||||||
if not os.path.exists(blend_filepath):
|
if not os.path.exists(blend_filepath):
|
||||||
pprops = bpy.context.scene.BIMProjectProperties
|
pprops = bpy.context.scene.BIMProjectProperties
|
||||||
gprops = bpy.context.scene.BIMGeoreferenceProperties
|
gprops = bpy.context.scene.BIMGeoreferenceProperties
|
||||||
|
|||||||
Reference in New Issue
Block a user