greenman-src/ holds the kit source; uv run build.py there rewrites greenman/. deploy skips *-src/. The page now uses the index's ink, bone and gold with the same serif, and no longer loads web fonts. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GrX9qMoNihcWLX3xoJhabw
49 lines
3.6 KiB
Python
49 lines
3.6 KiB
Python
"""Audit: walk the assembly in order and report, for every part, which face it is on, what it is glued to,
|
|
what it lies over, and what later covers it. Then check each step's written instructions against those facts."""
|
|
import re, manifest as M, content as C, geom as G
|
|
base = G.base_glasses()['outline']
|
|
P = M.PLACEMENTS; order = list(M.STEPS); problems = []
|
|
def name(p): return p['id']
|
|
for k in order:
|
|
st = M.STEPS[k]; ps = M.step_placements(k)
|
|
print(f"\n== {order.index(k)}. {st['title']} (drawing: {st['view']} view)")
|
|
for p in ps:
|
|
if p['shape'] is None: continue
|
|
same = [q for q in P if q is not p and q['shape'] is not None and q['face'] == p['face']]
|
|
fp = p['footprint']
|
|
under = [name(q) for q in same if q['seq'] < p['seq'] and fp is not None and q['shape'].intersection(fp).area > 1]
|
|
over_earlier = [name(q) for q in same if q['seq'] < p['seq'] and q['shape'].intersection(p['shape']).area > 15 and name(q) not in under]
|
|
covered_later = [name(q) for q in same if q['seq'] > p['seq'] and fp is not None and q['shape'].intersection(fp).area > 1]
|
|
on_base = fp.intersection(base).area / fp.area if fp is not None and fp.area else 0
|
|
print(f" {name(p):16s} face={p['face']:6s} glue={p['glue']:7s} on-foam={on_base:4.0%} glued over: {under or '-'} lies across: {over_earlier or '-'} glue spot later covered by: {covered_later or '-'}")
|
|
# --- text checks
|
|
t = C.STEP[k]; text = re.sub(r'<[^>]+>', '', ' '.join(t['do']) + ' ' + t['check'])
|
|
faces = {p['face'] for p in ps if p['face'] in ('front', 'back') and p['part'] not in ('STRAP',)}
|
|
for f in faces:
|
|
if not re.search(rf'\b{f}\b', text): problems.append(f"step '{k}': parts go on the {f} but the text never says '{f}'")
|
|
wrong = {'front': 'back', 'back': 'front'}
|
|
for f in faces:
|
|
if len(faces) == 1 and re.search(rf'(to|on|onto) the (<b>)?{wrong[f]}(</b>)? of the band', ' '.join(t['do'])): problems.append(f"step '{k}': text says {wrong[f]} of the band, parts are on the {f}")
|
|
view = 'back' if st['view'] in ('back', 'both') else 'front'
|
|
if faces and view not in faces: problems.append(f"step '{k}': drawing is a {view} view but its parts are on the {faces}")
|
|
glues = {p['glue'] for p in ps} - {'none', 'wire'}
|
|
gl = t['glue'].lower()
|
|
if 'contact' in glues and 'cement' not in gl: problems.append(f"step '{k}': uses contact cement but the header says '{t['glue']}'")
|
|
if 'hot' in glues and 'hot' not in gl: problems.append(f"step '{k}': uses hot glue but the header says '{t['glue']}'")
|
|
# numbers in the text vs geometry
|
|
for p in ps:
|
|
if p['part'] in 'LMS' and p['x'] and k in ('back', 'centre', 'front'):
|
|
if not re.search(rf"\b{abs(round(p['x']))} mm", text): problems.append(f"step '{k}': {name(p)} sits {abs(round(p['x']))} mm from centre; text does not give that distance")
|
|
a = abs(round(p['ang']))
|
|
if a and not re.search(rf"\b{a}°", text): problems.append(f"step '{k}': {name(p)} leans {a} deg; text does not give that angle")
|
|
# chips = manifest counts
|
|
for part, n in C.step_counts(k).items():
|
|
if part in C.SHORT and C.qty(part, n) not in C.step_parts(k): problems.append(f"step '{k}': chip for {part} missing")
|
|
# cross-document mentions of twigs / faces
|
|
allsrc = open(C.__file__).read()
|
|
for m in re.finditer(r"[^.'\n]{0,80}twig[^.'\n]{0,80}", allsrc):
|
|
if re.search(r'behind|backs? of', m.group(0)): problems.append('twig text still says behind/back: ' + m.group(0).strip()[:140])
|
|
print('\n== text vs layout problems:', len(problems))
|
|
for p in problems: print(' -', p)
|
|
print('manifest problems:', len(M.validate(verbose=False)))
|