mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 02:10:59 +00:00
Fix #5988 after 6fb0f5e63a
This commit is contained in:
@@ -662,28 +662,27 @@ class Model(bonsai.core.tool.Model):
|
|||||||
return "PROFILE"
|
return "PROFILE"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_wall_axis(
|
def get_wall_axis(cls, obj: bpy.types.Object, layers: Optional[dict[str, Any]] = None) -> dict[str, list[Vector]]:
|
||||||
cls, obj: bpy.types.Object, layers: Optional[dict[str, Any]] = None
|
"""Each item of a resulting dictionary is a list of 2 2D vectors."""
|
||||||
) -> dict[str, tuple[Vector, Vector]]:
|
|
||||||
x_values = [v[0] for v in obj.bound_box]
|
x_values = [v[0] for v in obj.bound_box]
|
||||||
min_x = min(x_values)
|
min_x = min(x_values)
|
||||||
max_x = max(x_values)
|
max_x = max(x_values)
|
||||||
axes = {}
|
axes = {}
|
||||||
if layers:
|
if layers:
|
||||||
axes = {
|
axes = {
|
||||||
"base": (
|
"base": [
|
||||||
(obj.matrix_world @ Vector((min_x, layers["offset"], 0.0))).to_2d(),
|
(obj.matrix_world @ Vector((min_x, layers["offset"], 0.0))).to_2d(),
|
||||||
(obj.matrix_world @ Vector((max_x, layers["offset"], 0.0))).to_2d(),
|
(obj.matrix_world @ Vector((max_x, layers["offset"], 0.0))).to_2d(),
|
||||||
),
|
],
|
||||||
"side": (
|
"side": [
|
||||||
(obj.matrix_world @ Vector((min_x, layers["offset"] + layers["thickness"], 0.0))).to_2d(),
|
(obj.matrix_world @ Vector((min_x, layers["offset"] + layers["thickness"], 0.0))).to_2d(),
|
||||||
(obj.matrix_world @ Vector((max_x, layers["offset"] + layers["thickness"], 0.0))).to_2d(),
|
(obj.matrix_world @ Vector((max_x, layers["offset"] + layers["thickness"], 0.0))).to_2d(),
|
||||||
),
|
],
|
||||||
}
|
}
|
||||||
axes["reference"] = (
|
axes["reference"] = [
|
||||||
(obj.matrix_world @ Vector((min_x, 0.0, 0.0))).to_2d(),
|
(obj.matrix_world @ Vector((min_x, 0.0, 0.0))).to_2d(),
|
||||||
(obj.matrix_world @ Vector((max_x, 0.0, 0.0))).to_2d(),
|
(obj.matrix_world @ Vector((max_x, 0.0, 0.0))).to_2d(),
|
||||||
)
|
]
|
||||||
return axes
|
return axes
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user