feat(understand): the snapshot, the vocabulary and the label parsers; MAX_DXF_BYTES 512 MB; the office extra
Track H's foundation, landed on main before its three groups branch. - engineering/understand/snapshot.py: one bulk read of a drawing into frozen WCS records (OCS translated through backends/ocs.py, text decoded, an INSERT boxed by its block geometry without its attribute texts). A DXF is read with ezdxf after the size check; the headless engine's document is read under its own lock; the live engine exports the active document with Document.Export(<tmp>/snap, "DXF", <set of all>) - never renamed, deleted afterwards - and a DWG is opened read-only, exported and closed. Measured on AutoCAD 2026: ".dxf" is refused with Invalid argument, the file lands as snap.DXF, model space, paper space and unused block definitions all reach it, and the selection set does not narrow a DXF export. - engineering/understand/labels.py: %%c, \U+2205, the U+2300 sign, o-stroke and MTEXT format runs all read as one diameter spelling; sizes are kept as drawn and never equated; Cyrillic look-alike capitals fold into Latin tags; panels, wiring callouts and electrical data (kW, phases, volts, N, VFD) in EN / TR / RU / NL / DE. A power that is not written stays None. - engineering/understand/vocab.py: layer classification with a confidence and the deciding keyword, supply / return words, room labels and block kinds in five languages. A CIP layer without a direction word is not guessed. - MAX_DXF_BYTES defaults to 512 MB (a real layout was 188 MB); the refusal names the size and the variable. New `office` extra (openpyxl), also in `full`; uv.lock regenerated. Co-Authored-By: Claude Opus 5.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.5
parent
f0c50d772f
commit
9ab0ae1773
@@ -9,6 +9,9 @@ from pathlib import Path
|
||||
#: CAD this project is developed and tested against.
|
||||
DEFAULT_CAD_PROGID = "AutoCAD.Application"
|
||||
|
||||
#: Default ``MAX_DXF_BYTES``: 512 MB.
|
||||
DEFAULT_MAX_DXF_BYTES = 512 * 1024 * 1024
|
||||
|
||||
|
||||
class Settings:
|
||||
"""Server configuration loaded from environment variables."""
|
||||
@@ -62,9 +65,12 @@ class Settings:
|
||||
os.environ.get("DANGEROUS_COMMANDS_ENABLED", "false").lower().strip() == "true"
|
||||
)
|
||||
|
||||
# Reject opening DXF files larger than this many bytes (default 50 MB).
|
||||
# Set to 0 to disable the check.
|
||||
self.max_dxf_bytes: int = int(os.environ.get("MAX_DXF_BYTES", str(50 * 1024 * 1024)))
|
||||
# Reject opening DXF files larger than this many bytes (default 512 MB).
|
||||
# Set to 0 to disable the check. It was 50 MB until v1.6's track H: a
|
||||
# real plant layout read on 2026-09-24 was a 188 MB DXF, and the
|
||||
# understanding tools exist for exactly such drawings. The refusal
|
||||
# names the file's size and this variable.
|
||||
self.max_dxf_bytes: int = int(os.environ.get("MAX_DXF_BYTES", str(DEFAULT_MAX_DXF_BYTES)))
|
||||
|
||||
# Hard cap on list/select limit params to keep tool responses bounded.
|
||||
self.max_list_limit: int = int(os.environ.get("MAX_LIST_LIMIT", "5000"))
|
||||
|
||||
Reference in New Issue
Block a user