#2224 Cache seems unstable for some large models so allow option to disable

This commit is contained in:
Dion Moult
2022-06-08 11:56:22 +10:00
parent a1ed78e755
commit d76679a45f
3 changed files with 12 additions and 6 deletions
+10 -6
View File
@@ -683,9 +683,10 @@ class IfcImporter:
)
else:
iterator = ifcopenshell.geom.iterator(self.settings, self.file, include=products)
cache = IfcStore.get_cache()
if cache:
iterator.set_cache(cache)
if self.ifc_import_settings.should_cache:
cache = IfcStore.get_cache()
if cache:
iterator.set_cache(cache)
valid_file = iterator.initialize()
if not valid_file:
return results
@@ -832,9 +833,10 @@ class IfcImporter:
)
else:
iterator = ifcopenshell.geom.iterator(self.settings_2d, self.file, include=products)
cache = IfcStore.get_cache()
if cache:
iterator.set_cache(cache)
if self.ifc_import_settings.should_cache:
cache = IfcStore.get_cache()
if cache:
iterator.set_cache(cache)
valid_file = iterator.initialize()
if not valid_file:
return results
@@ -1925,6 +1927,7 @@ class IfcImportSettings:
self.should_merge_materials_by_colour = False
self.should_use_native_meshes = False
self.should_clean_mesh = True
self.should_cache = True
self.deflection_tolerance = 0.001
self.angular_tolerance = 0.5
self.distance_limit = 1000
@@ -1953,6 +1956,7 @@ class IfcImportSettings:
settings.should_merge_materials_by_colour = props.should_merge_materials_by_colour
settings.should_use_native_meshes = props.should_use_native_meshes
settings.should_clean_mesh = props.should_clean_mesh
settings.should_cache = props.should_cache
settings.deflection_tolerance = props.deflection_tolerance
settings.angular_tolerance = props.angular_tolerance
settings.distance_limit = props.distance_limit
@@ -141,6 +141,7 @@ class BIMProjectProperties(PropertyGroup):
should_merge_materials_by_colour: BoolProperty(name="Import and Merge Materials by Colour", default=False)
should_clean_mesh: BoolProperty(name="Import and Clean Mesh", default=True)
should_use_native_meshes: BoolProperty(name="Native Meshes", default=False)
should_cache: BoolProperty(name="Cache", default=False)
deflection_tolerance: FloatProperty(name="Deflection Tolerance", default=0.001)
angular_tolerance: FloatProperty(name="Angular Tolerance", default=0.5)
distance_limit: FloatProperty(name="Distance Limit", default=1000)
@@ -76,6 +76,7 @@ class BIM_PT_project(Panel):
row = self.layout.row()
row.prop(pprops, "should_merge_by_class")
row = self.layout.row()
row.prop(pprops, "should_cache")
row.prop(pprops, "should_merge_by_material")
row = self.layout.row()
row.prop(pprops, "should_use_native_meshes")