mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
black
This commit is contained in:
@@ -1643,7 +1643,7 @@ class CutDecorator:
|
|||||||
|
|
||||||
# Check if any viewport is in local view - skip decorations if so
|
# Check if any viewport is in local view - skip decorations if so
|
||||||
for area in context.screen.areas:
|
for area in context.screen.areas:
|
||||||
if area.type == 'VIEW_3D':
|
if area.type == "VIEW_3D":
|
||||||
space = area.spaces.active
|
space = area.spaces.active
|
||||||
if isinstance(space, bpy.types.SpaceView3D) and space.local_view:
|
if isinstance(space, bpy.types.SpaceView3D) and space.local_view:
|
||||||
return # Don't draw decorations in local view
|
return # Don't draw decorations in local view
|
||||||
@@ -1995,7 +1995,7 @@ class DecorationsHandler:
|
|||||||
def __call__(self, context):
|
def __call__(self, context):
|
||||||
# Check if any viewport is in local view - skip decorations if so
|
# Check if any viewport is in local view - skip decorations if so
|
||||||
for area in context.screen.areas:
|
for area in context.screen.areas:
|
||||||
if area.type == 'VIEW_3D':
|
if area.type == "VIEW_3D":
|
||||||
space = area.spaces.active
|
space = area.spaces.active
|
||||||
if isinstance(space, bpy.types.SpaceView3D) and space.local_view:
|
if isinstance(space, bpy.types.SpaceView3D) and space.local_view:
|
||||||
return # Don't draw decorations in 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_label = "IFC Duplicate and Move Linked Aggregate"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
|
|
||||||
class DuplicateMoveLinkedAggregate(bpy.types.Operator):
|
class DuplicateMoveLinkedAggregate(bpy.types.Operator):
|
||||||
bl_idname = "bim.object_duplicate_move_linked_aggregate"
|
bl_idname = "bim.object_duplicate_move_linked_aggregate"
|
||||||
bl_label = "IFC Duplicate and 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"])
|
new_obj.name = pset["Name"] + "_" + str(pset["Aggregate_Index"])
|
||||||
|
|
||||||
def get_max_index(parts):
|
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:
|
if psets:
|
||||||
index = max([i["Index"] for i in psets if i])
|
index = max([i["Index"] for i in psets if i])
|
||||||
return index
|
return index
|
||||||
@@ -1315,9 +1320,13 @@ class DuplicateMoveLinkedAggregate(bpy.types.Operator):
|
|||||||
group_elements = []
|
group_elements = []
|
||||||
if new[0].is_a("IfcElementAssembly"):
|
if new[0].is_a("IfcElementAssembly"):
|
||||||
group_elements = next(
|
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 = {
|
properties = {
|
||||||
"Index": pset["Index"],
|
"Index": pset["Index"],
|
||||||
@@ -1410,6 +1419,7 @@ class DuplicateMoveLinkedAggregate(bpy.types.Operator):
|
|||||||
|
|
||||||
return all_old_to_new
|
return all_old_to_new
|
||||||
|
|
||||||
|
|
||||||
class DuplicateLinkedAggregateTo3dCursor(bpy.types.Operator):
|
class DuplicateLinkedAggregateTo3dCursor(bpy.types.Operator):
|
||||||
bl_idname = "bim.duplicate_linked_aggregate_to_3d_cursor"
|
bl_idname = "bim.duplicate_linked_aggregate_to_3d_cursor"
|
||||||
bl_label = "IFC Duplicate Linked Aggregate to 3d Cursor"
|
bl_label = "IFC Duplicate Linked Aggregate to 3d Cursor"
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class CalculateSingleQuantity(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
}
|
}
|
||||||
|
|
||||||
ifc_file = tool.Ifc.get()
|
ifc_file = tool.Ifc.get()
|
||||||
with(Profiler("Quantify function time:")):
|
with Profiler("Quantify function time:"):
|
||||||
results = ifc5d.qto.quantify(ifc_file, elements, rules)
|
results = ifc5d.qto.quantify(ifc_file, elements, rules)
|
||||||
ifc5d.qto.edit_qtos(ifc_file, results)
|
ifc5d.qto.edit_qtos(ifc_file, results)
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ class PerformQuantityTakeOff(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
) -> set[ifcopenshell.entity_instance]:
|
) -> set[ifcopenshell.entity_instance]:
|
||||||
rules = ifc5d.qto.rules[rule]
|
rules = ifc5d.qto.rules[rule]
|
||||||
ifc_file = tool.Ifc.get()
|
ifc_file = tool.Ifc.get()
|
||||||
with(Profiler("Quantify function time:")):
|
with Profiler("Quantify function time:"):
|
||||||
results = ifc5d.qto.quantify(ifc_file, elements, rules)
|
results = ifc5d.qto.quantify(ifc_file, elements, rules)
|
||||||
ifc5d.qto.edit_qtos(ifc_file, results)
|
ifc5d.qto.edit_qtos(ifc_file, results)
|
||||||
not_quantified_elements = elements - set(results.keys())
|
not_quantified_elements = elements - set(results.keys())
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ def edit_assigned_product(
|
|||||||
|
|
||||||
# Get ALL existing products, not just one
|
# Get ALL existing products, not just one
|
||||||
existing_products = []
|
existing_products = []
|
||||||
if hasattr(element, 'HasAssignments'):
|
if hasattr(element, "HasAssignments"):
|
||||||
for rel in element.HasAssignments:
|
for rel in element.HasAssignments:
|
||||||
if rel.is_a('IfcRelAssignsToProduct'):
|
if rel.is_a("IfcRelAssignsToProduct"):
|
||||||
existing_products.append(rel.RelatingProduct)
|
existing_products.append(rel.RelatingProduct)
|
||||||
|
|
||||||
# Only proceed if the assignment is different
|
# Only proceed if the assignment is different
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
from timeit import default_timer as timer
|
from timeit import default_timer as timer
|
||||||
|
|
||||||
|
|
||||||
class Profiler:
|
class Profiler:
|
||||||
"""
|
"""
|
||||||
A python context manager timing utility, useful for measure functions performances
|
A python context manager timing utility, useful for measure functions performances
|
||||||
|
|||||||
Reference in New Issue
Block a user