comparison README.md @ 0:b5a96b547b01

initial public version
author ark
date 2026-11-03 01:29 +0100
parents
children aa23650954d6
comparison
equal deleted inserted replaced
-1:000000000000 0:b5a96b547b01
1 # House number
2
3 3D-printed house numbers, or any other text, to screw to a wall. Each glyph
4 is a separate flat piece with two countersunk screw holes. Distance washers
5 behind the holes keep it off the wall and take up unevenness. The glyphs
6 print face down. A two-colour look with an outline band is possible on a
7 single-colour printer by changing filament once.
8
9 The work is split in three steps:
10
11 1. `make_preview.py` renders the text in every installed font, to choose
12 one.
13 2. `make_glyphs.py` turns the text in the chosen font into glyph outlines,
14 works out the largest printable size and places the screw holes.
15 3. `main.scad` builds the printable parts in OpenSCAD, and a drilling
16 template, which `make_template.py` splits into printable pages.
17
18 ## Requirements
19
20 - Python 3 with fontTools, Pillow and numpy. `make_template.py` needs only
21 the standard library.
22 - fontconfig's `fc-list`, which the scripts use to find fonts.
23 - An OpenSCAD development snapshot. The model uses features newer than the
24 2021.01 release.
25
26 ## Choosing a font
27
28 ./make_preview.py --text 24
29
30 writes one PNG per font into `preview/`. Each image shows the text as it
31 will be printed, drawn from the same outlines as the model. The caption
32 gives family, style, PostScript name, weight, classification and the
33 largest printable size. The file name is the font's PostScript name, so the
34 image can be passed to `make_glyphs.py` as it is. Named instances of
35 variable fonts, such as the weights of SF Pro, count as separate fonts.
36 Fonts that lack a character of the text are skipped.
37
38 On the development machine, all installed fonts took about 2 minutes and
39 244 MB. Filters narrow the selection:
40
41 ./make_preview.py --text 24 --family 'helvetica|futura' --weight-min 600
42 ./make_preview.py --text 24 --class serif --no-italic
43
44 `--family` and `--name` take regular expressions, matched against the
45 family and the PostScript name. `--italic`, `--mono` and their `--no-`
46 forms select by style. `--class serif` or `--class sans` keeps only fonts
47 that classify themselves that way; many fonts carry no classification and
48 appear only without this filter. `--list` prints the matching fonts
49 without rendering.
50
51 To see the two-colour look, give the band width in mm:
52
53 ./make_preview.py --text 24 --band 4 --fill '#202020' --outline '#c03030' --background '#e8e4dc'
54
55 The band is scaled to each font's largest print size in the single-glyph
56 layout, or in the whole-text layout with `--layout text`.
57
58 ## Glyph data
59
60 ./make_glyphs.py preview/Futura-Bold.png 24
61 ./make_glyphs.py Futura-Bold 24
62
63 The font is given by PostScript name or preview image. The script writes
64 `glyphs.scad`, which `main.scad` includes, and a directory
65 `generated/<font>_<text>/` with an SVG outline and a check image per glyph.
66 It prints the largest sizes and the hole positions; warnings go to standard
67 error.
68
69 ### Size
70
71 Size is the height of the tallest glyph, in mm. The usable area is the bed
72 (300 mm) minus its margin (10 mm) and the frame of the two-colour print:
73 280 mm minus 4 line widths. Two layouts fit differently:
74
75 - text: the whole text in one print, spaced as the font spaces it.
76 - glyph: one glyph per print, all glyphs at the same size.
77
78 For both, the script reports the largest size unrotated and at the best
79 angle between 0 and 90 degrees. In Helvetica Bold, "24" reaches 189 mm in
80 the text layout and 278 mm per glyph; rotation gains nothing. In SF Extra
81 Compressed Thin, turning the glyphs by 45 degrees raises the size per glyph
82 from 278 to 325 mm.
83
84 The holes are placed for one size, by default the largest unrotated size in
85 the glyph layout. `--layout`, `--angle` (-1 for the best) and `--size`
86 choose another. OpenSCAD can scale to any size later; it then checks that
87 the screw heads still fit.
88
89 ### Screw holes
90
91 Each glyph gets two holes, one near its upper and one near its lower end:
92
93 1. Only points where the screw head (8 mm, `--head-d`) plus a wall of 2
94 line widths (`--wall-lines`) fits inside the glyph are considered.
95 2. The glyph's main axis is found from its inked area. It follows the slant
96 of italic and script fonts and turns sideways for wide glyphs.
97 `--vertical-axis` forces it upright.
98 3. Along the axis, the holes aim at 85% and 15% of the glyph length
99 (`--target`). Distance from the axis is penalised (`--side-weight`);
100 sitting in the middle of the stroke is rewarded (`--centre-weight`).
101 4. Where no point has room for the head, the hole goes to the thickest
102 point of that half, and the script warns.
103
104 The check images show the glyph in grey, the area with room for the head in
105 green, the axis in blue and the holes in red, orange where the head does not
106 fit.
107
108 ### Glyphs of several parts
109
110 Glyphs such as "i", "รค" or "%" consist of separate parts. The script
111 reports them and works out a backing that connects them, see below. A hole
112 can land in a separate part when the target position lies there, such as
113 the dot of "i".
114
115 ### Fonts with overlapping outlines
116
117 Many fonts, variable fonts in particular, draw glyphs from overlapping or
118 self-crossing contours. OpenSCAD's SVG import would turn the overlaps into
119 holes. The script splits and groups the contours so the imported shape
120 matches the font, and compares the result with the font's own filling. Both
121 scripts report a difference.
122
123 ## The model
124
125 Open `main.scad` in OpenSCAD and set the parameters in the customizer. The
126 console shows the size, thicknesses, warnings and a file name for the
127 export.
128
129 ### Parts
130
131 - `all`: the glyphs as they hang on the wall, with the washers behind them.
132 - `body`: the glyph in print orientation, face on the bed. In single-colour
133 mode this is the whole print.
134 - `decal`: the outline band of the two-colour print.
135 - `washer`: one distance washer. Make copies in the slicer.
136 - `template`: the drilling template, 2D.
137
138 ### Layout and size
139
140 `layout` chooses between the whole text and one glyph per print.
141 `glyph_index` picks the glyph, counted from 0 without spaces. `size` 0 uses
142 the largest size that fits, `angle` -1 the best angle. `bed_size` and
143 `bed_margin` describe the printer.
144
145 ### Glyph
146
147 `glyph_layers` sets the thickness, 6 layers by default: 1.2 mm at 0.2 mm
148 layers. `backing` adds `backing_layers` (4 by default) behind the glyph,
149 covering its outline. For glyphs of several parts the backing is the outline
150 grown and shrunk back, so the parts join; where that does not work, it fills
151 the convex hull. The gaps between parts are bridged and may need supports.
152
153 ### Screws
154
155 `screw_d` (4 mm) and `head_d` (8 mm) set the hole and the countersink, each
156 widened by `clearance` on both sides. The countersink is 90 degrees and
157 opens towards the bed. With thin glyphs it is deeper than the glyph: at the
158 defaults 2 mm against 1.2 mm. The washer then continues the cone.
159
160 ### Washers
161
162 The washer wall is `washer_wall_lines` line widths around the hole, 8 by
163 default. `washer_height` defaults to 10 mm. It is raised, with a warning,
164 to the part of the countersink inside the washer plus 4 layers. The washer
165 prints with the glyph side up.
166
167 With `washers_on_body`, the washers are part of the body instead, standing
168 on the glyph's back. Where a washer is wider than the glyph at that point,
169 it is cut back to the outline so it does not overhang, and a warning is
170 shown.
171
172 ### Two-colour print
173
174 With `two_colour`, the glyph is split into a body and a decal:
175
176 - The decal is a band of `band_width` (4 mm) along the glyph outline, two
177 layers thick.
178 - The body leaves out the band plus one line width, so the nozzle does not
179 touch the printed decal.
180 - Both contain the same frame, one layer high and one line width wide,
181 around the glyphs. It makes the slicer place both parts in the same spot.
182
183 To print:
184
185 1. Slice decal and body with the same settings.
186 2. Print the decal.
187 3. Change filament. Remove the skirt, if any, and the frame.
188 4. Print the body on top.
189
190 Where a stroke is too narrow to leave body material between the bands, the
191 face shows only the decal colour.
192
193 ### Export
194
195 Render (F6) and export the 3D parts as STL. The file name echoed in the
196 console carries font, text, glyph, options, size, angle and print settings,
197 for example
198
199 house_number_body_Futura-Bold_24_g0_2c_cs_s2780a0t6_lw40lh20.stl
200
201 ## Drilling template
202
203 The holes do not line up with each other, so a full-size template shows
204 where to drill. Set `part` to `template`, render and export as SVG. The
205 template uses the same size as the print and shows:
206
207 - the glyph outlines where they hang on the wall, spaced as the font spaces
208 them, also when the glyphs are printed one at a time;
209 - a circle of the hole diameter at each hole, with a cross reaching past the
210 washer;
211 - a level line along the baseline;
212 - a 100 mm scale bar with 10 mm ticks.
213
214 Then
215
216 ./make_template.py house_number_template_Futura-Bold_24_s2780_lw40lh20.svg
217
218 writes a PDF of the same name, split over A4 pages, portrait or landscape,
219 whichever needs fewer. Print it at 100% and check the scale bar.
220 Neighbouring pages overlap by 10 mm. A dashed line with crosses every 50 mm
221 runs through the middle of each overlap. Trim one sheet along the line, lay
222 it over its neighbour so line and crosses match, and tape it. Each page
223 names its row and column in the bottom margin.
224
225 `--paper` (a4, a3, letter, legal), `--margin` (unprintable edge, 6 mm) and
226 `--overlap` change the page layout.
227
228 ## Files
229
230 - `make_preview.py`, `make_glyphs.py`, `make_template.py`: the scripts.
231 Each lists its options with `--help`.
232 - `fontlib.py`: code shared by the first two.
233 - `main.scad`: the model.
234 - `glyphs.scad`, `generated/`: written by `make_glyphs.py`.
235 - `preview/`: written by `make_preview.py`.