Add slope45
This commit is contained in:
parent
845fb955fd
commit
61ed2eceb9
@ -34,6 +34,11 @@
|
|||||||
"type": "plate",
|
"type": "plate",
|
||||||
"studs_x": "2",
|
"studs_x": "2",
|
||||||
"studs_y": "1"
|
"studs_y": "1"
|
||||||
|
},
|
||||||
|
"Slope45_2x1": {
|
||||||
|
"type": "slope45",
|
||||||
|
"studs_x": "2",
|
||||||
|
"studs_y": "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fileFormatVersion": "1"
|
"fileFormatVersion": "1"
|
||||||
|
60
Lego.scad
60
Lego.scad
@ -1,11 +1,12 @@
|
|||||||
/* [Lego Type] */
|
/* [Lego Type] */
|
||||||
type = "brick"; // ["brick":Brick, "plate":Plate]
|
type = "brick"; // ["brick":Brick, "plate":Plate, "slope45":"Slope 45"]
|
||||||
studs_x = 4;
|
studs_x = 4;
|
||||||
studs_y = 2;
|
studs_y = 2;
|
||||||
|
slice_x = false;
|
||||||
|
|
||||||
/* [Hidden] */
|
/* [Hidden] */
|
||||||
block_height =
|
block_height =
|
||||||
type == "brick" ? 9.6 :
|
(type == "brick" || type == "slope45") ? 9.6 :
|
||||||
type == "plate" ? 3.2 :
|
type == "plate" ? 3.2 :
|
||||||
0;
|
0;
|
||||||
length_per_stud = 31.8 / 4;
|
length_per_stud = 31.8 / 4;
|
||||||
@ -27,14 +28,23 @@ module studs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module base() {
|
module base() {
|
||||||
|
width = (studs_y + (type == "slope45" ? 1 : 0)) * length_per_stud;
|
||||||
|
length = studs_x * length_per_stud;
|
||||||
difference() {
|
difference() {
|
||||||
cube([ studs_x*length_per_stud, studs_y*length_per_stud, block_height ]);
|
cube([ length, width, block_height ]);
|
||||||
translate([wall_width, wall_width, -ceiling_width]) {
|
translate([wall_width, wall_width, -ceiling_width]) {
|
||||||
cube([
|
difference() {
|
||||||
studs_x*length_per_stud - wall_width * 2,
|
cube([
|
||||||
studs_y*length_per_stud - wall_width * 2,
|
length - wall_width * 2,
|
||||||
block_height
|
width - wall_width * 2,
|
||||||
]);
|
block_height
|
||||||
|
]);
|
||||||
|
if (type == "slope45") {
|
||||||
|
translate([-wall_width, width-wall_width/2-wall_width*1.4, 3.2])
|
||||||
|
rotate([45, 0, 0])
|
||||||
|
cube([length + 2, length_per_stud, block_height]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,7 +58,11 @@ module small_pillar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module pillars() {
|
module pillars() {
|
||||||
if (studs_x >= 2 && studs_y >= 2) {
|
if (type == "slope45") {
|
||||||
|
for (x = [0:studs_x-2], y = [0:studs_y-1])
|
||||||
|
translate([(x+1) * length_per_stud, (y+1) * length_per_stud, 0])
|
||||||
|
pillar();
|
||||||
|
} else if (studs_x >= 2 && studs_y >= 2) {
|
||||||
for (x = [0:studs_x-2], y = [0:studs_y-2])
|
for (x = [0:studs_x-2], y = [0:studs_y-2])
|
||||||
translate([(x+1) * length_per_stud, (y+1) * length_per_stud, 0])
|
translate([(x+1) * length_per_stud, (y+1) * length_per_stud, 0])
|
||||||
pillar();
|
pillar();
|
||||||
@ -60,10 +74,28 @@ module pillars() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module block() {
|
module block() {
|
||||||
base();
|
width = (studs_y + (type == "slope45" ? 1 : 0)) * length_per_stud;
|
||||||
pillars();
|
length = studs_x * length_per_stud;
|
||||||
translate([0, 0, block_height])
|
difference() {
|
||||||
studs();
|
union() {
|
||||||
|
base();
|
||||||
|
pillars();
|
||||||
|
translate([0, 0, block_height])
|
||||||
|
studs();
|
||||||
|
}
|
||||||
|
if (type == "slope45") {
|
||||||
|
translate([-1, width-wall_width, 3.2])
|
||||||
|
rotate([45, 0, 0])
|
||||||
|
translate([0, 1, -10])
|
||||||
|
cube([length + 2, 10, 20]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
block();
|
difference() {
|
||||||
|
block();
|
||||||
|
if (slice_x) {
|
||||||
|
translate([10, -10, -10])
|
||||||
|
cube([100, 100, 100]);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user