mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
Fix normals for generic parametric stairs #4020
Also made concrete stair normals defined more explicitly.
This commit is contained in:
@@ -1109,6 +1109,9 @@ class Model(blenderbim.core.tool.Model):
|
|||||||
vertices.append(vertices[-1] * V(1, 0))
|
vertices.append(vertices[-1] * V(1, 0))
|
||||||
edges.extend([(last_vert_i - 1, last_vert_i), (last_vert_i, 0)])
|
edges.extend([(last_vert_i - 1, last_vert_i), (last_vert_i, 0)])
|
||||||
|
|
||||||
|
# flip edges direction for ccw polygon winding order
|
||||||
|
edges = [e[::-1] for e in edges]
|
||||||
|
|
||||||
elif stair_type == "CONCRETE":
|
elif stair_type == "CONCRETE":
|
||||||
define_generic_stair_treads()
|
define_generic_stair_treads()
|
||||||
|
|
||||||
@@ -1158,19 +1161,22 @@ class Model(blenderbim.core.tool.Model):
|
|||||||
if base_point.y > -base_slab_depth:
|
if base_point.y > -base_slab_depth:
|
||||||
# stair doesn't meet the slab
|
# stair doesn't meet the slab
|
||||||
vertices.append(base_point)
|
vertices.append(base_point)
|
||||||
edges.append((0, len(vertices) - 1))
|
edges.append((len(vertices) - 1, 0))
|
||||||
bottom_nib_end = len(vertices) - 1
|
bottom_nib_end = len(vertices) - 1
|
||||||
else:
|
else:
|
||||||
# slab overlaps stair
|
# slab overlaps stair
|
||||||
vertices.append(get_point_on_2d_line(y=start_vert.y - base_slab_depth))
|
vertices.append(get_point_on_2d_line(y=start_vert.y - base_slab_depth))
|
||||||
vertices.append(start_vert + Vector((0, -base_slab_depth)))
|
vertices.append(start_vert + Vector((0, -base_slab_depth)))
|
||||||
last_vertex_i = len(vertices) - 1
|
last_vertex_i = len(vertices) - 1
|
||||||
edges.append((0, last_vertex_i))
|
edges.append((last_vertex_i, 0))
|
||||||
edges.append((last_vertex_i - 1, last_vertex_i))
|
edges.append((last_vertex_i - 1, last_vertex_i))
|
||||||
bottom_nib_end = len(vertices) - 2
|
bottom_nib_end = len(vertices) - 2
|
||||||
|
|
||||||
# close the shape
|
# close the shape
|
||||||
edges.append((bottom_nib_end, top_nib_end))
|
edges.append((top_nib_end, bottom_nib_end))
|
||||||
|
|
||||||
|
# flip edges direction for ccw polygon winding order
|
||||||
|
edges = [e[::-1] for e in edges]
|
||||||
else:
|
else:
|
||||||
raise Exception(f"Unsupported stair type: {stair_type}")
|
raise Exception(f"Unsupported stair type: {stair_type}")
|
||||||
|
|
||||||
|
|||||||
@@ -199,10 +199,11 @@ class TestGenerateStair2DProfile(NewFile):
|
|||||||
(6, 7),
|
(6, 7),
|
||||||
(7, 8),
|
(7, 8),
|
||||||
(8, 9),
|
(8, 9),
|
||||||
(0, 11),
|
(11, 0),
|
||||||
(10, 11),
|
(10, 11),
|
||||||
(10, 9),
|
(9, 10),
|
||||||
)
|
)
|
||||||
|
edges_data = [e[::-1] for e in edges_data]
|
||||||
faces_data = ()
|
faces_data = ()
|
||||||
expected_profile = (verts_data, edges_data, faces_data)
|
expected_profile = (verts_data, edges_data, faces_data)
|
||||||
generated_profile = subject.generate_stair_2d_profile(**kwargs)
|
generated_profile = subject.generate_stair_2d_profile(**kwargs)
|
||||||
@@ -235,7 +236,6 @@ class TestGenerateStair2DProfile(NewFile):
|
|||||||
V(0.1, 0, -0.25),
|
V(0.1, 0, -0.25),
|
||||||
V(0.0, 0, -0.25),
|
V(0.0, 0, -0.25),
|
||||||
)
|
)
|
||||||
|
|
||||||
edges_data = (
|
edges_data = (
|
||||||
(0, 1),
|
(0, 1),
|
||||||
(1, 2),
|
(1, 2),
|
||||||
@@ -247,10 +247,11 @@ class TestGenerateStair2DProfile(NewFile):
|
|||||||
(7, 8),
|
(7, 8),
|
||||||
(8, 9),
|
(8, 9),
|
||||||
(9, 10),
|
(9, 10),
|
||||||
(0, 12),
|
(12, 0),
|
||||||
(11, 12),
|
(11, 12),
|
||||||
(11, 10),
|
(10, 11),
|
||||||
)
|
)
|
||||||
|
edges_data = [e[::-1] for e in edges_data]
|
||||||
|
|
||||||
faces_data = ()
|
faces_data = ()
|
||||||
expected_profile = (verts_data, edges_data, faces_data)
|
expected_profile = (verts_data, edges_data, faces_data)
|
||||||
@@ -284,7 +285,6 @@ class TestGenerateStair2DProfile(NewFile):
|
|||||||
V(1.2, 0, 1.0),
|
V(1.2, 0, 1.0),
|
||||||
V(0.9, 0, 1.0),
|
V(0.9, 0, 1.0),
|
||||||
)
|
)
|
||||||
|
|
||||||
edges_data = (
|
edges_data = (
|
||||||
(0, 1),
|
(0, 1),
|
||||||
(1, 2),
|
(1, 2),
|
||||||
@@ -324,7 +324,6 @@ class TestGenerateStair2DProfile(NewFile):
|
|||||||
V(1.2, 0, 1.0),
|
V(1.2, 0, 1.0),
|
||||||
V(1.2, 0, 0.0),
|
V(1.2, 0, 0.0),
|
||||||
)
|
)
|
||||||
|
|
||||||
edges_data = (
|
edges_data = (
|
||||||
(0, 1),
|
(0, 1),
|
||||||
(1, 2),
|
(1, 2),
|
||||||
@@ -337,6 +336,7 @@ class TestGenerateStair2DProfile(NewFile):
|
|||||||
(8, 9),
|
(8, 9),
|
||||||
(9, 0),
|
(9, 0),
|
||||||
)
|
)
|
||||||
|
edges_data = [e[::-1] for e in edges_data]
|
||||||
|
|
||||||
faces_data = ()
|
faces_data = ()
|
||||||
expected_profile = (verts_data, edges_data, faces_data)
|
expected_profile = (verts_data, edges_data, faces_data)
|
||||||
|
|||||||
Reference in New Issue
Block a user