fix(task-17): an inch sheet's fit reports paper units per drawing unit, not the mm ratio times 25.4
`_paper_frame` computed `paper_per_unit = mm_per_unit * unit` where `unit` is millimetres per paper unit, so an extents+fit plot on an inch sheet reported `effective_scale: "607.06:1"` for a fit that is `1:1.06276` (off by 25.4 squared). The render was right (`units_per_mm` is unit-free); only the label was wrong, and it flowed into `drawing_export_pdf(layout=...)`. The mm sheet could not see it because there `unit` is 1. `test_extents_plot_fits_the_printable_area_and_centres` is parametrized over ISO A3 (mm, width-bound) and ANSI B (inches, height-bound); the ink position is derived from the centred frame so both cases check the same invariant. The inch case fails without the fix. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
This commit is contained in:
co-authored by
Claude Opus 5
parent
aeb27c252b
commit
54bbf72312
@@ -2524,7 +2524,12 @@ class EzdxfBackend(AutoCADBackend):
|
||||
usable = [r for r in ratios if r is not None]
|
||||
mm_per_unit = min(usable) if usable else 1.0
|
||||
units_per_mm = 1.0 / mm_per_unit
|
||||
paper_per_unit = mm_per_unit * unit
|
||||
# ``unit`` is millimetres per paper unit (25.4 under inches),
|
||||
# so paper units per drawing unit *divides* by it. Multiplying
|
||||
# reported a 1:1.06 inch fit as ``607.06:1`` (off by 25.4^2)
|
||||
# while the render itself was right, ``units_per_mm`` being
|
||||
# unit-free; the mm sheet hid it because there ``unit`` is 1.
|
||||
paper_per_unit = mm_per_unit / unit
|
||||
effective = (
|
||||
scale_label(paper_per_unit, 1.0)
|
||||
if paper_per_unit >= 1.0
|
||||
|
||||
Reference in New Issue
Block a user