mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Add a warning if not all project elements were loaded #5536
Example - https://i.imgur.com/Tu3OOIm.png
This commit is contained in:
@@ -186,6 +186,9 @@ class MaterialCreator:
|
||||
return items
|
||||
|
||||
|
||||
IMPORTER_WARNINGS: list[str] = []
|
||||
|
||||
|
||||
class IfcImporter:
|
||||
def __init__(self, ifc_import_settings: IfcImportSettings):
|
||||
self.ifc_import_settings = ifc_import_settings
|
||||
@@ -315,7 +318,13 @@ class IfcImporter:
|
||||
self.annotations -= drawing_annotations
|
||||
|
||||
self.elements = [e for e in self.elements if not e.is_a("IfcFeatureElement") or e.is_a("IfcSurfaceFeature")]
|
||||
n = len(self.elements)
|
||||
self.elements = set(self.elements[offset:offset_limit])
|
||||
if n > len(self.elements):
|
||||
IMPORTER_WARNINGS.append(
|
||||
f"Not all elements were loaded. Only loaded {(len(self.elements))} of {n} elements (element range: {offset}-{offset_limit}). "
|
||||
"You can change element range by loading project in advanced mode."
|
||||
)
|
||||
|
||||
if self.ifc_import_settings.has_filter or offset or offset_limit < len(self.elements):
|
||||
self.element_types = set([ifcopenshell.util.element.get_type(e) for e in self.elements])
|
||||
|
||||
@@ -774,6 +774,12 @@ class LoadProject(bpy.types.Operator, IFCFileSelector):
|
||||
|
||||
if not self.is_advanced:
|
||||
bpy.ops.bim.load_project_elements()
|
||||
if warnings := import_ifc.IMPORTER_WARNINGS:
|
||||
print("\n\nLoading project finished with warnings:")
|
||||
for warning in warnings:
|
||||
print(f"- {warning}")
|
||||
self.report({"WARNING"}, "Project was loaded with warnings. See system console for details.")
|
||||
warnings.clear()
|
||||
if self.import_without_ifc_data:
|
||||
bpy.ops.bim.convert_to_blender()
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user