This commit is contained in:
Andrej730
2025-08-11 11:23:07 +05:00
parent 8b1ffea91a
commit ce6505847a
6 changed files with 545 additions and 510 deletions
+13 -11
View File
@@ -613,28 +613,30 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
curve = builder.rectangle(size=Vector((0.5, 0.5)) / unit_scale)
if not (props.ifc_product == "IfcFeatureElement" and
props.ifc_class == "IfcOpeningElement" and
props.featured_obj):
if not (
props.ifc_product == "IfcFeatureElement"
and props.ifc_class == "IfcOpeningElement"
and props.featured_obj
):
item = builder.extrude(curve, magnitude=0.5 / unit_scale)
else:
featured_element = tool.Ifc.get_entity(props.featured_obj)
usage = ifcopenshell.util.element.get_material(featured_element) if featured_element else None
if usage and usage.is_a("IfcMaterialLayerSetUsage"):
wall_matrix = props.featured_obj.matrix_world
profile = builder.profile(curve)
local_x = wall_matrix.to_3x3() @ Vector((1, 0, 0))
local_y = wall_matrix.to_3x3() @ Vector((0, 1, 0))
local_z = wall_matrix.to_3x3() @ Vector((0, 0, 1))
direction_sense = getattr(usage, 'DirectionSense', 'POSITIVE')
local_y = wall_matrix.to_3x3() @ Vector((0, 1, 0))
local_z = wall_matrix.to_3x3() @ Vector((0, 0, 1))
direction_sense = getattr(usage, "DirectionSense", "POSITIVE")
if usage.LayerSetDirection == "AXIS2":
z_axis = tuple(local_y) if direction_sense == 'POSITIVE' else tuple(-local_y)
z_axis = tuple(local_y) if direction_sense == "POSITIVE" else tuple(-local_y)
elif usage.LayerSetDirection == "AXIS3":
z_axis = tuple(local_z) if direction_sense == 'POSITIVE' else tuple(-local_z)
z_axis = tuple(local_z) if direction_sense == "POSITIVE" else tuple(-local_z)
item = builder.extrude(
profile,