You can now select geometry library in advanced settings

This commit is contained in:
Dion Moult
2024-08-29 16:22:10 +10:00
parent 2b70f12d44
commit 80a396dc12
3 changed files with 23 additions and 2 deletions
+12 -2
View File
@@ -715,9 +715,17 @@ class IfcImporter:
if not products:
return results
if tool.Loader.settings.should_use_cpu_multiprocessing:
iterator = ifcopenshell.geom.iterator(settings, self.file, multiprocessing.cpu_count(), include=products)
iterator = ifcopenshell.geom.iterator(
settings,
self.file,
multiprocessing.cpu_count(),
include=products,
geometry_library=self.ifc_import_settings.geometry_library,
)
else:
iterator = ifcopenshell.geom.iterator(settings, self.file, include=products)
iterator = ifcopenshell.geom.iterator(
settings, self.file, include=products, geometry_library=self.ifc_import_settings.geometry_library
)
if self.ifc_import_settings.should_cache:
cache = IfcStore.get_cache()
if cache:
@@ -1473,6 +1481,7 @@ class IfcImportSettings:
self.logger: logging.Logger = None
self.input_file = None
self.diff_file = None
self.geometry_library = "opencascade"
self.should_use_cpu_multiprocessing = True
self.should_merge_materials_by_colour = False
self.should_load_geometry = True
@@ -1508,6 +1517,7 @@ class IfcImportSettings:
logger = logging.getLogger("ImportIFC")
settings.logger = logger
settings.diff_file = scene_diff.diff_json_file
settings.geometry_library = props.geometry_library
settings.should_use_cpu_multiprocessing = props.should_use_cpu_multiprocessing
settings.should_merge_materials_by_colour = props.should_merge_materials_by_colour
settings.should_load_geometry = props.should_load_geometry
@@ -143,6 +143,15 @@ class BIMProjectProperties(PropertyGroup):
active_filter_category_index: IntProperty(name="Active Filter Category Index")
filter_query: StringProperty(name="Filter Query")
should_filter_spatial_elements: BoolProperty(name="Filter Spatial Elements", default=False)
geometry_library: bpy.props.EnumProperty(
items=[
("opencascade", "OpenCASCADE", "Best for stability and accuracy"),
("cgal", "CGAL", "Best for speed"),
("cgal-simple", "CGAL Simple", "CGAL without booleans"),
("hybrid-cgal-simple-opencascade", "Hybrid CGAL-OCC", "First CGAL then fallback to OCC"),
],
name="Geometry Library",
)
should_use_cpu_multiprocessing: BoolProperty(name="CPU Multiprocessing", default=True)
should_merge_materials_by_colour: BoolProperty(name="Merge Materials by Colour", default=False)
should_stream: BoolProperty(name="Stream Data From IFC-SPF (Only for advanced users)", default=False)
@@ -175,6 +175,8 @@ class BIM_PT_project(Panel):
row = self.layout.row()
row.prop(pprops, "should_merge_materials_by_colour")
row = self.layout.row()
row.prop(pprops, "geometry_library")
row = self.layout.row()
row.prop(pprops, "deflection_tolerance")
row = self.layout.row()
row.prop(pprops, "angular_tolerance")