Applied formatting

This commit is contained in:
Robin Quint
2025-08-18 17:22:51 +02:00
committed by Ryan Schultz
parent 01a5e457a2
commit f576c58c05
7 changed files with 16 additions and 13 deletions
@@ -2728,14 +2728,13 @@ class OverrideModeSetObject(bpy.types.Operator, tool.Ifc.Operator):
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
builder.mirror(new_mirrored_repr, (1, 0), create_copy=False)
new_items.append(new_mirrored_repr)
old_items = mirrored_type.RepresentationMaps[map_index].MappedRepresentation.Items
mirrored_type.RepresentationMaps[map_index].MappedRepresentation.Items = new_items
for old_item in old_items:
ifcopenshell.util.element.remove_deep2(tool.Ifc.get(), old_item)
tool.Geometry.reload_representation(tool.Ifc.get_object(mirrored_type))
tool.Geometry.reload_representation(tool.Ifc.get_object(mirrored_type))
def enable_edit_mode(self, context):
if tool.Blender.toggle_edit_mode(context) == {"CANCELLED"}:
@@ -666,9 +666,9 @@ class EditAssignedMaterial(bpy.types.Operator, tool.Ifc.Operator):
mirrored_type = tool.Blender.Modifier.has_mirrored_type(type_element)
if not mirrored_type:
return
ifcopenshell.api.material.assign_material(tool.Ifc.get(), [ mirrored_type ], material.is_a(), material)
tool.Material.ensure_material_assigned([ mirrored_type ], material.is_a(), material)
ifcopenshell.api.material.assign_material(tool.Ifc.get(), [mirrored_type], material.is_a(), material)
tool.Material.ensure_material_assigned([mirrored_type], material.is_a(), material)
class EnableEditingMaterialSetItemProfile(bpy.types.Operator):
@@ -705,6 +705,7 @@ class FlipFill(bpy.types.Operator, tool.Ifc.Operator):
tool.Geometry.reload_representation(filled_object)
return {"FINISHED"}
@@ -531,7 +531,7 @@ def get_generic_product_preview_data(context, relating_type):
snap_obj = bpy.data.objects.get(snap_prop.snap_object)
snap_element = tool.Ifc.get_entity(snap_obj)
rot_mat = Quaternion()
if relating_type.is_a() in [ "IfcDoorType", "IfcWindowType" ] and snap_element and snap_element.is_a("IfcWall"):
if relating_type.is_a() in ["IfcDoorType", "IfcWindowType"] and snap_element and snap_element.is_a("IfcWall"):
layers = tool.Model.get_material_layer_parameters(snap_element)
axes = tool.Model.get_wall_axis(snap_obj, layers=layers)
axis_base = axes["base"]
@@ -679,6 +679,7 @@ class MirrorElements(bpy.types.Operator, tool.Ifc.Operator):
obj.matrix_world = newmat
class TrueMirrorElements(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.mirror_geometry"
bl_label = "Mirror Element Geometry"
@@ -692,7 +693,7 @@ class TrueMirrorElements(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
for obj in context.selected_objects:
self.mirror_obj(context, obj)
return { "FINISHED" }
return {"FINISHED"}
def mirror_obj(self, context: bpy.types.Context, obj: bpy.types.Object):
element = tool.Ifc.get_entity(obj)
@@ -739,7 +740,7 @@ class TrueMirrorElements(bpy.types.Operator, tool.Ifc.Operator):
if element.is_a("IfcProduct"):
if not element.Representation:
return
for representation in element.Representation.Representations:
for item in representation.Items:
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
@@ -796,7 +797,7 @@ class TrueMirrorElements(bpy.types.Operator, tool.Ifc.Operator):
inverted_type = tool.Blender.Modifier.has_mirrored_type(type_element)
if not inverted_type:
old_to_new, _ = tool.Geometry.duplicate_ifc_objects([ tool.Ifc.get_object(type_element) ])
old_to_new, _ = tool.Geometry.duplicate_ifc_objects([tool.Ifc.get_object(type_element)])
inverted_type = old_to_new[type_element][0]
self.invert_representation(inverted_type)
tool.Blender.Modifier.set_mirrored_type(inverted_type, type_element)
+3 -1
View File
@@ -1631,7 +1631,9 @@ class Blender(bonsai.core.tool.Blender):
pset = tool.Pset.get_element_pset(element, "BBIM_MirroredType")
if not pset:
pset = ifcopenshell.api.pset.add_pset(tool.Ifc.get(), element, "BBIM_MirroredType")
ifcopenshell.api.pset.edit_pset(tool.Ifc.get(), pset, properties={"Data": json.dumps({"mirrored_type": mirrored_type.id()})})
ifcopenshell.api.pset.edit_pset(
tool.Ifc.get(), pset, properties={"Data": json.dumps({"mirrored_type": mirrored_type.id()})}
)
@classmethod
def is_slab(cls, element: entity_instance) -> bool:
+2 -2
View File
@@ -119,7 +119,7 @@ class Root(bonsai.core.tool.Root):
new_styled_by = ifcopenshell.util.element.copy(tool.Ifc.get(), styled_by)
new_styled_by.Item = copied_entities[styled_by.Item.id()]
copied_entities[styled_by.id()] = new_styled_by
elif dest.is_a("IfcTypeProduct"):
if not source.RepresentationMaps:
return copied_entities
@@ -142,7 +142,7 @@ class Root(bonsai.core.tool.Root):
exclude_callback=exclude_callback,
copied_entities=copied_entities,
)
for item in map.MappedRepresentation.Items:
if item.StyledByItem:
for styled_by in item.StyledByItem: