From 4eaf763a85ee1c113617dd4ae1b0a02090fb5737 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sun, 16 Feb 2020 15:59:45 +0800 Subject: [PATCH] refactor --- examples/maze/cube_maze.scad | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/examples/maze/cube_maze.scad b/examples/maze/cube_maze.scad index 1c94af88..c337974a 100644 --- a/examples/maze/cube_maze.scad +++ b/examples/maze/cube_maze.scad @@ -1,4 +1,5 @@ -use ; +use ; +use ; maze_rows = 8; block_width = 2; @@ -19,18 +20,23 @@ module cube_maze(maze_rows, block_width, wall_thickness, inner_cube, travel_all) module two_mazes() { module one_maze() { + blocks = mz_blocks( + [1, 1], + maze_rows, maze_rows + ); + + walls = mz_walls(blocks, maze_rows, maze_rows, block_width); + translate([origin, origin, half_cube_size]) - linear_extrude(wall_thickness) build_square_maze( - maze_rows, - maze_rows, - go_maze( - 1, 1, // starting point - starting_maze(maze_rows, maze_rows), - maze_rows, maze_rows - ), - block_width, - wall_thickness - ); + linear_extrude(wall_thickness) + for(wall = walls) { + for(i = [0:len(wall) - 2]) { + hull() { + translate(wall[i]) square(wall_thickness, center = true); + translate(wall[i + 1]) square(wall_thickness, center = true); + } + } + } } one_maze();