Polyline wall - added top and bottom division lines to product preview.

This commit is contained in:
Bruno Perdigão
2024-09-25 16:37:54 -03:00
parent 4e33569851
commit 41d5c391e1
2 changed files with 10 additions and 8 deletions
@@ -382,12 +382,17 @@ class PolylineDecorator:
points.append(Vector((prop[i].x, prop[i].y, prop[i].z)))
n = len(points) // 2
bottom_loop = [[i, (i + 1) % (n)] for i in range(n)]
bottom_side_1 = [[i, (i + 1) % (n)] for i in range((n-1)//2)]
bottom_side_2 = [[i, (i + 1) % (n)] for i in range(n//2, n-1)]
bottom_connections = [[i, n-i-1] for i in range(n//2)]
bottom_loop = bottom_connections + bottom_side_1 + bottom_side_2
edges.extend(bottom_loop)
upper_loop = [[i + n for i in edges] for edges in bottom_loop]
edges.extend(upper_loop)
connections = [[i, j] for i, j in zip(range(n), range(n, n * 2))]
edges.extend(connections)
vertical_connections = [[i, j] for i, j in zip(range(n), range(n, n * 2))]
edges.extend(vertical_connections)
if len(points) > 1:
self.draw_batch("LINES", points, decorator_color, edges)
@@ -620,7 +625,6 @@ class PolylineDecorator:
# self.draw_batch("TRIS", polyline_points, (0, 1, 0, 0.1), edges)
# Mouse points
print("DECO", snap_prop.snap_type)
if snap_prop.snap_type in ["Plane", "Axis", "Mix"]:
self.draw_batch("POINTS", mouse_point, decorator_color_unselected)
+2 -4
View File
@@ -330,11 +330,10 @@ class Polyline(bonsai.core.tool.Polyline):
base_vertices.pop(-1) # Remove the last point. The edges are going to inform that the shape is closed.
bm_base = create_bmesh_from_vertices(base_vertices)
bm_top = create_bmesh_from_vertices(base_vertices)
offset_base_verts = tool.Cad.offset_edges(bm_base, thickness)
top_vertices = tool.Cad.offset_edges(bm_top, angle_distortion)
offset_top_verts = tool.Cad.offset_edges(bm_top, angle_distortion + thickness)
top_vertices = tool.Cad.offset_edges(bm_base, angle_distortion)
offset_top_verts = tool.Cad.offset_edges(bm_base, angle_distortion + thickness)
if is_closed:
base_vertices.append(base_vertices[0])
@@ -373,7 +372,6 @@ class Polyline(bonsai.core.tool.Polyline):
prop.z = new_v.z + rl + height
bm_base.free()
bm_top.free()
@classmethod
def validate_input(cls, input_number, input_type):