Credibility pass over the Green Man generator

Turn audit.py into a run() function and drop audit_run.py, which only
existed to import it quietly. Remove unused parameters, keys, helpers
and imports from draw.py, manifest.py and stl_build.py, and the source
file names in stl_build.FILES that pointed at nothing. Keep the brow
strip's taper and knob positions in geom.py only. Correct comments and
docstrings that disagreed with the code, and the README's claim about
counts.

The page changes only in markup: no stray spaces in class attributes,
and three CSS declarations that did nothing are gone. Guide HTML,
templates and print files are byte-identical apart from that.

Credibility pass over a7c04e5..HEAD; the next one can scope from here.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Eric WagonerandClaude Fable 5.2 committed 2026-11-10 19:14:03 -05:00
1 parent b86153a9fd
commit f2bb87caeb
15 files changed
+148 -151

No files matched your search

+12 -12
View File
@@ -1,13 +1,13 @@
"""Assemble the print set (only parts the manifest places, plus the stamp) and test each file for printability:
watertight, sitting on the bed, no layer that starts in mid-air, and how much steep overhang it has."""
import os, shutil, json, numpy as np, trimesh
import shutil, json, numpy as np, trimesh
from trimesh import creation
from shapely.geometry import Polygon, LineString
from shapely.geometry import LineString
from shapely.ops import unary_union
import geom as G, manifest as M
from paths import STL_SRC, OUT, WORK
from paths import STL_SRC, OUT as _OUT, WORK
SRC = str(STL_SRC); OUT = str(_OUT / 'stl')
STL_OUT = OUT / 'stl'
def brow_strip(L=G.STRIP_L):
"""Thin heat-formable brow strip: 2.4 mm plate, bark ridges 1.2 mm proud, low knobs. Same outline the guide draws."""
@@ -20,7 +20,7 @@ def brow_strip(L=G.STRIP_L):
rp = unary_union(ridges).intersection(outline.buffer(-1.0))
for g in (rp.geoms if rp.geom_type == 'MultiPolygon' else [rp]):
if g.area > 2: parts.append(creation.extrude_polygon(g, 3.6))
for kx, s in [(-52, 4.2), (-26, 5.0), (-5, 3.8), (16, 5.0), (40, 4.2), (58, 3.4)]:
for kx, s in zip(G.STRIP_KNOB_X, (4.2, 5.0, 3.8, 5.0, 4.2, 3.4)):
k = creation.icosphere(2, s); k.apply_scale([1.5, 1, 0.5]); k.apply_translation([kx, 0, 2.4]); parts.append(k)
m = trimesh.boolean.union(parts, engine='manifold')
cut = creation.box([L+40, 80, 10]); cut.apply_translation([0, 0, -5]); m = m.difference(cut)
@@ -56,10 +56,10 @@ def acorn_full(h=28, r=10, cut=4.0):
GEN = {'brow_strip.stl': brow_strip, 'acorn_large_half.stl': lambda: acorn_half(30, 11), 'acorn_small_half.stl': lambda: acorn_half(22, 8), 'acorn_full.stl': acorn_full}
FILES = { # kit file name -> (source, part id)
FILES = { # kit file name -> (file in stl_src, or None if generated here; part id)
'brow_strip.stl': (None, 'STRIP'), 'bark_knot.stl': ('bark_knot.stl', 'KNOT'), 'twig_forked.stl': ('twig_forked_flat.stl', 'TWIG'),
'acorn_large_half.stl': ('acorn_large_halfback.stl', 'AL'), 'acorn_small_half.stl': ('acorn_small_halfback.stl', 'AS'),
'acorn_full.stl': ('acorn_full_upright.stl', 'AF'), 'tendril_spiral.stl': ('tendril_spiral_small_flat.stl', 'SPIRAL'),
'acorn_large_half.stl': (None, 'AL'), 'acorn_small_half.stl': (None, 'AS'),
'acorn_full.stl': (None, 'AF'), 'tendril_spiral.stl': ('tendril_spiral_small_flat.stl', 'SPIRAL'),
'leaf_vein_stamp.stl': ('leaf_vein_stamp.stl', 'STAMP'),
}
@@ -99,16 +99,16 @@ def check(m, layer=0.2):
def build():
ml = M.make_list(); report = {}
for name, (src, pid) in FILES.items():
if name in GEN: m = GEN[name](); m.export(f'{OUT}/{name}')
else: shutil.copy(f'{SRC}/{src}', f'{OUT}/{name}'); m = trimesh.load(f'{OUT}/{name}')
if name in GEN: m = GEN[name](); m.export(STL_OUT / name)
else: shutil.copy(STL_SRC / src, STL_OUT / name); m = trimesh.load(STL_OUT / name)
r = check(m); r['qty'] = 1 if pid == 'STAMP' else ml[pid]['total']; r['part'] = pid; report[name] = r
print(f"{name:24s} x{r['qty']} {str(r['extents']):22s} bed {r['bed_contact_mm2']:6.0f} mm2 mid-air {r['midair_mm2']:5.1f} steep overhang {r['overhang_mm2']:5.0f} {r['verdict']}")
# every printed part in the manifest has a file, and no file is for an unplaced part
need = {k for k, v in ml.items() if v['kind'] == 'print'}; have = {pid for _, pid in FILES.values()} - {'STAMP'}
assert need == have, (need ^ have)
# control: the two files that failed on the printer must fail this test
# control: the three files that failed on the printer must fail this test
for bad in ('tendril_spiral_small.stl', 'tendril_spiral.stl', 'twig_forked.stl'):
rb = check(trimesh.load(f'{SRC}/{bad}')); print(f"control {bad:28s} mid-air {rb['midair_mm2']:6.1f} {rb['verdict']}"); assert rb['verdict'].startswith('FAIL'), 'the test must reject the files that failed on the printer'
rb = check(trimesh.load(STL_SRC / bad)); print(f"control {bad:28s} mid-air {rb['midair_mm2']:6.1f} {rb['verdict']}"); assert rb['verdict'].startswith('FAIL'), 'the test must reject the files that failed on the printer'
json.dump(report, open(WORK / 'stl_report.json', 'w'), indent=1)
return report