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