Three review findings on the standards data layer, each a value the layer
let through that a backend would then write as a silent wrong number or a
drawing that can no longer be saved:
* validate_textstyle never checked math.isfinite, unlike its siblings; nan
and inf passed every comparison and reached the STYLE record verbatim.
It now has the same _number helper dimstyles and mleaderstyles use.
* The three private _ILLEGAL_NAME_CHARS copies omitted \n \r \t that
security._FORBIDDEN_SYMBOL_CHARS holds, so 'a\nb' was accepted as a text
style, DIMTXSTY or leader text style and ezdxf refused the save. The rule
now lives once in engineering/standards/names.py (fastmcp-free), the
three modules import it, and a test pins its character set equal to
security's and its output equal to illegal_symbol_name_chars.
* DIMBLK/DIMBLK1/DIMBLK2 were ("str",): any string went through, and the
test pinned '_OBLIQUE', which ezdxf's writer refuses at doc.write while
the COM engine wants exactly that spelling. They are now ("arrow",):
canonical_arrowhead accepts a built-in with or without its underscore in
any case (and '', '.', CLOSEDFILLED for the closed filled default), emits
AutoCAD's documented block-name spelling (also what ezdxf reports after a
load), and holds user block names to the symbol-name rule; ARROWHEAD_BLOCKS
is pinned equal to ezdxf's ARROWS vocabulary, and ezdxf_arrowhead is the
one translation the headless writer needs, proved by exporting all twenty
headlessly and reading each back as its canonical name.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
"""Authored drafting standards data.
|
|
|
|
Dimension, text and leader style presets live here (track E, group S); the
|
|
system-variable catalogue, paper sizes, plot styles and templates are sibling
|
|
modules added by their own groups and imported by path. Everything in this
|
|
package is data plus validation — no I/O, no ezdxf, no COM — so the backends,
|
|
the tools and the provenance tests read one copy.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from engineering.standards.dimstyles import (
|
|
ARROWHEAD_BLOCKS,
|
|
DIM_VARIABLE_RANGES,
|
|
DIM_VARIABLE_WHITELIST,
|
|
PRESET_VARIABLES,
|
|
PRESETS,
|
|
canonical_arrowhead,
|
|
check_dim_value,
|
|
describe_preset,
|
|
ezdxf_arrowhead,
|
|
resolve_dimstyle,
|
|
validate_overrides,
|
|
)
|
|
from engineering.standards.mleaderstyles import MLEADER_PRESETS, resolve_mleaderstyle
|
|
from engineering.standards.textstyles import TEXT_PRESETS, resolve_font, validate_textstyle
|
|
|
|
__all__ = [
|
|
"ARROWHEAD_BLOCKS",
|
|
"DIM_VARIABLE_RANGES",
|
|
"DIM_VARIABLE_WHITELIST",
|
|
"MLEADER_PRESETS",
|
|
"PRESETS",
|
|
"PRESET_VARIABLES",
|
|
"TEXT_PRESETS",
|
|
"canonical_arrowhead",
|
|
"check_dim_value",
|
|
"describe_preset",
|
|
"ezdxf_arrowhead",
|
|
"resolve_dimstyle",
|
|
"resolve_font",
|
|
"resolve_mleaderstyle",
|
|
"validate_overrides",
|
|
"validate_textstyle",
|
|
]
|