This commit is contained in:
Thomas Krijnen
2025-11-10 11:53:33 +01:00
parent 8d8133e780
commit 05e81040ce
5 changed files with 34 additions and 23 deletions
@@ -1643,7 +1643,7 @@ class CutDecorator:
# Check if any viewport is in local view - skip decorations if so
for area in context.screen.areas:
if area.type == 'VIEW_3D':
if area.type == "VIEW_3D":
space = area.spaces.active
if isinstance(space, bpy.types.SpaceView3D) and space.local_view:
return # Don't draw decorations in local view
@@ -1995,7 +1995,7 @@ class DecorationsHandler:
def __call__(self, context):
# Check if any viewport is in local view - skip decorations if so
for area in context.screen.areas:
if area.type == 'VIEW_3D':
if area.type == "VIEW_3D":
space = area.spaces.active
if isinstance(space, bpy.types.SpaceView3D) and space.local_view:
return # Don't draw decorations in local view
@@ -1204,6 +1204,7 @@ class DuplicateMoveLinkedAggregateMacro(bpy.types.Macro):
bl_label = "IFC Duplicate and Move Linked Aggregate"
bl_options = {"REGISTER", "UNDO"}
class DuplicateMoveLinkedAggregate(bpy.types.Operator):
bl_idname = "bim.object_duplicate_move_linked_aggregate"
bl_label = "IFC Duplicate and Move Linked Aggregate"
@@ -1289,7 +1290,11 @@ class DuplicateMoveLinkedAggregate(bpy.types.Operator):
new_obj.name = pset["Name"] + "_" + str(pset["Aggregate_Index"])
def get_max_index(parts):
psets = [ifcopenshell.util.element.get_pset(p, "BBIM_Linked_Aggregate") for p in parts if ifcopenshell.util.element.get_pset(p, "BBIM_Linked_Aggregate")]
psets = [
ifcopenshell.util.element.get_pset(p, "BBIM_Linked_Aggregate")
for p in parts
if ifcopenshell.util.element.get_pset(p, "BBIM_Linked_Aggregate")
]
if psets:
index = max([i["Index"] for i in psets if i])
return index
@@ -1315,9 +1320,13 @@ class DuplicateMoveLinkedAggregate(bpy.types.Operator):
group_elements = []
if new[0].is_a("IfcElementAssembly"):
group_elements = next(
(r.RelatedObjects for r in getattr(new[0], "HasAssignments", []) or []
if r.is_a("IfcRelAssignsToGroup") and "BBIM_Linked_Aggregate" in r.RelatingGroup.Name),
[]
(
r.RelatedObjects
for r in getattr(new[0], "HasAssignments", []) or []
if r.is_a("IfcRelAssignsToGroup")
and "BBIM_Linked_Aggregate" in r.RelatingGroup.Name
),
[],
)
properties = {
"Index": pset["Index"],
@@ -1410,6 +1419,7 @@ class DuplicateMoveLinkedAggregate(bpy.types.Operator):
return all_old_to_new
class DuplicateLinkedAggregateTo3dCursor(bpy.types.Operator):
bl_idname = "bim.duplicate_linked_aggregate_to_3d_cursor"
bl_label = "IFC Duplicate Linked Aggregate to 3d Cursor"
+2 -2
View File
@@ -149,7 +149,7 @@ class CalculateSingleQuantity(bpy.types.Operator, tool.Ifc.Operator):
}
ifc_file = tool.Ifc.get()
with(Profiler("Quantify function time:")):
with Profiler("Quantify function time:"):
results = ifc5d.qto.quantify(ifc_file, elements, rules)
ifc5d.qto.edit_qtos(ifc_file, results)
@@ -192,7 +192,7 @@ class PerformQuantityTakeOff(bpy.types.Operator, tool.Ifc.Operator):
) -> set[ifcopenshell.entity_instance]:
rules = ifc5d.qto.rules[rule]
ifc_file = tool.Ifc.get()
with(Profiler("Quantify function time:")):
with Profiler("Quantify function time:"):
results = ifc5d.qto.quantify(ifc_file, elements, rules)
ifc5d.qto.edit_qtos(ifc_file, results)
not_quantified_elements = elements - set(results.keys())
+2 -2
View File
@@ -63,9 +63,9 @@ def edit_assigned_product(
# Get ALL existing products, not just one
existing_products = []
if hasattr(element, 'HasAssignments'):
if hasattr(element, "HasAssignments"):
for rel in element.HasAssignments:
if rel.is_a('IfcRelAssignsToProduct'):
if rel.is_a("IfcRelAssignsToProduct"):
existing_products.append(rel.RelatingProduct)
# Only proceed if the assignment is different
@@ -19,6 +19,7 @@
from timeit import default_timer as timer
class Profiler:
"""
A python context manager timing utility, useful for measure functions performances