mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-21 05:52:16 +02:00
format
This commit is contained in:
@@ -34,12 +34,11 @@ module maze_masking(start, mask, cell_width, wall_thickness, wall_height, base_h
|
|||||||
mz_square_initialize(mask = mask)
|
mz_square_initialize(mask = mask)
|
||||||
);
|
);
|
||||||
|
|
||||||
pts = contour ? vx_contour([
|
pts = contour ?
|
||||||
for(y = [0:rows - 1])
|
vx_contour([
|
||||||
for(x = [0:columns - 1])
|
for(y = [0:rows - 1], x = [0:columns - 1]) if(mask[rows - y - 1][x] == 1) [x, y]
|
||||||
if(mask[rows - y - 1][x] == 1)
|
], sorted = true) :
|
||||||
[x, y]
|
[];
|
||||||
], sorted = true) : [];
|
|
||||||
|
|
||||||
walls = mz_squarewalls(cells, cell_width);
|
walls = mz_squarewalls(cells, cell_width);
|
||||||
|
|
||||||
@@ -47,25 +46,21 @@ module maze_masking(start, mask, cell_width, wall_thickness, wall_height, base_h
|
|||||||
linear_extrude(wall_height)
|
linear_extrude(wall_height)
|
||||||
intersection() {
|
intersection() {
|
||||||
union() {
|
union() {
|
||||||
for(wall = walls) {
|
for(wall = walls, i = [0:len(wall) - 2]) {
|
||||||
for(i = [0:len(wall) - 2]) {
|
if(wall[i][0] != 0 && wall[i][1] != 0) {
|
||||||
if(wall[i][0] != 0 && wall[i][1] != 0) {
|
hull() {
|
||||||
hull() {
|
translate(wall[i])
|
||||||
translate(wall[i])
|
square(wall_thickness);
|
||||||
square(wall_thickness);
|
translate(wall[i + 1])
|
||||||
translate(wall[i + 1])
|
square(wall_thickness);
|
||||||
square(wall_thickness);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(y = [0:rows - 1]) {
|
for(y = [0:rows - 1], x = [0:columns - 1]) {
|
||||||
for(x = [0:columns - 1]) {
|
if(mask[rows - y - 1][x] == 0) {
|
||||||
if(mask[rows - y - 1][x] == 0) {
|
translate([x * cell_width + wall_thickness, y * cell_width + wall_thickness])
|
||||||
translate([x * cell_width + wall_thickness, y * cell_width + wall_thickness])
|
square(cell_width);
|
||||||
square(cell_width);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,13 +75,13 @@ module maze_masking(start, mask, cell_width, wall_thickness, wall_height, base_h
|
|||||||
translate([0, 0, -base_height])
|
translate([0, 0, -base_height])
|
||||||
linear_extrude(base_height)
|
linear_extrude(base_height)
|
||||||
translate([wall_thickness * 2, wall_thickness * 2])
|
translate([wall_thickness * 2, wall_thickness * 2])
|
||||||
polygon(pts * cell_width);
|
polygon(pts * cell_width);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
translate([0, 0, -base_height])
|
translate([0, 0, -base_height])
|
||||||
linear_extrude(base_height)
|
linear_extrude(base_height)
|
||||||
translate([wall_thickness, wall_thickness])
|
translate([wall_thickness, wall_thickness])
|
||||||
square([columns, rows] * cell_width);
|
square([columns, rows] * cell_width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@ use <polyline2d.scad>;
|
|||||||
|
|
||||||
$fn = 48;
|
$fn = 48;
|
||||||
|
|
||||||
rings = 6;
|
rings = 5;
|
||||||
beginning_number = 5;
|
beginning_number = 5;
|
||||||
cell_width = 2;
|
cell_width = 2;
|
||||||
|
|
||||||
@@ -29,34 +29,32 @@ module maze_tower() {
|
|||||||
r = cell_width * (rings + 1);
|
r = cell_width * (rings + 1);
|
||||||
|
|
||||||
module maze() {
|
module maze() {
|
||||||
for(rings = mz) {
|
for(rings = mz, cell = rings) {
|
||||||
for(cell = rings) {
|
ri = cell[0];
|
||||||
ri = cell[0];
|
ci = cell[1];
|
||||||
ci = cell[1];
|
type = cell[2];
|
||||||
type = cell[2];
|
thetaStep = 360 / len(mz[ri]);
|
||||||
thetaStep = 360 / len(mz[ri]);
|
innerR = (ri + 1) * cell_width;
|
||||||
innerR = (ri + 1) * cell_width;
|
outerR = (ri + 2) * cell_width;
|
||||||
outerR = (ri + 2) * cell_width;
|
theta1 = thetaStep * ci;
|
||||||
theta1 = thetaStep * ci;
|
theta2 = thetaStep * (ci + 1);
|
||||||
theta2 = thetaStep * (ci + 1);
|
|
||||||
|
|
||||||
innerVt2 = vt_from_angle(theta2, innerR);
|
innerVt2 = vt_from_angle(theta2, innerR);
|
||||||
outerVt2 = vt_from_angle(theta2, outerR);
|
outerVt2 = vt_from_angle(theta2, outerR);
|
||||||
|
|
||||||
if(type == INWARD_WALL || type == INWARD_CCW_WALL) {
|
if(type == INWARD_WALL || type == INWARD_CCW_WALL) {
|
||||||
if(!(ri == 0 && ci == 0)) {
|
if(!(ri == 0 && ci == 0)) {
|
||||||
arc(innerR, [theta1, theta2], wall_thickness);
|
arc(innerR, [theta1, theta2], wall_thickness);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(type == CCW_WALL || type == INWARD_CCW_WALL) {
|
if(type == CCW_WALL || type == INWARD_CCW_WALL) {
|
||||||
intersection() {
|
intersection() {
|
||||||
difference() {
|
difference() {
|
||||||
circle(outerR + half_wall_thickness);
|
circle(outerR + half_wall_thickness);
|
||||||
circle(innerR - half_wall_thickness);
|
circle(innerR - half_wall_thickness);
|
||||||
}
|
|
||||||
polyline2d([innerVt2 * 0.9, outerVt2], width = wall_thickness);
|
|
||||||
}
|
}
|
||||||
|
polyline2d([innerVt2 * 0.9, outerVt2], width = wall_thickness);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,7 +75,7 @@ module maze_tower() {
|
|||||||
circle(r + wall_thickness * 0.4999);
|
circle(r + wall_thickness * 0.4999);
|
||||||
}
|
}
|
||||||
translate([0, 0, -0.1])
|
translate([0, 0, -0.1])
|
||||||
linear_extrude(wall_height * (mz_leng + 2))
|
linear_extrude(wall_height * (mz_leng + 2), convexity = 10)
|
||||||
maze();
|
maze();
|
||||||
}
|
}
|
||||||
last_rings = mz[mz_leng - 1];
|
last_rings = mz[mz_leng - 1];
|
||||||
@@ -91,13 +89,11 @@ module maze_tower() {
|
|||||||
num_stairs = 4;
|
num_stairs = 4;
|
||||||
stair_thickness = wall_thickness / 3;
|
stair_thickness = wall_thickness / 3;
|
||||||
or = r + half_wall_thickness;
|
or = r + half_wall_thickness;
|
||||||
for(ri = [0:2:rings * 2]) {
|
for(ri = [0:2:rings * 2], si = [0:2]) {
|
||||||
for(si = [0:2]) {
|
r = or - stair_thickness * si - wall_thickness * ri;
|
||||||
r = or - stair_thickness * si - wall_thickness * ri;
|
translate([0, 0, wall_height * ri / 2 + wall_height / num_stairs * (si + 1)])
|
||||||
translate([0, 0, wall_height * ri / 2 + wall_height / num_stairs * (si + 1)])
|
linear_extrude(wall_height / num_stairs * (3 - si))
|
||||||
linear_extrude(wall_height / num_stairs * (3 - si))
|
arc(r, 360, stair_thickness, width_mode = "LINE_INWARD");
|
||||||
arc(r, 360, stair_thickness, width_mode = "LINE_INWARD");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user