wobblyhead hg > 3dprints > house_number
view README.md @ 4:4836a7408849
more elaborate hole finding
| author | ark |
|---|---|
| date | 2026-11-03 15:51 +0100 |
| parents | f5ff6f1a5454 |
| children |
line wrap: on
line source
# House number 3D-printed house numbers, or any other text, to fix to a wall. Each glyph is a separate flat piece with countersunk screw holes. Distance washers behind the holes keep it off the wall and take up unevenness. Instead of screws, magnets pressed into the washers can hold the glyph. The glyphs print face down. A two-colour look with an outline band is possible on a single-colour printer by changing filament once. The work is split in three steps: 1. `make_preview.py` renders the text in every installed font, to choose one. 2. `make_glyphs.py` turns the text in the chosen font into glyph outlines, works out the largest printable size and places the screw holes. 3. `main.scad` builds the printable parts in OpenSCAD, and a drilling template, which `make_template.py` splits into printable pages. ## Requirements - Python 3 with fontTools, Pillow and numpy. `make_template.py` needs only the standard library. - fontconfig's `fc-list`, which the scripts use to find fonts. - An OpenSCAD development snapshot. The model uses features newer than the 2021.01 release. ## Choosing a font ./make_preview.py --text 24 writes one PNG per font into `preview/`. Each image shows the text as it will be printed, drawn from the same outlines as the model. The caption gives family, style, PostScript name, weight, classification and the largest printable size. The file name is the font's PostScript name, so the image can be passed to `make_glyphs.py` as it is. Named instances of variable fonts, such as the weights of SF Pro, count as separate fonts. Fonts that lack a character of the text are skipped. On the development machine, all installed fonts took about 2 minutes and 244 MB. Filters narrow the selection: ./make_preview.py --text 24 --family 'helvetica|futura' --weight-min 600 ./make_preview.py --text 24 --class serif --no-italic `--family` and `--name` take regular expressions, matched against the family and the PostScript name. `--italic`, `--mono` and their `--no-` forms select by style. `--class serif` or `--class sans` keeps only fonts that classify themselves that way; many fonts carry no classification and appear only without this filter. `--list` prints the matching fonts without rendering. To see the two-colour look, give the band width in mm: ./make_preview.py --text 24 --band 4 --fill '#202020' --outline '#c03030' --background '#e8e4dc' The band is scaled to each font's largest print size in the single-glyph layout, or in the whole-text layout with `--layout text`. ## Glyph data ./make_glyphs.py preview/Futura-Bold.png 24 ./make_glyphs.py Futura-Bold 24 The font is given by PostScript name or preview image. The script writes `glyphs.scad`, which `main.scad` includes, and a directory `generated/<font>_<text>/` with an SVG outline and a check image per glyph. It prints the largest sizes and the hole positions; warnings go to standard error. ### Size Size is the height of the tallest glyph, in mm. The usable area is the bed (300 mm) minus its margin (10 mm) and the frame of the two-colour print: 280 mm minus 4 line widths. Two layouts fit differently: - text: the whole text in one print, spaced as the font spaces it. - glyph: one glyph per print, all glyphs at the same size. For both, the script reports the largest size unrotated and at the best angle between 0 and 90 degrees. Rotation helps narrow fonts: in SF Extra Compressed Thin, 45 degrees raises the size per glyph from 278 to 325 mm. The holes are placed for one size, by default the largest unrotated size in the glyph layout. `--layout`, `--angle` (-1 for the best) and `--size` choose another. OpenSCAD can scale to any size later; it then checks that the screw heads still fit. ### Mounting points The script looks for the best mounting points on each glyph: spread wide, so the glyph sits firmly on its washers and does not tip, and each in the middle of a stroke with room for the screw head (8 mm, `--head-d`) plus a wall of 2 line widths (`--wall-lines`). For magnets, pass the magnet diameter as `--head-d`. By default each glyph gets two holes, near its upper and lower end. `--holes` sets the most holes per glyph, up to 6. Three holes make a glyph sit flat; more are used only where they clearly improve the hold. In Futura Bold, "W" and "H" get four, most glyphs three, and "I" two. The script prints the number of holes per glyph, and why it stayed below the maximum. It warns where a head does not fit. Further options tune the placement, see `--help`. The comments in `make_glyphs.py` describe the method. The check images show the glyph in grey, the area with room for the head in green, the axis or the hole polygon and the centre in blue, and the holes in red, orange where the head does not fit. ### Glyphs of several parts Glyphs such as "i", "รค" or "%" consist of separate parts. The script reports them and works out a backing that connects them, see below. A hole can land in a separate part, such as the dot of "i". ### Fonts with overlapping outlines Many fonts, variable fonts in particular, draw glyphs from overlapping or self-crossing contours. OpenSCAD's SVG import would turn the overlaps into holes. The scripts correct this and report where the result still differs from the font's own filling. ## The model Open `main.scad` in OpenSCAD and set the parameters in the customizer. The console shows the size, thicknesses, warnings and a file name for the export. ### Parts - `all`: the glyphs as they hang on the wall, with the washers behind them. - `body`: the glyph in print orientation, face on the bed. In single-colour mode this is the whole print. - `decal`: the outline band of the two-colour print. - `washer`: one distance washer. Make copies in the slicer. With magnets, print one first to test the fit. - `template`: the drilling template, 2D. ### Layout and size `layout` chooses between the whole text and one glyph per print. `glyph_index` picks the glyph, counted from 0 without spaces. `size` 0 uses the largest size that fits, `angle` -1 the best angle. `bed_size` and `bed_margin` describe the printer. ### Glyph `glyph_layers` sets the thickness, 6 layers by default: 1.2 mm at 0.2 mm layers. `backing` adds `backing_layers` (4 by default) behind the glyph, covering its outline. For glyphs of several parts the backing also fills the gaps between the parts, or, where they lie far apart, the convex hull. The gaps are bridged and may need supports. ### Screws `screw_d` (4 mm) and `head_d` (8 mm) set the hole and the countersink, each widened by `clearance` on both sides. The countersink is 90 degrees and opens towards the bed. With thin glyphs it is deeper than the glyph: at the defaults 2 mm against 1.2 mm. The washer then continues the cone. `fit_wall_lines` (2) is the material required around the screw head, or around the magnet, in line widths. Where a hole position from `glyphs.scad` has less room at the print size, the console shows a warning. ### Magnets With `attachment` set to `magnet`, the glyph has no holes. Each washer holds a magnet in a pocket at its wall end instead. `magnet_d` and `magnet_h` set the pocket diameter and depth in steps of 0.05 mm. They are used as given, without `clearance`, so the press fit can be tuned directly. Print a single washer to test the fit before printing the glyphs. An open pocket of the magnet's height leaves the magnet flush with the washer end. `seal_magnets` closes each pocket with two layers. The pocket depth is rounded up to whole layers, with a warning. The console gives the height and layer number after which to pause the print. Insert the magnets in the pause, then let the print finish over them. ### Washers The washer wall is `washer_wall_lines` line widths around the hole, 8 by default, around the screw hole or the magnet pocket. `washer_height` defaults to 10 mm and is rounded to whole layers. It is raised, with a warning, to the part of the countersink or the magnet pocket inside the washer plus 4 layers. A washer for screws prints with the glyph side up, a washer for magnets with the pocket up. A separate magnet washer is glued to the back of the glyph. With `washers_on_body`, the washers are part of the body instead, standing on the glyph's back, with the magnet pockets at their top. Where a washer is wider than the glyph at that point, it is cut back to the outline so it does not overhang, and a warning is shown. ### Two-colour print 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, `decal_layers` thick: 2 by default, at most 10 and at most the glyph thickness less 2 layers. - The band narrows towards the back, so the nozzle can reach the body's first layers next to the decal. How many decal layers the nozzle clears depends on its shape; test it on your printer. A warning is shown when the band's top layer gets narrower than a line width. - 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. To print: 1. Slice decal and body with the same settings, but add a Z-hop to the body. 2. Print the decal. 3. Change filament. Remove the skirt, if any, and the frame. 4. Print the body on top. Where a stroke is too narrow to leave body material between the bands, the face shows only the decal colour. ### Export Render (F6) and export the 3D parts as STL. The file name echoed in the console carries font, text, glyph, options, size, angle and print settings. A maximum hole count other than 2 adds `h` and the count after the attachment, such as `cs_h3_`. For example: house_number_body_Futura-Bold_24_g0_2cd2_cs_s2780a0t6_lw40lh20.stl ## Drilling template The holes do not line up with each other, so a full-size template shows where to drill. Set `part` to `template`, render and export as SVG. The template uses the same size as the print and shows: - the glyph outlines where they hang on the wall, spaced as the font spaces them, also when the glyphs are printed one at a time; - a circle of the hole or magnet diameter at each hole, with a cross reaching past the washer; - a level line along the baseline; - a 100 mm scale bar with 10 mm ticks. Then ./make_template.py house_number_template_Futura-Bold_24_s2780_lw40lh20.svg writes a PDF of the same name, split over A4 pages, portrait or landscape, whichever needs fewer. Print it at 100% and check the scale bar. Neighbouring pages overlap by 10 mm. A dashed line with crosses every 50 mm runs through the middle of each overlap. Trim one sheet along the line, lay it over its neighbour so line and crosses match, and tape it. Each page names its row and column in the bottom margin. `--paper` (a4, a3, letter, legal), `--margin` (unprintable edge, 6 mm) and `--overlap` change the page layout. ## Files - `make_preview.py`, `make_glyphs.py`, `make_template.py`: the scripts. Each lists its options with `--help`. - `fontlib.py`: code shared by the first two. - `main.scad`: the model. - `glyphs.scad`, `generated/`: written by `make_glyphs.py`. - `preview/`: written by `make_preview.py`.
