changeset 3:f5ff6f1a5454

better decal handling
author ark
date 2026-11-03 13:54 +0100
parents fe29ace8155e
children 4836a7408849
files README.md main.json main.scad
diffstat 3 files changed, 80 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Tue Nov 03 10:08:08 2026 +0100
+++ b/README.md	Tue Nov 03 13:54:57 2026 +0100
@@ -201,10 +201,17 @@
 
 With `two_colour`, the glyph is split into a body and a decal:
 
-- The decal is a band of `band_width` (4 mm) along the glyph outline, two
-  layers thick.
-- The body leaves out the band plus one line width, so the nozzle does not
-  touch the printed decal.
+- The decal is a band of `band_width` (4 mm) along the glyph outline,
+  `decal_layers` thick (2, at most 10). It is limited to the glyph
+  thickness less 2 layers.
+- The band is `band_width` wide on the face and narrows by one layer height
+  per layer at its inner edge. The edge slopes away from the body, so the
+  nozzle can reach the body's lower layers next to the decal. How many
+  layers the nozzle clears depends on its shape; test it on your printer.
+  A warning is shown when the top layer of the band is narrower than a
+  line width.
+- The body fills the decal layers inside the band, with no gap to the
+  decal.
 - Both contain the same frame, one layer high and one line width wide,
   around the glyphs. It makes the slicer place both parts in the same spot.
 
@@ -224,7 +231,7 @@
 console carries font, text, glyph, options, size, angle and print settings,
 for example
 
-    house_number_body_Futura-Bold_24_g0_2c_cs_s2780a0t6_lw40lh20.stl
+    house_number_body_Futura-Bold_24_g0_2cd2_cs_s2780a0t6_lw40lh20.stl
 
 ## Drilling template
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.json	Tue Nov 03 13:54:57 2026 +0100
@@ -0,0 +1,34 @@
+{
+    "fileFormatVersion": "1",
+    "parameterSets": {
+        "fridge magnets 80mm": {
+            "angle": "45",
+            "attachment": "magnet",
+            "backing": "true",
+            "backing_layers": "4",
+            "band_width": "2",
+            "bed_margin": "10",
+            "bed_size": "300",
+            "clearance": "0.10000000000000001",
+            "countersink": "true",
+            "decal_layers": "5",
+            "fit_wall_lines": "2",
+            "glyph_index": "0",
+            "glyph_layers": "25",
+            "head_d": "8",
+            "layer_height": "0.20000000000000001",
+            "layout": "text",
+            "line_width": "0.40000000000000002",
+            "magnet_d": "5.1000000000000005",
+            "magnet_h": "2",
+            "part": "body",
+            "screw_d": "4",
+            "seal_magnets": "true",
+            "size": "80",
+            "two_colour": "true",
+            "washer_height": "0",
+            "washer_wall_lines": "3",
+            "washers_on_body": "true"
+        }
+    }
+}
--- a/main.scad	Tue Nov 03 10:08:08 2026 +0100
+++ b/main.scad	Tue Nov 03 13:54:57 2026 +0100
@@ -53,8 +53,10 @@
 /* [two-colour] */
 // split into body and decal, for a filament change on a single-colour printer
 two_colour = false;
-// width of the decal band along the outline
+// width of the decal band along the outline, on the face; it narrows by one layer height per layer
 band_width = 4; // [.5:.1:20]
+// decal thickness in layers, at most the glyph thickness less 2 layers
+decal_layers = 2; // [1:1:10]
 
 /* [washer] */
 // print the washers as part of the body, on the back of the glyph
@@ -83,7 +85,11 @@
 glyph_t = glyph_layers * lh;
 backing_t = backing ? backing_layers * lh : 0;
 total_t = glyph_t + backing_t;
-decal_t = 2 * lh;      // 2 layers
+// decal layers, leaving at least 2 layers of body
+decal_n = max(1, min(decal_layers, glyph_layers - 2));
+decal_t = decal_n * lh;
+// band width of the top decal layer
+band_top = band_width - (decal_n - 1) * lh;
 frame_t = lh;          // 1 layer
 
 magnet = attachment == "magnet";
