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

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

@@ -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,38 +14,35 @@ module lavender(n, radius) {
module draw_acute_pie(p, r, a) {
hull() {
linear_extrude(layer_thickness * 2)
offset(-radius / 175) {
offset(-radius / 175)
translate(p)
rotate(a)
pie(r * 1.1, 72);
}
linear_extrude(layer_thickness * 3)
offset(-radius / 100) {
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) {
offset(-radius / 175)
translate(p)
rotate(a)
pie(r * 1.1, 36);
}
linear_extrude(layer_thickness * 3)
offset(-radius / 100) {
offset(-radius / 100)
translate(p)
rotate(a)
pie(r, 36);
}
}
}
v1 = points[0] - points[1];
v2 = points[2] - points[1];
@@ -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,17 +27,13 @@ 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]) {
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
linear_extrude(width / 30)
@@ -49,29 +45,25 @@ 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]) {
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);
}
}
}
}
translate([-width / 30, 0])
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]) {
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);
}
}
}
}
// tiles, just quick and dirty
module tile(width, edges, up_down_rand) {

View File

@@ -47,8 +47,7 @@ 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]) {
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")
@@ -57,7 +56,6 @@ module random_town_square(size, tileW, layerH) {
}
}
}
}
module draw_tile(tile, tileW, layerH) {
if(has(["F2", "F4", "F6"], tile)) {

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