mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
black .
This commit is contained in:
@@ -336,5 +336,3 @@ def load_post(scene):
|
|||||||
WallAxisDecorator.install(bpy.context)
|
WallAxisDecorator.install(bpy.context)
|
||||||
if model_props.show_slab_direction:
|
if model_props.show_slab_direction:
|
||||||
SlabDirectionDecorator.install(bpy.context)
|
SlabDirectionDecorator.install(bpy.context)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -714,7 +714,7 @@ class MergeIdenticalObjects(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
plural_object_type = f"{object_type.lower()}s"
|
plural_object_type = f"{object_type.lower()}s"
|
||||||
if merged_data:
|
if merged_data:
|
||||||
for element_type, element_names in merged_data.items():
|
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}")
|
print(f"- {element_type}: {names}")
|
||||||
merged = sum(len(v) for v in merged_data.values())
|
merged = sum(len(v) for v in merged_data.values())
|
||||||
|
|
||||||
|
|||||||
@@ -3052,7 +3052,6 @@ class OverrideMove(bpy.types.Operator):
|
|||||||
obj.select_set(True)
|
obj.select_set(True)
|
||||||
self.new_active_obj = obj
|
self.new_active_obj = obj
|
||||||
|
|
||||||
|
|
||||||
# Get aggregates
|
# Get aggregates
|
||||||
props = context.scene.BIMAggregateProperties
|
props = context.scene.BIMAggregateProperties
|
||||||
not_editing_objs = [o.obj for o in props.not_editing_objects]
|
not_editing_objs = [o.obj for o in props.not_editing_objects]
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ def transparent_color(color, alpha=0.1):
|
|||||||
color[3] = alpha
|
color[3] = alpha
|
||||||
return color
|
return color
|
||||||
|
|
||||||
|
|
||||||
def create_bounding_box(objs):
|
def create_bounding_box(objs):
|
||||||
# Initialize the bounding box coordinates
|
# Initialize the bounding box coordinates
|
||||||
min_x, min_y, min_z = float("inf"), float("inf"), float("inf")
|
min_x, min_y, min_z = float("inf"), float("inf"), float("inf")
|
||||||
@@ -77,6 +78,7 @@ def create_bounding_box(objs):
|
|||||||
|
|
||||||
return indices, edges
|
return indices, edges
|
||||||
|
|
||||||
|
|
||||||
class NestDecorator:
|
class NestDecorator:
|
||||||
is_installed = False
|
is_installed = False
|
||||||
handlers = []
|
handlers = []
|
||||||
@@ -206,7 +208,7 @@ class NestDecorator:
|
|||||||
else:
|
else:
|
||||||
self.draw_batch("POINTS", [location], color)
|
self.draw_batch("POINTS", [location], color)
|
||||||
# if context.scene.BIMNestProperties.in_aggregate_mode:
|
# if context.scene.BIMNestProperties.in_aggregate_mode:
|
||||||
# return
|
# return
|
||||||
components = ifcopenshell.util.element.get_components(tool.Ifc.get_entity(nest))
|
components = ifcopenshell.util.element.get_components(tool.Ifc.get_entity(nest))
|
||||||
components_objs = [tool.Ifc.get_object(p) for p in components]
|
components_objs = [tool.Ifc.get_object(p) for p in components]
|
||||||
components_objs.append(nest)
|
components_objs.append(nest)
|
||||||
@@ -227,12 +229,8 @@ class NestModeDecorator:
|
|||||||
if cls.is_installed:
|
if cls.is_installed:
|
||||||
cls.uninstall()
|
cls.uninstall()
|
||||||
handler = cls()
|
handler = cls()
|
||||||
cls.handlers.append(
|
cls.handlers.append(SpaceView3D.draw_handler_add(handler.draw_nest_name, (context,), "WINDOW", "POST_PIXEL"))
|
||||||
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_empty, (context,), "WINDOW", "POST_VIEW")
|
|
||||||
)
|
|
||||||
cls.is_installed = True
|
cls.is_installed = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class BIMObjectNestProperties(PropertyGroup):
|
|||||||
is_editing: BoolProperty(name="Is Editing")
|
is_editing: BoolProperty(name="Is Editing")
|
||||||
relating_object: PointerProperty(name="Nest Host", type=bpy.types.Object, update=update_relating_object)
|
relating_object: PointerProperty(name="Nest Host", type=bpy.types.Object, update=update_relating_object)
|
||||||
|
|
||||||
|
|
||||||
def update_nest_decorator(self, context):
|
def update_nest_decorator(self, context):
|
||||||
if self.nest_decorator:
|
if self.nest_decorator:
|
||||||
NestDecorator.install(bpy.context)
|
NestDecorator.install(bpy.context)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ if TYPE_CHECKING:
|
|||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import bonsai.tool as tool
|
import bonsai.tool as tool
|
||||||
|
|
||||||
|
|
||||||
def enable_editing_nest(nest, obj=None):
|
def enable_editing_nest(nest, obj=None):
|
||||||
nest.enable_editing(obj)
|
nest.enable_editing(obj)
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ def validate_type(
|
|||||||
:return: True if the representation type was set and it is a valid
|
:return: True if the representation type was set and it is a valid
|
||||||
combination, or False otherwise.
|
combination, or False otherwise.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def is_operand(item):
|
def is_operand(item):
|
||||||
return (
|
return (
|
||||||
item.is_a("IfcBooleanResult")
|
item.is_a("IfcBooleanResult")
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ class TestRemoveBoolean(test.bootstrap.IFC4):
|
|||||||
assert set(rep.Items) == {first, second}
|
assert set(rep.Items) == {first, second}
|
||||||
assert not self.file.by_type("IfcBooleanResult")
|
assert not self.file.by_type("IfcBooleanResult")
|
||||||
|
|
||||||
|
|
||||||
def test_removing_a_top_level_nested_boolean(self):
|
def test_removing_a_top_level_nested_boolean(self):
|
||||||
ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcProject")
|
ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcProject")
|
||||||
model = ifcopenshell.api.context.add_context(self.file, context_type="Model")
|
model = ifcopenshell.api.context.add_context(self.file, context_type="Model")
|
||||||
|
|||||||
Reference in New Issue
Block a user