This commit is contained in:
Andrej730
2025-01-20 16:16:33 +05:00
parent 3ad247b9a7
commit c0499a2c88
8 changed files with 13 additions and 16 deletions
-2
View File
@@ -336,5 +336,3 @@ def load_post(scene):
WallAxisDecorator.install(bpy.context)
if model_props.show_slab_direction:
SlabDirectionDecorator.install(bpy.context)
@@ -714,7 +714,7 @@ class MergeIdenticalObjects(bpy.types.Operator, tool.Ifc.Operator):
plural_object_type = f"{object_type.lower()}s"
if merged_data:
for element_type, element_names in merged_data.items():
names = ", ". join([n or "Unnamed" for n in element_names])
names = ", ".join([n or "Unnamed" for n in element_names])
print(f"- {element_type}: {names}")
merged = sum(len(v) for v in merged_data.values())
@@ -3052,7 +3052,6 @@ class OverrideMove(bpy.types.Operator):
obj.select_set(True)
self.new_active_obj = obj
# Get aggregates
props = context.scene.BIMAggregateProperties
not_editing_objs = [o.obj for o in props.not_editing_objects]
@@ -3063,7 +3062,7 @@ class OverrideMove(bpy.types.Operator):
obj.select_set(False)
continue
if obj == props.editing_aggregate:
continue
continue
element = tool.Ifc.get_entity(obj)
if not element or not element.is_a("IfcElement"):
continue
@@ -3072,7 +3071,7 @@ class OverrideMove(bpy.types.Operator):
aggregates_to_move.append(tool.Ifc.get_object(element))
continue
if not parts and props.in_aggregate_mode:
continue
continue
aggregate = ifcopenshell.util.element.get_aggregate(element)
if aggregate:
aggregates_to_move.append(tool.Ifc.get_object(aggregate))
@@ -3098,7 +3097,7 @@ class OverrideMove(bpy.types.Operator):
obj.select_set(False)
continue
if obj == props.editing_nest:
continue
continue
element = tool.Ifc.get_entity(obj)
if not element or not element.is_a("IfcElement"):
continue
@@ -3107,7 +3106,7 @@ class OverrideMove(bpy.types.Operator):
nests_to_move.append(tool.Ifc.get_object(element))
continue
if not components and props.in_nest_mode:
continue
continue
nest = ifcopenshell.util.element.get_nest(element)
if nest:
nests_to_move.append(tool.Ifc.get_object(nest))
@@ -33,6 +33,7 @@ def transparent_color(color, alpha=0.1):
color[3] = alpha
return color
def create_bounding_box(objs):
# Initialize the bounding box coordinates
min_x, min_y, min_z = float("inf"), float("inf"), float("inf")
@@ -77,6 +78,7 @@ def create_bounding_box(objs):
return indices, edges
class NestDecorator:
is_installed = False
handlers = []
@@ -206,7 +208,7 @@ class NestDecorator:
else:
self.draw_batch("POINTS", [location], color)
# if context.scene.BIMNestProperties.in_aggregate_mode:
# return
# return
components = ifcopenshell.util.element.get_components(tool.Ifc.get_entity(nest))
components_objs = [tool.Ifc.get_object(p) for p in components]
components_objs.append(nest)
@@ -227,12 +229,8 @@ class NestModeDecorator:
if cls.is_installed:
cls.uninstall()
handler = cls()
cls.handlers.append(
SpaceView3D.draw_handler_add(handler.draw_nest_name, (context,), "WINDOW", "POST_PIXEL")
)
cls.handlers.append(
SpaceView3D.draw_handler_add(handler.draw_nest_empty, (context,), "WINDOW", "POST_VIEW")
)
cls.handlers.append(SpaceView3D.draw_handler_add(handler.draw_nest_name, (context,), "WINDOW", "POST_PIXEL"))
cls.handlers.append(SpaceView3D.draw_handler_add(handler.draw_nest_empty, (context,), "WINDOW", "POST_VIEW"))
cls.is_installed = True
@classmethod
@@ -49,6 +49,7 @@ class BIMObjectNestProperties(PropertyGroup):
is_editing: BoolProperty(name="Is Editing")
relating_object: PointerProperty(name="Nest Host", type=bpy.types.Object, update=update_relating_object)
def update_nest_decorator(self, context):
if self.nest_decorator:
NestDecorator.install(bpy.context)
+1
View File
@@ -24,6 +24,7 @@ if TYPE_CHECKING:
import ifcopenshell
import bonsai.tool as tool
def enable_editing_nest(nest, obj=None):
nest.enable_editing(obj)
@@ -45,6 +45,7 @@ def validate_type(
:return: True if the representation type was set and it is a valid
combination, or False otherwise.
"""
def is_operand(item):
return (
item.is_a("IfcBooleanResult")
@@ -39,7 +39,6 @@ class TestRemoveBoolean(test.bootstrap.IFC4):
assert set(rep.Items) == {first, second}
assert not self.file.by_type("IfcBooleanResult")
def test_removing_a_top_level_nested_boolean(self):
ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcProject")
model = ifcopenshell.api.context.add_context(self.file, context_type="Model")