diff --git a/examples/taiwan/SD_Card_Taiwan.scad b/examples/taiwan/SD_Card_Taiwan.scad index 774fc45d..14ff7760 100644 --- a/examples/taiwan/SD_Card_Taiwan.scad +++ b/examples/taiwan/SD_Card_Taiwan.scad @@ -12,8 +12,8 @@ rotate([90, 0, -109]) translate([0, -2, -2]) ellipse_extrude(semi_minor_axis, height = 4, slices = slices) - translate([3, 0, -2]) - polygon(midpt_smooth(shape_taiwan(170), smooth_times, true)); +translate([3, 0, -2]) + polygon(midpt_smooth(shape_taiwan(170), smooth_times, true)); // From: https://www.thingiverse.com/thing:1362048 module SD_Mountain(scale) {polyhedron( diff --git a/examples/taiwan/TaiwaneseBlackBear.scad b/examples/taiwan/TaiwaneseBlackBear.scad index 2a8476a6..87bf90f1 100644 --- a/examples/taiwan/TaiwaneseBlackBear.scad +++ b/examples/taiwan/TaiwaneseBlackBear.scad @@ -13,12 +13,12 @@ module blocks(points) { // Well, quick and dirty!! color("MediumSeaGreen") - translate([3, -5, -27]) - for(pt = vx_polygon([for(p = shape_taiwan(92, distance = 1)) [round(p[0]), round(p[1])]], filled = true)) { - translate(pt) - linear_extrude(1, scale = 0.5) - square(1, center = true); - } +translate([3, -5, -27]) +for(pt = vx_polygon([for(p = shape_taiwan(92, distance = 1)) [round(p[0]), round(p[1])]], filled = true)) { + translate(pt) + linear_extrude(1, scale = 0.5) + square(1, center = true); +} color(c = [0.3, 0.3, 0.3]) { blocks(vx_sphere(10)); diff --git a/examples/tiles/2_edge_wang_tiles_basic.scad b/examples/tiles/2_edge_wang_tiles_basic.scad index 0d73d8b2..09d76de3 100644 --- a/examples/tiles/2_edge_wang_tiles_basic.scad +++ b/examples/tiles/2_edge_wang_tiles_basic.scad @@ -9,21 +9,15 @@ $fn = 24; translate([tile_width, tile_width] / 2) for(tile = tile_w2e(size)) { - x = tile[0]; - y = tile[1]; - i = tile[2]; - translate([x, y] * tile_width) - sample_tile(i, tile_width, tile_thickness); + translate([tile.x, tile.y] * tile_width) + sample_tile(tile[2], tile_width, tile_thickness); } translate([0, tile_width * (size[1] + 1)] + [tile_width, tile_width] / 2) color("green") for(tile = tile_w2e(size)) { - x = tile[0]; - y = tile[1]; - i = tile[2]; - translate([x, y] * tile_width) - path_tile(i, tile_width); + translate([tile.x, tile.y] * tile_width) + path_tile(tile[2], tile_width); } module sample_tile(n, width, thickness) { diff --git a/examples/tiles/city_tile.scad b/examples/tiles/city_tile.scad index 3b85895d..c48463bb 100644 --- a/examples/tiles/city_tile.scad +++ b/examples/tiles/city_tile.scad @@ -43,8 +43,8 @@ module city_tile(i, tile_width) { halfTW = tileW / 2; translate([0, halfTW / 1.6, 2.25]) - linear_extrude(10) - rounded_square(halfRW / 1.25, corner_r = .8, center = true, $fn = 6); + linear_extrude(10) + rounded_square(halfRW / 1.25, corner_r = .8, center = true, $fn = 6); translate([0, halfTW / 1.6, 11.56]) rotate([90, 0, 0]) diff --git a/examples/tiles/hitomezashi_stitching.scad b/examples/tiles/hitomezashi_stitching.scad index e3e69ade..db327523 100644 --- a/examples/tiles/hitomezashi_stitching.scad +++ b/examples/tiles/hitomezashi_stitching.scad @@ -7,12 +7,8 @@ tile_width = 5; line_width = 1; for(tile = tile_hitomezashi(size)) { - x = tile[0]; - y = tile[1]; - i = tile[2]; - - translate([x, y] * tile_width) - select(i) { + translate([tile.x, tile.y] * tile_width) + select(tile[2]) { tile00(tile_width, line_width); tile01(tile_width, line_width); tile02(tile_width, line_width); diff --git a/examples/tiles/knot_tiles.scad b/examples/tiles/knot_tiles.scad index 7a893df9..94a33fce 100644 --- a/examples/tiles/knot_tiles.scad +++ b/examples/tiles/knot_tiles.scad @@ -10,12 +10,8 @@ line_width = 1; $fn = 12; // 4, 8, 12 .... for(tile = tile_truchet(size)) { - x = tile[0]; - y = tile[1]; - i = tile[2]; - - translate([x, y] * tile_width) - select(i) { + translate([tile.x, tile.y] * tile_width) + select(tile[2]) { tile00(tile_width, line_width); tile01(tile_width, line_width); tile02(tile_width, line_width); diff --git a/examples/tiles/lavender.scad b/examples/tiles/lavender.scad index 770adc3e..cd33892c 100644 --- a/examples/tiles/lavender.scad +++ b/examples/tiles/lavender.scad @@ -14,36 +14,33 @@ module lavender(n, radius) { module draw_acute_pie(p, r, a) { hull() { linear_extrude(layer_thickness * 2) - offset(-radius / 175) { - translate(p) - rotate(a) - pie(r * 1.1, 72); - } - + offset(-radius / 175) + translate(p) + rotate(a) + pie(r * 1.1, 72); + linear_extrude(layer_thickness * 3) - offset(-radius / 100) { - translate(p) - rotate(a) - pie(r, 72); - } + offset(-radius / 100) + translate(p) + rotate(a) + pie(r, 72); + } } module draw_obtuse_pie(p, r, a) { hull() { linear_extrude(layer_thickness * 2) - offset(-radius / 175) { - translate(p) - rotate(a) - pie(r * 1.1, 36); - } + offset(-radius / 175) + translate(p) + rotate(a) + pie(r * 1.1, 36); linear_extrude(layer_thickness * 3) - offset(-radius / 100) { - translate(p) - rotate(a) - pie(r, 36); - } + offset(-radius / 100) + translate(p) + rotate(a) + pie(r, 36); } } @@ -81,7 +78,6 @@ module lavender(n, radius) { color("Lime") hull() { linear_extrude(layer_thickness) - polygon(points); linear_extrude(layer_thickness * 2) diff --git a/examples/tiles/magic_apartment.scad b/examples/tiles/magic_apartment.scad index 0f793e95..b7e73da7 100644 --- a/examples/tiles/magic_apartment.scad +++ b/examples/tiles/magic_apartment.scad @@ -27,16 +27,12 @@ module magic_apartment(width, rows, columns, floors, up_down_rand, people) { translate([0, 0, width / 4 + width / 30]) scale([1, 1, 0.5]) - for(z = [0:floors - 1]) { - for(y = [0:rows - 1]) { - for(x = [0:columns - 1]) { - translate([x * width, y * width, z * width]) - tile(width, [ - edges[z][y][x][0], edges[z][y][x + 1][1], edges[z][y + 1][x][0], edges[z][y][x][1], - edges[z + 1][y][x][0], edges[z + 1][y][x + 1][1], edges[z + 1][y + 1][x][0], edges[z + 1][y][x][1], - ], up_down_rand); - } - } + for(z = [0:floors - 1], y = [0:rows - 1], x = [0:columns - 1]) { + translate([x * width, y * width, z * width]) + tile(width, [ + edges[z][y][x][0], edges[z][y][x + 1][1], edges[z][y + 1][x][0], edges[z][y][x][1], + edges[z + 1][y][x][0], edges[z + 1][y][x + 1][1], edges[z + 1][y + 1][x][0], edges[z + 1][y][x][1], + ], up_down_rand); } // base @@ -49,12 +45,10 @@ module magic_apartment(width, rows, columns, floors, up_down_rand, people) { linear_extrude(width * floors / 2 + width / 15) square([width * columns, width / 30]); - for(f = [1:2:floors * 4 - 1]) { - for(c = [1:2:columns * 4 - 1]) { - if(choose([true, false])) { - translate([width / 4 * c, 0, width / 8 * f]) - cube([rand(width / 15, width / 15 * 2) , width / 15, rand(width / 15, width / 15 * 3)], center = true); - } + for(f = [1:2:floors * 4 - 1], c = [1:2:columns * 4 - 1]) { + if(choose([true, false])) { + translate([width / 4 * c, 0, width / 8 * f]) + cube([rand(width / 15, width / 15 * 2) , width / 15, rand(width / 15, width / 15 * 3)], center = true); } } } @@ -63,12 +57,10 @@ module magic_apartment(width, rows, columns, floors, up_down_rand, people) { difference() { linear_extrude(width * floors / 2 + width / 15) square([width / 30, width * rows + width / 30]); - for(f = [1:2:floors * 4 - 1]) { - for(r = [1:2:rows * 4 - 1]) { - if(choose([true, false])) { - translate([0, width / 4 * r, width / 8 * f]) - cube([width / 15, rand(width / 15, width / 15 * 2), rand(width / 15, width / 15 * 3)], center = true); - } + for(f = [1:2:floors * 4 - 1], r = [1:2:rows * 4 - 1]) { + if(choose([true, false])) { + translate([0, width / 4 * r, width / 8 * f]) + cube([width / 15, rand(width / 15, width / 15 * 2), rand(width / 15, width / 15 * 3)], center = true); } } } @@ -118,12 +110,12 @@ module magic_apartment(width, rows, columns, floors, up_down_rand, people) { } else if(edges[i + 4] == 0) { rotate(90 * i) - hull() { - translate([0, -one_sixth_w, 0]) - cube([w, t, double_t], center = true); - translate([0, -half_w + half_t , 0]) - cube([w, t, double_t], center = true); - } + hull() { + translate([0, -one_sixth_w, 0]) + cube([w, t, double_t], center = true); + translate([0, -half_w + half_t , 0]) + cube([w, t, double_t], center = true); + } } } diff --git a/examples/tiles/random_town_square.scad b/examples/tiles/random_town_square.scad index f1053b7a..4d8f2659 100644 --- a/examples/tiles/random_town_square.scad +++ b/examples/tiles/random_town_square.scad @@ -47,14 +47,12 @@ module random_town_square(size, tileW, layerH) { module draw_tiles(tiles) { rows = len(tiles); columns = len(tiles[0]); - for(y = [0:rows - 1]) { - for(x = [0:len(tiles[y]) - 1]) { - translate([x, rows - y - 1] * tileW) { - draw_tile(tiles[y][x], tileW, layerH); - *color("white") - linear_extrude(3) - text(tiles[y][x], size = 1.5); - } + for(y = [0:rows - 1], x = [0:len(tiles[y]) - 1]) { + translate([x, rows - y - 1] * tileW) { + draw_tile(tiles[y][x], tileW, layerH); + *color("white") + linear_extrude(3) + text(tiles[y][x], size = 1.5); } } } @@ -209,9 +207,9 @@ module random_town_square(size, tileW, layerH) { square([tileW, halfW]); for(i = [0:9]) { - translate([0, tileW * 0.45]) - linear_extrude(layerH * 9) - square([tileW, layerH]); + translate([0, tileW * 0.45]) + linear_extrude(layerH * 9) + square([tileW, layerH]); } } } diff --git a/examples/tiles/tiled_line_mobius.scad b/examples/tiles/tiled_line_mobius.scad index aa44d955..daaf7dbb 100644 --- a/examples/tiles/tiled_line_mobius.scad +++ b/examples/tiles/tiled_line_mobius.scad @@ -12,11 +12,10 @@ module tiled_line_mobius(size, twist, line_diameter = 1) { [ for(tile = tile_truchet(size)) let( - x = tile[0], - y = tile[1], - i = tile[2] + x = tile.x, + y = tile.y ) - i <= 1 ? [[x, y], [x + 1, y + 1]] : [[x + 1, y], [x, y + 1]] + tile[2] <= 1 ? [[x, y], [x + 1, y + 1]] : [[x + 1, y], [x, y + 1]] ], [ for(i = [0:size[1] - 1])