1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-22 14:23:23 +02:00
This commit is contained in:
Justin Lin
2022-04-06 12:11:38 +08:00
parent c810e30003
commit 029ddc4150
10 changed files with 68 additions and 97 deletions

View File

@@ -12,8 +12,8 @@ rotate([90, 0, -109])
translate([0, -2, -2]) translate([0, -2, -2])
ellipse_extrude(semi_minor_axis, height = 4, slices = slices) ellipse_extrude(semi_minor_axis, height = 4, slices = slices)
translate([3, 0, -2]) translate([3, 0, -2])
polygon(midpt_smooth(shape_taiwan(170), smooth_times, true)); polygon(midpt_smooth(shape_taiwan(170), smooth_times, true));
// From: https://www.thingiverse.com/thing:1362048 // From: https://www.thingiverse.com/thing:1362048
module SD_Mountain(scale) {polyhedron( module SD_Mountain(scale) {polyhedron(

View File

@@ -13,12 +13,12 @@ module blocks(points) {
// Well, quick and dirty!! // Well, quick and dirty!!
color("MediumSeaGreen") color("MediumSeaGreen")
translate([3, -5, -27]) translate([3, -5, -27])
for(pt = vx_polygon([for(p = shape_taiwan(92, distance = 1)) [round(p[0]), round(p[1])]], filled = true)) { for(pt = vx_polygon([for(p = shape_taiwan(92, distance = 1)) [round(p[0]), round(p[1])]], filled = true)) {
translate(pt) translate(pt)
linear_extrude(1, scale = 0.5) linear_extrude(1, scale = 0.5)
square(1, center = true); square(1, center = true);
} }
color(c = [0.3, 0.3, 0.3]) { color(c = [0.3, 0.3, 0.3]) {
blocks(vx_sphere(10)); blocks(vx_sphere(10));

View File

@@ -9,21 +9,15 @@ $fn = 24;
translate([tile_width, tile_width] / 2) translate([tile_width, tile_width] / 2)
for(tile = tile_w2e(size)) { for(tile = tile_w2e(size)) {
x = tile[0]; translate([tile.x, tile.y] * tile_width)
y = tile[1]; sample_tile(tile[2], tile_width, tile_thickness);
i = tile[2];
translate([x, y] * tile_width)
sample_tile(i, tile_width, tile_thickness);
} }
translate([0, tile_width * (size[1] + 1)] + [tile_width, tile_width] / 2) translate([0, tile_width * (size[1] + 1)] + [tile_width, tile_width] / 2)
color("green") color("green")
for(tile = tile_w2e(size)) { for(tile = tile_w2e(size)) {
x = tile[0]; translate([tile.x, tile.y] * tile_width)
y = tile[1]; path_tile(tile[2], tile_width);
i = tile[2];
translate([x, y] * tile_width)
path_tile(i, tile_width);
} }
module sample_tile(n, width, thickness) { module sample_tile(n, width, thickness) {

View File

@@ -43,8 +43,8 @@ module city_tile(i, tile_width) {
halfTW = tileW / 2; halfTW = tileW / 2;
translate([0, halfTW / 1.6, 2.25]) translate([0, halfTW / 1.6, 2.25])
linear_extrude(10) linear_extrude(10)
rounded_square(halfRW / 1.25, corner_r = .8, center = true, $fn = 6); rounded_square(halfRW / 1.25, corner_r = .8, center = true, $fn = 6);
translate([0, halfTW / 1.6, 11.56]) translate([0, halfTW / 1.6, 11.56])
rotate([90, 0, 0]) rotate([90, 0, 0])

View File

@@ -7,12 +7,8 @@ tile_width = 5;
line_width = 1; line_width = 1;
for(tile = tile_hitomezashi(size)) { for(tile = tile_hitomezashi(size)) {
x = tile[0]; translate([tile.x, tile.y] * tile_width)
y = tile[1]; select(tile[2]) {
i = tile[2];
translate([x, y] * tile_width)
select(i) {
tile00(tile_width, line_width); tile00(tile_width, line_width);
tile01(tile_width, line_width); tile01(tile_width, line_width);
tile02(tile_width, line_width); tile02(tile_width, line_width);

View File

@@ -10,12 +10,8 @@ line_width = 1;
$fn = 12; // 4, 8, 12 .... $fn = 12; // 4, 8, 12 ....
for(tile = tile_truchet(size)) { for(tile = tile_truchet(size)) {
x = tile[0]; translate([tile.x, tile.y] * tile_width)
y = tile[1]; select(tile[2]) {
i = tile[2];
translate([x, y] * tile_width)
select(i) {
tile00(tile_width, line_width); tile00(tile_width, line_width);
tile01(tile_width, line_width); tile01(tile_width, line_width);
tile02(tile_width, line_width); tile02(tile_width, line_width);

View File

@@ -14,36 +14,33 @@ module lavender(n, radius) {
module draw_acute_pie(p, r, a) { module draw_acute_pie(p, r, a) {
hull() { hull() {
linear_extrude(layer_thickness * 2) linear_extrude(layer_thickness * 2)
offset(-radius / 175) { offset(-radius / 175)
translate(p) translate(p)
rotate(a) rotate(a)
pie(r * 1.1, 72); pie(r * 1.1, 72);
}
linear_extrude(layer_thickness * 3) linear_extrude(layer_thickness * 3)
offset(-radius / 100) { offset(-radius / 100)
translate(p) translate(p)
rotate(a) rotate(a)
pie(r, 72); pie(r, 72);
}
} }
} }
module draw_obtuse_pie(p, r, a) { module draw_obtuse_pie(p, r, a) {
hull() { hull() {
linear_extrude(layer_thickness * 2) linear_extrude(layer_thickness * 2)
offset(-radius / 175) { offset(-radius / 175)
translate(p) translate(p)
rotate(a) rotate(a)
pie(r * 1.1, 36); pie(r * 1.1, 36);
}
linear_extrude(layer_thickness * 3) linear_extrude(layer_thickness * 3)
offset(-radius / 100) { offset(-radius / 100)
translate(p) translate(p)
rotate(a) rotate(a)
pie(r, 36); pie(r, 36);
}
} }
} }
@@ -81,7 +78,6 @@ module lavender(n, radius) {
color("Lime") color("Lime")
hull() { hull() {
linear_extrude(layer_thickness) linear_extrude(layer_thickness)
polygon(points); polygon(points);
linear_extrude(layer_thickness * 2) linear_extrude(layer_thickness * 2)

View File

@@ -27,16 +27,12 @@ module magic_apartment(width, rows, columns, floors, up_down_rand, people) {
translate([0, 0, width / 4 + width / 30]) translate([0, 0, width / 4 + width / 30])
scale([1, 1, 0.5]) scale([1, 1, 0.5])
for(z = [0:floors - 1]) { for(z = [0:floors - 1], y = [0:rows - 1], x = [0:columns - 1]) {
for(y = [0:rows - 1]) { translate([x * width, y * width, z * width])
for(x = [0:columns - 1]) { tile(width, [
translate([x * width, y * width, z * width]) edges[z][y][x][0], edges[z][y][x + 1][1], edges[z][y + 1][x][0], edges[z][y][x][1],
tile(width, [ 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],
edges[z][y][x][0], edges[z][y][x + 1][1], edges[z][y + 1][x][0], edges[z][y][x][1], ], up_down_rand);
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 // base
@@ -49,12 +45,10 @@ module magic_apartment(width, rows, columns, floors, up_down_rand, people) {
linear_extrude(width * floors / 2 + width / 15) linear_extrude(width * floors / 2 + width / 15)
square([width * columns, width / 30]); square([width * columns, width / 30]);
for(f = [1:2:floors * 4 - 1]) { for(f = [1:2:floors * 4 - 1], c = [1:2:columns * 4 - 1]) {
for(c = [1:2:columns * 4 - 1]) { if(choose([true, false])) {
if(choose([true, false])) { translate([width / 4 * c, 0, width / 8 * f])
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);
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() { difference() {
linear_extrude(width * floors / 2 + width / 15) linear_extrude(width * floors / 2 + width / 15)
square([width / 30, width * rows + width / 30]); square([width / 30, width * rows + width / 30]);
for(f = [1:2:floors * 4 - 1]) { for(f = [1:2:floors * 4 - 1], r = [1:2:rows * 4 - 1]) {
for(r = [1:2:rows * 4 - 1]) { if(choose([true, false])) {
if(choose([true, false])) { translate([0, width / 4 * r, width / 8 * f])
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);
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) { else if(edges[i + 4] == 0) {
rotate(90 * i) rotate(90 * i)
hull() { hull() {
translate([0, -one_sixth_w, 0]) translate([0, -one_sixth_w, 0])
cube([w, t, double_t], center = true); cube([w, t, double_t], center = true);
translate([0, -half_w + half_t , 0]) translate([0, -half_w + half_t , 0])
cube([w, t, double_t], center = true); cube([w, t, double_t], center = true);
} }
} }
} }

View File

@@ -47,14 +47,12 @@ module random_town_square(size, tileW, layerH) {
module draw_tiles(tiles) { module draw_tiles(tiles) {
rows = len(tiles); rows = len(tiles);
columns = len(tiles[0]); columns = len(tiles[0]);
for(y = [0:rows - 1]) { for(y = [0:rows - 1], x = [0:len(tiles[y]) - 1]) {
for(x = [0:len(tiles[y]) - 1]) { translate([x, rows - y - 1] * tileW) {
translate([x, rows - y - 1] * tileW) { draw_tile(tiles[y][x], tileW, layerH);
draw_tile(tiles[y][x], tileW, layerH); *color("white")
*color("white") linear_extrude(3)
linear_extrude(3) text(tiles[y][x], size = 1.5);
text(tiles[y][x], size = 1.5);
}
} }
} }
} }
@@ -209,9 +207,9 @@ module random_town_square(size, tileW, layerH) {
square([tileW, halfW]); square([tileW, halfW]);
for(i = [0:9]) { for(i = [0:9]) {
translate([0, tileW * 0.45]) translate([0, tileW * 0.45])
linear_extrude(layerH * 9) linear_extrude(layerH * 9)
square([tileW, layerH]); square([tileW, layerH]);
} }
} }
} }

View File

@@ -12,11 +12,10 @@ module tiled_line_mobius(size, twist, line_diameter = 1) {
[ [
for(tile = tile_truchet(size)) for(tile = tile_truchet(size))
let( let(
x = tile[0], x = tile.x,
y = tile[1], y = tile.y
i = tile[2]
) )
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]) for(i = [0:size[1] - 1])