Add more brick types
This commit is contained in:
parent
895787f22f
commit
71011833fd
10
Lego.json
10
Lego.json
@ -4,6 +4,16 @@
|
|||||||
"type": "1",
|
"type": "1",
|
||||||
"studs_x": "4",
|
"studs_x": "4",
|
||||||
"studs_y": "2"
|
"studs_y": "2"
|
||||||
|
},
|
||||||
|
"Brick_2x2": {
|
||||||
|
"type": "1",
|
||||||
|
"studs_x": "2",
|
||||||
|
"studs_y": "2"
|
||||||
|
},
|
||||||
|
"Brick_2x1": {
|
||||||
|
"type": "1",
|
||||||
|
"studs_x": "2",
|
||||||
|
"studs_y": "2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fileFormatVersion": "1"
|
"fileFormatVersion": "1"
|
||||||
|
10
Lego.scad
10
Lego.scad
@ -10,6 +10,8 @@ stud_details = 4 * ($preview ? 5 : 10);
|
|||||||
wall_width = 1.4;
|
wall_width = 1.4;
|
||||||
ceiling_width = 1;
|
ceiling_width = 1;
|
||||||
|
|
||||||
|
assert(studs_x >= studs_y, "studs_x must be equal or larger than studs_y");
|
||||||
|
|
||||||
module stud() {
|
module stud() {
|
||||||
cylinder(d = 4.8, h = 1.8, $fn = stud_details);
|
cylinder(d = 4.8, h = 1.8, $fn = stud_details);
|
||||||
}
|
}
|
||||||
@ -37,11 +39,19 @@ module pillar() {
|
|||||||
cylinder(h = block_height, d = 6.51, $fn = stud_details);
|
cylinder(h = block_height, d = 6.51, $fn = stud_details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module small_pillar() {
|
||||||
|
cylinder(h = block_height, d = 3.2, $fn = stud_details);
|
||||||
|
}
|
||||||
|
|
||||||
module pillars() {
|
module pillars() {
|
||||||
if (studs_x >= 2 && studs_y >= 2) {
|
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();
|
||||||
|
} else if (studs_y >= 2) {
|
||||||
|
for (x = [0:studs_x-2])
|
||||||
|
translate([(x+1) * length_per_stud, length_per_stud/2, 0])
|
||||||
|
small_pillar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user