mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
info message for amount of purged elements
This commit is contained in:
@@ -256,7 +256,8 @@ class PurgeUnusedRepresentations(bpy.types.Operator, Operator):
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def _execute(self, context):
|
||||
core.purge_unused_representations(tool.Ifc, tool.Geometry)
|
||||
purged_representations = core.purge_unused_representations(tool.Ifc, tool.Geometry)
|
||||
self.report({"INFO"}, f"{purged_representations} representations were purged.")
|
||||
|
||||
|
||||
class UpdateRepresentation(bpy.types.Operator, Operator):
|
||||
|
||||
@@ -223,7 +223,9 @@ class PurgeUnusedProfiles(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
def _execute(self, context):
|
||||
props = context.scene.BIMProfileProperties
|
||||
core.purge_unused_profiles(tool.Ifc, tool.Profile)
|
||||
purged_profiles = core.purge_unused_profiles(tool.Ifc, tool.Profile)
|
||||
self.report({"INFO"}, f"{purged_profiles} profiles were purged.")
|
||||
|
||||
if props.is_editing:
|
||||
refresh()
|
||||
bpy.ops.bim.load_profiles()
|
||||
|
||||
@@ -530,4 +530,5 @@ class PurgeUnusedTypes(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def _execute(self, context):
|
||||
core.purge_unused_types(tool.Ifc, tool.Type)
|
||||
purged_types = core.purge_unused_types(tool.Ifc, tool.Type)
|
||||
self.report({"INFO"}, f"{purged_types} types were purged.")
|
||||
|
||||
@@ -158,9 +158,12 @@ def remove_representation(ifc, geometry, obj=None, representation=None):
|
||||
|
||||
|
||||
def purge_unused_representations(ifc, geometry):
|
||||
purged_representations = 0
|
||||
for representation in geometry.get_model_representations():
|
||||
if ifc.get().get_total_inverses(representation) == 0:
|
||||
ifc.run("geometry.remove_representation", representation=representation)
|
||||
purged_representations += 1
|
||||
return purged_representations
|
||||
|
||||
|
||||
def select_connection(geometry, connection=None):
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
|
||||
|
||||
def purge_unused_profiles(ifc, profile):
|
||||
purged_profiles = 0
|
||||
for element_profile in profile.get_model_profiles():
|
||||
if ifc.get().get_total_inverses(element_profile) > 0:
|
||||
continue
|
||||
ifc.run("profile.remove_profile", profile=element_profile)
|
||||
purged_profiles += 1
|
||||
return purged_profiles
|
||||
|
||||
@@ -32,10 +32,13 @@ def assign_type(ifc, type_tool, element=None, type=None):
|
||||
|
||||
|
||||
def purge_unused_types(ifc, type):
|
||||
purged_types = 0
|
||||
for element_type in type.get_model_types():
|
||||
if not type.get_type_occurrences(element_type):
|
||||
obj = ifc.get_object(element_type)
|
||||
ifc.run("root.remove_product", product=element_type)
|
||||
purged_types += 1
|
||||
if obj:
|
||||
ifc.unlink(obj=obj)
|
||||
type.remove_object(obj)
|
||||
return purged_types
|
||||
|
||||
Reference in New Issue
Block a user