@@ -158,6 +164,15 @@
              round(pause_z / lh), washers_on_body ? " of the body" : " of the washer"));
 if (magnet && seal_magnets && pocket_h > magnet_h + epsilon)
     echo(str("WARNING: pocket depth raised to ", pocket_h, " mm, whole layers"));
+if (two_colour) {
+    echo(str("decal: ", decal_n, " layers, ", decal_t, " mm, band ", band_width,
+             " mm on the face, ", band_top, " mm on the top layer"));
+    if (decal_n < decal_layers)
+        echo(str("WARNING: decal reduced to ", decal_n, " layers, glyph thickness less 2 layers"));
+    if (band_top < lw)
+        echo(str("WARNING: band on the top decal layer is ", band_top,
+                 " mm, less than a line width"));
+}
 if (washer_set < washer_min)
     echo(str("WARNING: washer height raised to ", washer_min, " mm"));
 for (h = holes) if (h[1] < fit_r_req)
@@ -213,14 +228,24 @@
     for (i = sel) _place() _glyph2d(i);
 }
 
-// Decal band: the outline minus the outline shrunk by the band width.
-module _band2d() {
+// Decal band of one layer: the outline minus the outline shrunk by the band
+// width. The band narrows by one layer height per layer, so its inner edge
+// slopes away from the body and the nozzle can reach the body's lower layers.
+// i: decal layer, 0 on the bed.
+module _band2d(i) {
     difference() {
         _placed2d();
-        offset(r = -band_width) _placed2d();
+        offset(r = -(band_width - i * lh)) _placed2d();
     }
 }
 
+// Decal layers in print orientation, one slab per layer.
+// e: downward extension of each slab, for subtracting from the body.
+module _decal3d(e = 0) {
+    for (i = [0 : decal_n - 1])
+        translate([0, 0, i * lh - e]) linear_extrude(lh + e) _band2d(i);
+}
+
 // Screw holes and countersinks, opening towards the bed, through washers
 // printed on the body. Nothing for magnets.
 module _holes() {
@@ -259,7 +284,7 @@
 }
 
 // Glyph body in print orientation, face on the bed. In two-colour mode the
-// decal band plus one line width is left out of the decal layers. Washers
+// decal is left out of the decal layers. Washers
 // printed on the body stand on its back, cut back to the outline of the back
 // so they do not overhang, with the magnet pockets at their top.
 // frame: include the frame (two-colour mode only).
@@ -279,9 +304,7 @@
         if (washers_on_body && magnet)
             for (h = holes) translate([h[0].x, h[0].y, total_t + washer_h]) _pocket();
         _holes();
-        if (two_colour)
-            translate([0, 0, -epsilon]) linear_extrude(decal_t + epsilon)
-                offset(delta = lw) _band2d();
+        if (two_colour) _decal3d(epsilon);
     }
     if (two_colour && frame) _frame();
 }
@@ -290,7 +313,7 @@
 // frame: include the frame.
 module decal(frame = true) {
     difference() {
-        linear_extrude(decal_t) _band2d();
+        _decal3d();
         _holes();
     }
     if (frame) _frame();
@@ -384,7 +407,7 @@
             : str(countersink ? "cs_" : "", "d", round(10 * screw_d), "w", washer_wall_lines,
                   "h", round(10 * washer_h), countersink ? str("c", round(10 * cs_washer)) : "")
         : str(g_name, "_", layout == "glyph" ? str("g", glyph_index, "_") : "",
-              two_colour ? "2c_" : "", backing ? "bk_" : "",
+              two_colour ? str("2cd", decal_n, "_") : "", backing ? "bk_" : "",
               magnet ? (washers_on_body ? str(magnet_str, "_") : "mg_")
                      : countersink ? "cs_" : "",
               washers_on_body ? str("wh", round(10 * washer_h), "_") : "",