mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
black .
This commit is contained in:
@@ -97,7 +97,7 @@ def initialize_bbim_semver():
|
||||
|
||||
def get_debug_info():
|
||||
bbim_version = bbim_semver["version"]
|
||||
|
||||
|
||||
debug_info = {
|
||||
"os": platform.system(),
|
||||
"os_version": platform.version(),
|
||||
@@ -112,7 +112,7 @@ def get_debug_info():
|
||||
"last_actions": last_actions,
|
||||
"last_error": last_error,
|
||||
}
|
||||
|
||||
|
||||
# Add .blend file save information
|
||||
if bpy.data.is_saved:
|
||||
debug_info["blend_file_path"] = bpy.data.filepath
|
||||
@@ -120,7 +120,7 @@ def get_debug_info():
|
||||
else:
|
||||
debug_info["blend_file_path"] = "Not saved"
|
||||
debug_info["blend_file_dirty"] = "N/A"
|
||||
|
||||
|
||||
# Add IFC file information
|
||||
bim_props = tool.Blender.get_bim_props()
|
||||
if bim_props.ifc_file:
|
||||
@@ -129,7 +129,7 @@ def get_debug_info():
|
||||
else:
|
||||
debug_info["ifc_file_path"] = "No IFC loaded"
|
||||
debug_info["ifc_is_dirty"] = "N/A"
|
||||
|
||||
|
||||
return debug_info
|
||||
|
||||
|
||||
|
||||
@@ -948,28 +948,36 @@ def _generate_circular_arrow_tris() -> tuple[tuple[float, float, float], ...]:
|
||||
px, py = -dy / length * half_width, dx / length * half_width
|
||||
|
||||
# XY plane triangles
|
||||
triangles.extend([
|
||||
(x1 + px, y1 + py, 0.0),
|
||||
(x1 - px, y1 - py, 0.0),
|
||||
(x2 + px, y2 + py, 0.0),
|
||||
])
|
||||
triangles.extend([
|
||||
(x2 + px, y2 + py, 0.0),
|
||||
(x1 - px, y1 - py, 0.0),
|
||||
(x2 - px, y2 - py, 0.0),
|
||||
])
|
||||
triangles.extend(
|
||||
[
|
||||
(x1 + px, y1 + py, 0.0),
|
||||
(x1 - px, y1 - py, 0.0),
|
||||
(x2 + px, y2 + py, 0.0),
|
||||
]
|
||||
)
|
||||
triangles.extend(
|
||||
[
|
||||
(x2 + px, y2 + py, 0.0),
|
||||
(x1 - px, y1 - py, 0.0),
|
||||
(x2 - px, y2 - py, 0.0),
|
||||
]
|
||||
)
|
||||
|
||||
# XZ plane triangles (for visibility from other angles)
|
||||
triangles.extend([
|
||||
(x1, y1, -half_width),
|
||||
(x2, y2, -half_width),
|
||||
(x1, y1, +half_width),
|
||||
])
|
||||
triangles.extend([
|
||||
(x1, y1, +half_width),
|
||||
(x2, y2, -half_width),
|
||||
(x2, y2, +half_width),
|
||||
])
|
||||
triangles.extend(
|
||||
[
|
||||
(x1, y1, -half_width),
|
||||
(x2, y2, -half_width),
|
||||
(x1, y1, +half_width),
|
||||
]
|
||||
)
|
||||
triangles.extend(
|
||||
[
|
||||
(x1, y1, +half_width),
|
||||
(x2, y2, -half_width),
|
||||
(x2, y2, +half_width),
|
||||
]
|
||||
)
|
||||
|
||||
# Arrowhead at the end of the arc (pointing in direction of cycling)
|
||||
arrow_size = 0.18 # 50% larger than original 0.12
|
||||
@@ -992,18 +1000,22 @@ def _generate_circular_arrow_tris() -> tuple[tuple[float, float, float], ...]:
|
||||
perp_y = tangent_x * arrow_size
|
||||
|
||||
# Arrowhead triangle (XY plane)
|
||||
triangles.extend([
|
||||
(tip_x, tip_y, 0.0),
|
||||
(end_x - perp_x * 0.5, end_y - perp_y * 0.5, 0.0),
|
||||
(end_x + perp_x * 0.5, end_y + perp_y * 0.5, 0.0),
|
||||
])
|
||||
triangles.extend(
|
||||
[
|
||||
(tip_x, tip_y, 0.0),
|
||||
(end_x - perp_x * 0.5, end_y - perp_y * 0.5, 0.0),
|
||||
(end_x + perp_x * 0.5, end_y + perp_y * 0.5, 0.0),
|
||||
]
|
||||
)
|
||||
|
||||
# Arrowhead triangle (XZ plane for depth)
|
||||
triangles.extend([
|
||||
(tip_x, tip_y, 0.0),
|
||||
(end_x, end_y, -arrow_size * 0.5),
|
||||
(end_x, end_y, +arrow_size * 0.5),
|
||||
])
|
||||
triangles.extend(
|
||||
[
|
||||
(tip_x, tip_y, 0.0),
|
||||
(end_x, end_y, -arrow_size * 0.5),
|
||||
(end_x, end_y, +arrow_size * 0.5),
|
||||
]
|
||||
)
|
||||
|
||||
return tuple(triangles)
|
||||
|
||||
|
||||
@@ -920,7 +920,9 @@ class GizmoDoorEdition(bpy.types.GizmoGroup, gizmo.BaseParametricGizmoGroup):
|
||||
|
||||
# Calculate base swing transformation (common to both arcs)
|
||||
swing_x_offset = props.overall_width if "RIGHT" in props.door_type else 0.0
|
||||
base_swing_transform = Matrix.Translation(V_(swing_x_offset, props.lining_offset, 0)) @ Matrix.Scale(props.overall_width, 4)
|
||||
base_swing_transform = Matrix.Translation(V_(swing_x_offset, props.lining_offset, 0)) @ Matrix.Scale(
|
||||
props.overall_width, 4
|
||||
)
|
||||
|
||||
if not self.gizmo_door_type.hide:
|
||||
self.gizmo_door_type.matrix_basis = mw @ base_swing_transform
|
||||
|
||||
@@ -214,9 +214,7 @@ class BIMModelProperties(PropertyGroup):
|
||||
# Used for things like windows, other hosted furniture, and MEP
|
||||
rl2: bpy.props.FloatProperty(name="RL", default=1, subtype="DISTANCE", description="Z offset for windows")
|
||||
# Used for plan calculation points such as in room generation
|
||||
rl3: bpy.props.FloatProperty(
|
||||
name="RL", default=1, subtype="DISTANCE", description="Z offset for space calculation"
|
||||
)
|
||||
rl3: bpy.props.FloatProperty(name="RL", default=1, subtype="DISTANCE", description="Z offset for space calculation")
|
||||
type_page: bpy.props.IntProperty(name="Type Page", default=1, min=1, update=update_type_page)
|
||||
x_angle: bpy.props.FloatProperty(
|
||||
name="X Angle",
|
||||
@@ -245,9 +243,7 @@ class BIMModelProperties(PropertyGroup):
|
||||
default="TOP",
|
||||
description="Offset convention to reference line",
|
||||
)
|
||||
offset: bpy.props.FloatProperty(
|
||||
name="Offset", default=0.0, description="Material usage offset from reference line"
|
||||
)
|
||||
offset: bpy.props.FloatProperty(name="Offset", default=0.0, description="Material usage offset from reference line")
|
||||
show_wall_axis: bpy.props.BoolProperty(
|
||||
name="Show Wall Axis",
|
||||
default=False,
|
||||
|
||||
@@ -446,7 +446,9 @@ class GizmoStairEdition(bpy.types.GizmoGroup, gizmo.BaseParametricGizmoGroup):
|
||||
|
||||
def get_gizmo_matrix_tread_depth(self, props):
|
||||
riser_height = self._get_first_riser_height(props)
|
||||
translation = Matrix.Translation(Vector((props.tread_run / 2, props.width / 2, riser_height - props.tread_depth)))
|
||||
translation = Matrix.Translation(
|
||||
Vector((props.tread_run / 2, props.width / 2, riser_height - props.tread_depth))
|
||||
)
|
||||
rotation = self.get_axis_rotation_matrix((0, 0, -1))
|
||||
return translation @ rotation
|
||||
|
||||
@@ -458,7 +460,9 @@ class GizmoStairEdition(bpy.types.GizmoGroup, gizmo.BaseParametricGizmoGroup):
|
||||
|
||||
def get_gizmo_matrix_nosing_depth(self, props):
|
||||
riser_height = self._get_first_riser_height(props)
|
||||
translation = Matrix.Translation(Vector((-props.nosing_length, props.width / 2, riser_height - props.nosing_depth)))
|
||||
translation = Matrix.Translation(
|
||||
Vector((-props.nosing_length, props.width / 2, riser_height - props.nosing_depth))
|
||||
)
|
||||
rotation = self.get_axis_rotation_matrix((0, 0, -1))
|
||||
return translation @ rotation
|
||||
|
||||
|
||||
@@ -680,7 +680,11 @@ class GizmoWindowEdition(bpy.types.GizmoGroup, gizmo.BaseParametricGizmoGroup):
|
||||
def get_gizmo_matrix_lining_to_panel_offset_y(self, props):
|
||||
y_full = self._get_lining_to_panel_offset_y_full(props)
|
||||
translation = Matrix.Translation(
|
||||
V_(props.lining_to_panel_offset_x, y_full + props.frame_depth[0] + props.lining_offset, props.lining_thickness)
|
||||
V_(
|
||||
props.lining_to_panel_offset_x,
|
||||
y_full + props.frame_depth[0] + props.lining_offset,
|
||||
props.lining_thickness,
|
||||
)
|
||||
)
|
||||
rotation = self.get_axis_rotation_matrix((0, 1, 0))
|
||||
return translation @ rotation
|
||||
@@ -693,16 +697,12 @@ class GizmoWindowEdition(bpy.types.GizmoGroup, gizmo.BaseParametricGizmoGroup):
|
||||
return translation @ rotation
|
||||
|
||||
def get_gizmo_matrix_first_mullion_offset(self, props):
|
||||
translation = Matrix.Translation(
|
||||
V_(props.first_mullion_offset, props.lining_offset, props.overall_height / 2)
|
||||
)
|
||||
translation = Matrix.Translation(V_(props.first_mullion_offset, props.lining_offset, props.overall_height / 2))
|
||||
rotation = self.get_axis_rotation_matrix((1, 0, 0))
|
||||
return translation @ rotation
|
||||
|
||||
def get_gizmo_matrix_second_mullion_offset(self, props):
|
||||
translation = Matrix.Translation(
|
||||
V_(props.second_mullion_offset, props.lining_offset, props.overall_height / 2)
|
||||
)
|
||||
translation = Matrix.Translation(V_(props.second_mullion_offset, props.lining_offset, props.overall_height / 2))
|
||||
rotation = self.get_axis_rotation_matrix((1, 0, 0))
|
||||
return translation @ rotation
|
||||
|
||||
@@ -714,16 +714,12 @@ class GizmoWindowEdition(bpy.types.GizmoGroup, gizmo.BaseParametricGizmoGroup):
|
||||
return translation @ rotation
|
||||
|
||||
def get_gizmo_matrix_first_transom_offset(self, props):
|
||||
translation = Matrix.Translation(
|
||||
V_(props.overall_width / 2, props.lining_offset, props.first_transom_offset)
|
||||
)
|
||||
translation = Matrix.Translation(V_(props.overall_width / 2, props.lining_offset, props.first_transom_offset))
|
||||
rotation = self.get_axis_rotation_matrix((0, 0, 1))
|
||||
return translation @ rotation
|
||||
|
||||
def get_gizmo_matrix_second_transom_offset(self, props):
|
||||
translation = Matrix.Translation(
|
||||
V_(props.overall_width / 2, props.lining_offset, props.second_transom_offset)
|
||||
)
|
||||
translation = Matrix.Translation(V_(props.overall_width / 2, props.lining_offset, props.second_transom_offset))
|
||||
rotation = self.get_axis_rotation_matrix((0, 0, 1))
|
||||
return translation @ rotation
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ MATERIAL_TYPE = Literal[
|
||||
PrioritisedLayer = namedtuple("PrioritisedLayer", "priority material thickness")
|
||||
PrioritisedProfile = namedtuple("PrioritisedProfile", "priority material profile")
|
||||
|
||||
|
||||
def get_pset(
|
||||
element: ifcopenshell.entity_instance,
|
||||
name: str,
|
||||
@@ -1863,7 +1864,10 @@ def get_material_layers(element: ifcopenshell.entity_instance) -> list[Prioritis
|
||||
material = ifcopenshell.util.element.get_material(element, should_skip_usage=True)
|
||||
if not material or not material.is_a("IfcMaterialLayerSet"):
|
||||
return []
|
||||
return [PrioritisedLayer(getattr(layer, "Priority", 0) or 0, layer.Material, layer.LayerThickness) for layer in material.MaterialLayers]
|
||||
return [
|
||||
PrioritisedLayer(getattr(layer, "Priority", 0) or 0, layer.Material, layer.LayerThickness)
|
||||
for layer in material.MaterialLayers
|
||||
]
|
||||
|
||||
|
||||
def get_material_profiles(element: ifcopenshell.entity_instance) -> list[PrioritisedProfile]:
|
||||
@@ -1881,6 +1885,11 @@ def get_material_profiles(element: ifcopenshell.entity_instance) -> list[Priorit
|
||||
material_profiles = ifcopenshell.util.element.get_material_profiles(element)
|
||||
"""
|
||||
material = ifcopenshell.util.element.get_material(element, should_skip_usage=True)
|
||||
if not material or not material.is_a("IfcMaterialProfileSet") :
|
||||
if not material or not material.is_a("IfcMaterialProfileSet"):
|
||||
return []
|
||||
return [PrioritisedProfile(getattr(material_profile, "Priority", 0) or 0, material_profile.Material, material_profile.Profile) for material_profile in material.MaterialProfiles]
|
||||
return [
|
||||
PrioritisedProfile(
|
||||
getattr(material_profile, "Priority", 0) or 0, material_profile.Material, material_profile.Profile
|
||||
)
|
||||
for material_profile in material.MaterialProfiles
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user