Add plates and refined wall and pillar sizes

This commit is contained in:
Sebastiaan de Schaetzen 2023-02-17 14:24:58 +01:00
parent 53679529f5
commit 574499bfa7
3 changed files with 34 additions and 10 deletions

View File

@ -1,19 +1,34 @@
{ {
"parameterSets": { "parameterSets": {
"Brick_4x2": { "Brick_4x2": {
"type": "1", "type": "brick",
"studs_x": "4", "studs_x": "4",
"studs_y": "2" "studs_y": "2"
}, },
"Brick_2x2": { "Brick_2x2": {
"type": "1", "type": "brick",
"studs_x": "2", "studs_x": "2",
"studs_y": "2" "studs_y": "2"
}, },
"Brick_2x1": { "Brick_2x1": {
"type": "1", "type": "brick",
"studs_x": "2",
"studs_y": "1"
},
"Plate_4x2": {
"type": "plate",
"studs_x": "4",
"studs_y": "2"
},
"Plate_2x2": {
"type": "plate",
"studs_x": "2", "studs_x": "2",
"studs_y": "2" "studs_y": "2"
},
"Plate_2x1": {
"type": "plate",
"studs_x": "2",
"studs_y": "1"
} }
}, },
"fileFormatVersion": "1" "fileFormatVersion": "1"

View File

@ -1,15 +1,19 @@
/* [Lego Type] */ /* [Lego Type] */
type = 1; // [1:Standard] type = "brick"; // ["brick":Brick, "plate":Plate]
studs_x = 4; studs_x = 4;
studs_y = 2; studs_y = 2;
/* [Hidden] */ /* [Hidden] */
block_height = 9.6; // The height of the block without studs block_height =
type == "brick" ? 9.6 :
type == "plate" ? 3.2 :
0;
length_per_stud = 31.8 / 4; length_per_stud = 31.8 / 4;
stud_details = 4 * ($preview ? 5 : 10); stud_details = 4 * ($preview ? 5 : 10);
wall_width = 1.4; wall_width = 1.5;
ceiling_width = 1; ceiling_width = 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"); assert(studs_x >= studs_y, "studs_x must be equal or larger than studs_y");
module stud() { module stud() {
@ -36,7 +40,7 @@ module base() {
} }
module pillar() { module pillar() {
cylinder(h = block_height, d = 6.51, $fn = stud_details); cylinder(h = block_height, d = 6.48, $fn = stud_details);
} }
module small_pillar() { module small_pillar() {
@ -62,4 +66,4 @@ module block() {
studs(); studs();
} }
block(); block();

View File

@ -1,8 +1,13 @@
PARAMETERS := $(shell cat Lego.json | grep -v '"parameterSets": ""' | jq -r '.parameterSets | keys[]') PARAMETERS := $(shell cat Lego.json | grep -v '"parameterSets": ""' | jq -r '.parameterSets | keys[]')
STL = $(PARAMETERS:%=%.stl) STL = $(PARAMETERS:%=%.stl)
SCAD = Lego.scad
CONFIG = Lego.json
all: $(STL) all: $(STL)
$(STL): Lego.scad Lego.json clean:
openscad -o $@ -P $@ $< rm -f $(STL)
$(STL): $(SCAD) $(CONFIG) Makefile
openscad -o $@ -p $(CONFIG) -P $(@:%.stl=%) $(SCAD)