tweaks, add makefile

This commit is contained in:
deboxed 2026-02-03 14:33:38 +01:00
commit 7f8d98ca0a
4 changed files with 58 additions and 10 deletions

5
.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
*.png~
*.deps
*.stl
*.generated.scad

23
Makefile Normal file
View file

@ -0,0 +1,23 @@
# TARGETS=$(shell sed '/^module [a-z0-9_-]*().*make..\?me.*$$/!d;s/module //;s/().*/.stl/' main.scad)
GENERATED_FILES = $(wildcard *.deps) \
$(wildcard *.stl) \
$(wildcard *.png) \
$(wildcard *.generated.scad)
.phony: all clean
# all: ${TARGETS}
include $(wildcard *.deps)
%.stl: main.scad main.json Makefile
flatpak run org.openscad.OpenSCAD --enable textmetrics -p main.json -P $(basename $@) -DFN=64 -D "MODELVER=\"$(shell git rev-parse --short=6 HEAD)\"" -m make -o $@ -d $@.deps $<
%.png:
flatpak run org.openscad.OpenSCAD --enable textmetrics -p main.json -P $(basename $@) -DFN=32 --render --imgsize 1600,1200 -o $@ main.scad
clean:
rm -rf ${GENERATED_FILES}

19
main.json Normal file
View file

@ -0,0 +1,19 @@
{
"fileFormatVersion": "1",
"parameterSets": {
"t4t": {
"base_rounding_stamp": "4",
"base_rounding_stencil": "2",
"base_thickness_stamp": "1",
"base_thickness_stencil": "0.40000000000000002",
"border": "3",
"font_index": "0",
"font_manual": "LT Effervescent:style=Regular",
"font_set": "4",
"line": "t4t",
"stamp_depth": "1.5",
"textsize": "36",
"variant": "stamp"
}
}
}

View file

@ -1,7 +1,7 @@
/* [Main design variables] */
variant = "stamp"; // ["stamp", "stencil"]
// Set the text size to match the width.
textsize = 36; // [10:36]
textsize = 24; // [10:36]
font_set = 4; // [0:"linux", 1:"windows", 2:"custom", 3:"stencil", 4:"manual"]
font_manual = "Ubuntu:style=Bold";
font_index = 0;
@ -39,7 +39,6 @@ fonts_custom = [
];
fonts_stencil = ["Depot:style=Regular",
"Depot Filled:style=Regular",
"Allerta Stencil:style=Regular",
"Stardos Stencil:style=Regular",
"Stardos Stencil:style=Bold",
@ -65,6 +64,10 @@ width = tm.size[0];
height = tm.size[1];
base_position = tm.position;
echo();
echo(str("model size is x:", width, " y:", height));
echo("");
// All variables are set, make main
main();
@ -122,15 +125,13 @@ module stencil()
{
difference()
{
stamp_base(width, height, base_thickness_stencil, base_rounding_stamp);
translate(base_position)
translate([-border,-border,0])
stamp_base(width+2*border, height+2*border, base_thickness_stencil, base_rounding_stamp);
for (i = [0 : 1 : len(lines)])
{
line = lines[(len(lines)-1)-i];
translate(v = [width/2, linespacing/2 +border + i*linespacing, 0])
linear_extrude(height = base_thickness_stencil+0.01)
text(line, font = font, halign="center", valign="center", size=textsize);
}
text(line, font = font, size=textsize);
}
}