A real drawing self-calibrated to 1:20 (a detail scale) in testing — that would
shrink every quantity ~5×. Calibration now snaps only to floor-plan scales and
needs stronger agreement (>=4 samples, conf>=0.6); otherwise it returns None and
the safe 1:100 default is used. Only ever affects sheets with NO scale label.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
New pdf_engine/vector_intelligence.py — every helper is additive and falls back
to the existing behaviour, so a messy drawing can never make output worse:
1. Self-calibrating scale from the drawing's own dimension chains — used ONLY
when the sheet has no "1:N" label (never overrides a real label), replacing
the blind default of 1:100. Wired into detect_page_scale (both vector modules).
2. Real closed-polygon area (shoelace) instead of a bounding box → measure_
architectural_bounds now returns gf_area when a convincing footprint is found.
3. Line-weight-filtered building bounds (drops dimension/grid lines that inflate
a raw bbox); used for length/width/perimeter with the bbox as fallback.
4. Vector geometry handed to the vision model as grounding context (appended to
the deterministic injection in extract_page) so it reasons over real numbers.
5. Reconciliation of vector vs bbox into a _confidence flag on the result.
6. Scale-bar reader scaffold (kept inert/None until DP…
fix: prevent extract_all_text from crashing when easyocr is not installed
perf: eliminate Step 3 hangs by shrinking max PNG DPI to 50 for all blueprints, preventing massive network timeouts when sending images to Gemini. Increased concurrent extraction workers to 8 to slash processing time.
perf: Massive speed boost for Step 1 (Upload) and Step 2 (Classification) by bypassing Numpy/PIL and writing native C++ compressed images directly to disk