mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-13 10:14:41 +02:00
refactor
This commit is contained in:
@@ -125,52 +125,26 @@ module path_tile(n, width) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(n == 0) {
|
module select_child(n) {
|
||||||
square(width, center = true);
|
children(n);
|
||||||
}
|
}
|
||||||
else if(n == 1) {
|
|
||||||
|
select_child(n) {
|
||||||
|
square(width, center = true);
|
||||||
tile1();
|
tile1();
|
||||||
}
|
rotate(-90) tile1();
|
||||||
else if(n == 2) {
|
tile3();
|
||||||
rotate(-90) tile1();
|
rotate(-180) tile1();
|
||||||
}
|
tile5();
|
||||||
else if(n == 3) {
|
rotate(-90) tile3();
|
||||||
tile3();
|
tile7();
|
||||||
}
|
rotate(90) tile1();
|
||||||
else if(n == 4) {
|
rotate(90) tile3();
|
||||||
rotate(-180) tile1();
|
rotate(90) tile5();
|
||||||
}
|
rotate(90) tile7();
|
||||||
else if(n == 5) {
|
rotate(-180) tile3();
|
||||||
tile5();
|
rotate(180) tile7();
|
||||||
}
|
rotate(270) tile7();
|
||||||
else if(n == 6) {
|
tile15();
|
||||||
rotate(-90) tile3();
|
|
||||||
}
|
|
||||||
else if(n == 7) {
|
|
||||||
tile7();
|
|
||||||
}
|
|
||||||
else if(n == 8) {
|
|
||||||
rotate(90) tile1();
|
|
||||||
}
|
|
||||||
else if(n == 9) {
|
|
||||||
rotate(90) tile3();
|
|
||||||
}
|
|
||||||
else if(n == 10) {
|
|
||||||
rotate(90) tile5();
|
|
||||||
}
|
|
||||||
else if(n == 11) {
|
|
||||||
rotate(90) tile7();
|
|
||||||
}
|
|
||||||
else if(n == 12) {
|
|
||||||
rotate(-180) tile3();
|
|
||||||
}
|
|
||||||
else if(n == 13) {
|
|
||||||
rotate(180) tile7();
|
|
||||||
}
|
|
||||||
else if(n == 14) {
|
|
||||||
rotate(270) tile7();
|
|
||||||
}
|
|
||||||
else if(n == 15) {
|
|
||||||
tile15();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -25,33 +25,33 @@ random_city(rows, columns, mask);
|
|||||||
module random_city(rows, columns, mask) {
|
module random_city(rows, columns, mask) {
|
||||||
tile_width = 30;
|
tile_width = 30;
|
||||||
|
|
||||||
module tiles() {
|
module select_child(n) {
|
||||||
for(tile = tile_w2e(rows, columns, mask)) {
|
children(n);
|
||||||
x = tile[0];
|
}
|
||||||
y = tile[1];
|
|
||||||
i = tile[2];
|
|
||||||
translate([x, y] * tile_width)
|
|
||||||
children(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tiles() {
|
for(tile = tile_w2e(rows, columns, mask)) {
|
||||||
tile00();
|
x = tile[0];
|
||||||
tile01();
|
y = tile[1];
|
||||||
tile02();
|
i = tile[2];
|
||||||
tile03();
|
translate([x, y] * tile_width)
|
||||||
tile04();
|
select_child(i) {
|
||||||
tile05();
|
tile00();
|
||||||
tile06();
|
tile01();
|
||||||
tile07();
|
tile02();
|
||||||
tile08();
|
tile03();
|
||||||
tile09();
|
tile04();
|
||||||
tile10();
|
tile05();
|
||||||
tile11();
|
tile06();
|
||||||
tile12();
|
tile07();
|
||||||
tile13();
|
tile08();
|
||||||
tile14();
|
tile09();
|
||||||
tile15();
|
tile10();
|
||||||
|
tile11();
|
||||||
|
tile12();
|
||||||
|
tile13();
|
||||||
|
tile14();
|
||||||
|
tile15();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// tiles, quick and dirty code
|
// tiles, quick and dirty code
|
||||||
|
@@ -13,7 +13,7 @@ module tube_box(rows, columns, tile_width) {
|
|||||||
quarter_w = tile_width / 4;
|
quarter_w = tile_width / 4;
|
||||||
eighth_w = tile_width / 8;
|
eighth_w = tile_width / 8;
|
||||||
|
|
||||||
translate([eighth_w, eighth_w, -eighth_w] + [tile_width, tile_width] / 2)
|
translate([eighth_w, eighth_w, eighth_w] + [tile_width, tile_width, 0] / 2)
|
||||||
for(tile = tile_w2e(rows, columns)) {
|
for(tile = tile_w2e(rows, columns)) {
|
||||||
x = tile[0];
|
x = tile[0];
|
||||||
y = tile[1];
|
y = tile[1];
|
||||||
@@ -30,6 +30,26 @@ module tube_tile(n, width) {
|
|||||||
half_w = width / 2;
|
half_w = width / 2;
|
||||||
quarter_w = width / 4;
|
quarter_w = width / 4;
|
||||||
sixteenth_w = width / 16;
|
sixteenth_w = width / 16;
|
||||||
|
|
||||||
|
module tile0() {
|
||||||
|
difference() {
|
||||||
|
union() {
|
||||||
|
linear_extrude(width / 2)
|
||||||
|
circle(quarter_w);
|
||||||
|
|
||||||
|
translate([0, 0, half_w])
|
||||||
|
linear_extrude(sixteenth_w, center = true)
|
||||||
|
circle(quarter_w * 1.2);
|
||||||
|
|
||||||
|
linear_extrude(sixteenth_w, center = true)
|
||||||
|
circle(quarter_w * 1.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
linear_extrude(width)
|
||||||
|
circle(quarter_w - quarter_w * 0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module tile1() {
|
module tile1() {
|
||||||
translate([0, half_w])
|
translate([0, half_w])
|
||||||
rotate([90, 0, -90]) {
|
rotate([90, 0, -90]) {
|
||||||
@@ -92,52 +112,26 @@ module tube_tile(n, width) {
|
|||||||
tile5();
|
tile5();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(n == 0) {
|
module select_child(n) {
|
||||||
// no tube
|
children(n);
|
||||||
}
|
}
|
||||||
else if(n == 1) {
|
|
||||||
|
select_child(n) {
|
||||||
|
tile0();
|
||||||
tile1();
|
tile1();
|
||||||
}
|
rotate(-90) tile1();
|
||||||
else if(n == 2) {
|
tile3();
|
||||||
rotate(-90) tile1();
|
rotate(-180) tile1();
|
||||||
}
|
tile5();
|
||||||
else if(n == 3) {
|
rotate(-90) tile3();
|
||||||
tile3();
|
tile7();
|
||||||
}
|
rotate(90) tile1();
|
||||||
else if(n == 4) {
|
rotate(90) tile3();
|
||||||
rotate(-180) tile1();
|
rotate(90) tile5();
|
||||||
}
|
rotate(90) tile7();
|
||||||
else if(n == 5) {
|
rotate(-180) tile3();
|
||||||
tile5();
|
rotate(180) tile7();
|
||||||
}
|
rotate(270) tile7();
|
||||||
else if(n == 6) {
|
tile15();
|
||||||
rotate(-90) tile3();
|
|
||||||
}
|
|
||||||
else if(n == 7) {
|
|
||||||
tile7();
|
|
||||||
}
|
|
||||||
else if(n == 8) {
|
|
||||||
rotate(90) tile1();
|
|
||||||
}
|
|
||||||
else if(n == 9) {
|
|
||||||
rotate(90) tile3();
|
|
||||||
}
|
|
||||||
else if(n == 10) {
|
|
||||||
rotate(90) tile5();
|
|
||||||
}
|
|
||||||
else if(n == 11) {
|
|
||||||
rotate(90) tile7();
|
|
||||||
}
|
|
||||||
else if(n == 12) {
|
|
||||||
rotate(-180) tile3();
|
|
||||||
}
|
|
||||||
else if(n == 13) {
|
|
||||||
rotate(180) tile7();
|
|
||||||
}
|
|
||||||
else if(n == 14) {
|
|
||||||
rotate(270) tile7();
|
|
||||||
}
|
|
||||||
else if(n == 15) {
|
|
||||||
tile15();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user