1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-22 06:13:10 +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])
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(

View File

@@ -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));

View File

@@ -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) {

View File

@@ -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])

View File

@@ -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);

View File

@@ -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);

View File

@@ -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)

View File

@@ -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);
}
}
}

View File

@@ -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]);
}
}
}

View File

@@ -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])