feat(environment): portable layer states, named views and UCS on both engines
Layer states are ACADMCP_LAYERSTATES XRECORD chunks (<= 255 ASCII chars each), in the file and not in AutoCAD's Layer States Manager. Headless view restore writes the *Active VPORT (ezdxf's header has no $VIEWCTR; measured). UCS is stored and made current; tool coordinates stay WCS. 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
2805697d16
commit
dcc8f07bf4
@@ -0,0 +1,17 @@
|
||||
"""One rule for the names this package stores in the drawing."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def validate_name(name, *, what: str, max_len: int = 255) -> str:
|
||||
"""A non-empty, stripped string without control characters, else ``ValueError``."""
|
||||
if not isinstance(name, str):
|
||||
raise ValueError(f"{what} must be a string, got {type(name).__name__}")
|
||||
clean = name.strip()
|
||||
if not clean:
|
||||
raise ValueError(f"{what} must not be empty")
|
||||
if len(clean) > max_len:
|
||||
raise ValueError(f"{what} is longer than {max_len} characters")
|
||||
if any(ord(ch) < 32 for ch in clean):
|
||||
raise ValueError(f"{what} must not contain control characters")
|
||||
return clean
|
||||
Reference in New Issue
Block a user