Files
cadcraft/docs
e6bbf59c31 Expose xdata through entities, properties.set and AutoLISP's -3 group (#2469)
* Expose xdata through entities, properties.set and AutoLISP's -3 group

An entity's extended data was read, kept and written back (#528) but
invisible to the API: `entities` left it out, `properties.set` had no
field for it, `entget` never returned the -3 group and `entmod` dropped
it. Now `entities {xdata: true | "APP"}` and `properties` list it per
application with values typed by group code, `properties.set {xdata}`
replaces or removes one application's data after checking codes,
values, braces and sizes, and AutoLISP's entget/entmod/entmake carry
the -3 group, with `regapp` and the APPID table. The applications
CADCraft writes from its own model are reserved (one list, now in
cadcraft_doc, shared with the DXF reader).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Check xdata before any change in properties.set; cap entmake's xdata across applications

Review follow-ups on #2469:
- properties.set validated xdata after ensure_layer, so a request naming a new
  layer and carrying bad or oversized xdata left the layer behind on failure.
  The xdata checks now run first.
- entmake capped each application's groups but not their sum; an entity could
  exceed MAX_XDATA_GROUPS across applications. The total is checked as entmod
  already does, with a test.
- docs: the control-protocol xdata section is an h2 like its neighbours; the
  file-format-parity revision row no longer has a pipe inside a code span.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* properties.set checks every handle first; a dotted -3 group is a bad list

Review follow-ups on #2469:
- properties.set edited the objects before a handle that names nothing and
  then failed, keeping those edits (and a new layer). Every handle is checked
  before anything changes; a missing one is refused with its hex.
- xdata_from_list read `(-3 . 7)` as "no applications" and let entmake/entmod
  succeed with nothing set. A -3 whose cdr is not a list is refused (listp),
  so both return nil as for any bad list.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* An xdata application's groups must be a proper list

Review follow-up on #2469: `("ACME" . 7)` in a -3 group read as "no groups",
which `entmod` takes as "remove ACME's data", and a dotted tail after real
groups was dropped. The application's tail is checked as a list (listp) like
the -3 group itself, so entmake/entmod answer nil and change nothing; test
covers both shapes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Runs of one xdata application in any case are one application in the API

Review follow-up on #2469: a file can carry `ACME` and `acme` runs on one
entity. `entities` showed them as two JSON keys and `entget` as two lists, and
writing either back through properties.set or entmod replaced the application
twice, keeping only the last run's groups. Both projections now merge runs
case-insensitively (first spelling, all the groups), as set_xdata_app already
treats them; tests round-trip such an entity through both APIs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Refuse raw ACAD xdata on a dimension, whose ACAD run is written from its overrides

Review follow-up on #2469 (austin62jake): properties.set accepted
`xdata: {"ACAD": …}` on a dimension and `entities` showed it, but the DXF
writer emits the dimension's ACAD run (DSTYLE) from its overrides and the
reader models it back, so the raw groups vanished on save. ACAD can't join
RESERVED_XDATA_APPS (files carry ACAD data on other entities that CADCraft
keeps raw), so the rule is per entity: `is_model_xdata_app(name, kind)` is
the reserved list on any entity plus ACAD on a dimension. properties.set
refuses it before anything changes, entmake/entmod answer nil. Tests cover
both paths, including that ACAD on a line survives a DXF round trip and the
dimension's own override does too. control-protocol.md says so.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(lisp): return and accept REAL for xdata group 1071

---------

Signed-off-by: FredApps <153173854+FredApps@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: FredApps <fredapps@users.noreply.github.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-12-01 11:38:34 +01:00
..