diff --git a/Lego.json b/Lego.json index 4755ddb..aeeb6b7 100644 --- a/Lego.json +++ b/Lego.json @@ -25,6 +25,11 @@ "studs_x": "6", "studs_y": "6" }, + "Plate_10x2": { + "type": "plate", + "studs_x": "10", + "studs_y": "2" + }, "Plate_4x2": { "type": "plate", "studs_x": "4", @@ -49,6 +54,11 @@ "type": "slope45", "studs_x": "2", "studs_y": "1" + }, + "Knob_2x2": { + "type": "knob", + "studs_x": "2", + "studs_y": "2" } }, "fileFormatVersion": "1" diff --git a/Lego.scad b/Lego.scad index 94558a9..1717f3f 100644 --- a/Lego.scad +++ b/Lego.scad @@ -1,5 +1,5 @@ /* [Lego Type] */ -type = "brick"; // ["brick":Brick, "plate":Plate, "slope45":"Slope 45"] +type = "brick"; // ["brick":Brick, "plate":Plate, "slope45":"Slope 45","knob":Knob] studs_x = 4; studs_y = 2; slice_x = false; @@ -7,24 +7,38 @@ slice_x = false; /* [Hidden] */ block_height = (type == "brick" || type == "slope45") ? 9.6 : - type == "plate" ? 3.2 : + (type == "plate" || type == "knob") ? 3.2 : 0; length_per_stud = 31.8 / 4; wall_width = 1.6; ceiling_width = 1; +centered_knob = type == "knob"; $fs = 1; assert(block_height > 0, "Invalid block height. Perhaps type is not correct?"); assert(studs_x >= studs_y, "studs_x must be equal or larger than studs_y"); module stud() { - cylinder(d = 4.8, h = 1.8); + if (type == "knob") { + difference() { + cylinder(d = 4.8, h = 1.8); + cylinder(d = 3.2, h = 1.9); + } + } else { + cylinder(d = 4.8, h = 1.8); + } } module studs() { - for (x = [0:studs_x-1], y = [0:studs_y-1]) - translate([(x+0.5) * length_per_stud, (y+0.5) * length_per_stud, 0]) - stud(); + if (centered_knob) { + for (x = [0:studs_x-2], y = [0:studs_y-2]) + translate([(x+1) * length_per_stud, (y+1) * length_per_stud, 0]) + stud(); + } else { + for (x = [0:studs_x-1], y = [0:studs_y-1]) + translate([(x+0.5) * length_per_stud, (y+0.5) * length_per_stud, 0]) + stud(); + } } module base() { @@ -50,7 +64,7 @@ module base() { } module pillar() { - cylinder(h = block_height, d = 6.48); + cylinder(h = block_height, d = 6.55); } module small_pillar() {