* AutoLISP: entnext reaches an INSERT's ATTRIBs and SEQEND (#1660)
- lisp: name an INSERT's ATTRIB and SEQEND records; entnext walks them, then the next main
entity, and entget lists a record with its owner in group -2 (#1660)
- lisp: entmod of an ATTRIB takes its value (group 1) only, as one undo step; another property,
a SEQEND, entdel and entmake of one return nil and change nothing (#1660)
- doc: the handles LISP named, shared with the drawing's snapshots and never given out by
new_handle; 65,536 names, 1,024 probes past taken handles (#1660)
- io: entity_sub_record, one record of an INSERT at a time, never its other records (#1660)
- engine: an optional host hook for that record, so EntityCodec is unchanged (#1660)
- cli, web, app: install the hook; CLI tests for the walk, the value edit, the name bounds and
the refusals (#1660)
- docs: autolisp.md on the records, their names, when a name ends, and the value-only edit (#1660)
- reused from #1753 (closed), with thanks: the entity_list extraction with the -2 owner, the
writer's record splitting, and the entnext_walks_an_inserts_attribs test skeleton
* Keep AutoLISP's attribute names within their drawing
- Hold an INSERT's attribute names in the session's LISP state, not in
cadcraft_doc::Drawing: comparing drawings is plain data again and takes no
lock. The session reserves the handles in the drawing before any change, so
new_handle still never gives one out, also after a drawing swap.
- End the names when the Block Editor closes: its drawing starts from the
host's handles, so a name given there must never resolve to a host record.
- End only the erased reference's names on ERASE. Erasing another object
leaves an attribute name holding, and OOPS still revives none.
- Go on to the next entity when an INSERT has no record provider installed.
- Refuse an ATTRIB edit whose outer list ends in an atom.
* Keep issued attribute names out of the drawing.
A copied drawing could reuse a name, and storing the names in the drawing marked a saved drawing changed.
* Name an INSERT's ATTRIBs and SEQEND apart from drawing handles
An ATTRIB or SEQEND has no handle of its own in the drawing, so the
name AutoLISP gives it is now a value of its own (an entity name for
`type`), numbered from one count for the whole process that never
gives a number twice. No handle of any drawing, of a copy of one, of
another session or of another thread can be such a name, so nothing
is reserved in the handle space any more: cadcraft-doc, `new_handle`
and the copy-then-install paths are as on main, and naming or reading
a record changes neither the drawing nor its saved state.
What a name stands for (reference, place, tag) stays in the engine's
LISP state, by document. Names end on Undo, Redo, ATTSYNC,
-BLOCKREPLACE, on opening and closing the Block Editor, and when a
change is taken back; erasing a reference ends only its names, and
OOPS or `entdel` bringing it back revives none. `entupd` of a record
answers its name; selection sets and `command` take no record.
Tests cover other sessions, documents and threads giving out handles
in a drawing copy, the copy paths (INSERT from a file, XATTACH, AUDIT,
REFCLOSE), and the AutoLISP behaviour of the names.
* Keep one ATTDEF index per state of a block's entities
EntityStore gets a content token: a clone has its store's, and every
edit gives the store one that no store has had. The DXF writer keys
its ATTDEF index on that token and keeps the indexes of several
blocks, up to a fixed number of tags in all. Two copies edited apart,
or a different edit after Undo, never read each other's definition
properties, in AutoLISP reads or in a saved file, and reads that
alternate between references of different blocks examine each
definition once.
* End record names when a command puts an earlier drawing back.
MOCORO Undo restored its history drawing, handle seed included, so the next Copy could reuse the removed reference's handle. That restore now advances the name epoch. An ATTDEF index that would pass the tag budget is not stored.
* Match an oversized ATTDEF definition in full and remember it is too large to index
* Count record names with try_update, not the deprecated fetch_update
Rust 1.100 deprecates fetch_update and names try_update in its place, so
clippy with -D warnings stopped the gate at RecordName::fresh. It is the
same operation: the checked increment and the None once the count runs
out are unchanged. try_update compiles on Rust 1.95, the workspace's
minimum.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* Record tests check the objects they rely on
Five tests could pass without the state they are about.
The two ATTDEF index tests changed only a layer, so both states of the
block gave T the same handle, and an index kept for the wrong state
still read the right layer. One state now keeps T on the first ATTDEF
and the other passes T to the second, on another layer. With one index
shared by every store, the old tests passed and these fail.
The MOCORO and grip Copy tests did not check that a copy was made, or
that the copy after the Undo took the removed copy's handle. They now
check both, and that the name read the first copy before the Undo.
The walk at the top of the handle range compared two values that are
both nil when the line at FFFFFFFFFFFFFFFF is not in the drawing. It
now reads that line first.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* Test that entdel preserves unrelated ATTRIB names
* Fix AutoLISP record lifetime and REFEDIT edits
* Run attribute name cases in engine integration suite
* Fix text fixtures after main merge
---------
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Keeps both sides in text_box (main's fitted height and rotation, this
branch's mirroring) and sets the two flags on the Text literals main
has added since.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
check() takes a read-back with no answer within 10 s as a pass, so the
device test that called it couldn't tell an answered read-back from a
timeout (it took 10.9 s on the Linux CI runner). Call clear_and_read and
require Ok(true) for both passes, naming the adapter and the time taken.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the first start of the window's graphics fails, run eframe again in the
same process with the next attempt instead of exiting:
- the start as it always was (DirectX 12 alone on Windows, eframe's backends
elsewhere);
- OpenGL alone, where those backends have it beside another;
- the same backends on a software adapter (WARP, llvmpipe).
Each is tried with a stencil buffer, then without. No attempt creates a
backend the first one didn't, so Windows still never creates OpenGL (#31).
What failed picks the next attempt: an adapter, device or surface error moves
to another adapter; a failure the stencil buffer is part of tries the same
adapter without it. Before the app is created, a clear-and-read-back check
catches a driver that takes the stencil buffer and draws nothing (#1724's
Mesa log). A canvas whose GPU pipelines are refused draws on the CPU.
WGPU_BACKEND and CADCRAFT_STENCIL still win. Nothing is remembered between
starts. The log and the status bar say which renderer draws and why. When
every attempt fails, the first error is returned. A debug-only
CADCRAFT_GRAPHICS_FAULT switch fails one step of one attempt, for testing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TEXT, ATTDEF and ATTRIB have their own Backwards and Upside down, as AutoCAD's do (DXF group
71: 2 backwards, 4 upside down). New TEXT and attribute definitions take them from their style;
changing the style afterwards leaves existing text as it is. They were the style's only, so
text read from a file with its own flags was drawn as its style said.
- Model: `Text::backwards` and `Text::upside_down` (serde default false).
- DXF: read from 71 (the object's own groups, before an embedded MTEXT) and written when set.
- Render: drawn from the text's flags; the extents box mirrors with them, so zooming to
extents frames mirrored text. Linetype text keeps its style's.
- Properties: a Misc group with Upside down and Backwards (`properties.describe`, and
`properties.set` takes `backwards` and `upsideDown`), for several texts at once with *VARIES*.
- ATTDEF builds its text as TEXT does, so it also takes the style's width factor and obliquing.
- Round trip: #2237's matrices compare both flags, with DXF and DWG cases for them. Its
mirrored-style cases mirror the text by the text's own flags, and each mirrored style
also has text whose flags differ, so a style's flags can't leak into its text's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(nightly): wire craft-nightly for direct-launch self-isolation
* fix(nightly): bump craft-nightly for single-instance sockets and add Windows regression test
A LISP expression at Command: runs in 400,000-step slices, and only the
window's per-frame lisp_tick carries a routine on. Session::script gave
its next input right away and returned, so outside the window a routine
longer than one slice stopped after it for good: cadcraft-cli run and the
headless MCP server reported success with the routine cut short, and the
next LISP line got "a LISP routine is already running".
Session::lisp_run_until_input carries on such a routine until it ends or
waits for input (a get... prompt or a command pause). A script calls it
before each input it gives and once it ends, so the input goes to what
the routine waits for, or comes after it. The headless MCP backend calls
it after a command line and after Enter, since it has no frames either.
The window's own command line keeps its slices and Esc; a script in the
window, which already runs synchronously, now holds it until the routine
ends or waits.
Nobody can stop such a routine by hand, so it stops after
Limits::frameless_steps steps (BLOCKING_CAP, as a programmatic lisp call)
with the same "routine stopped after N steps" error; an endless *error*
handler is stopped one slice later.
Tests: lisp::tests::a_script_runs_a_long_routine_on_before_its_next_input,
lisp::tests::a_script_stops_an_endless_routine, cadcraft-cli
lisp_script::a_long_routine_in_a_script_draws_before_the_save and
cadcraft-mcp tests::headless_lisp_routines_run_to_their_end; all fail
without the change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The MCP bridge (`Remote`) sent its requests to whatever accepted on the control
port. It now opens each connection with a `hello` carrying a fresh nonce and no
token; the app answers with HMAC-SHA-256 of the nonce keyed with the session
token. Without a token for the port, or without a valid proof (checked again
against the token file once, for a restarted app), the bridge sends nothing.
The control server answers `hello` before the token check without counting it
as authentication, and closes a connection that hasn't shown the token within
10 s of opening, however its bytes trickle in, so peers without the token can't
hold every connection slot until the 10-minute idle timeout. The bridge
replaces an unauthenticated connection close to that deadline before writing a
request to it.
Part of #1925.
The control server checks a request's token only after reading the whole
line, and clients send the token last, so a local peer without it could
make the app buffer a line of up to 256 MiB (512 MiB across connections).
Until a request on a connection has passed the token check, a request
line may be at most 64 KiB (control_token::MAX_UNAUTHENTICATED_LINE); a
longer one gets an error reply and the connection is closed. After that
the usual 256 MiB limit applies.
The MCP bridge sends a short ping with the token before a longer request
on a new connection, and sends the request only when the ping's reply
shows the token check passed; a refused or lost ping leaves the request
unsent and safe to retry. docs/control-protocol.md describes the limit.
Part of #1925 (F-12).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first commit made `cadcraft-cli convert` print the note, but the app's
own commands write images through IoHooks::write and ::plot, which return
bytes only, so the desktop and web apps and LISP stayed silent (#1069).
- cmd::file::set_noted_io(NotedIo { write, plot }): an optional hook beside
IoHooks (which is built by struct literal in ~70 places), installed by the
CLI, desktop and web apps with cadcraft_io::write_framed_noted and the new
cadcraft_io::plotter::plot_noted / pdf::plot_noted.
- EXPORT, PLOT (so EXPORTPDF, PUBLISH and PDFBOOK per sheet), QSAVE and
SAVEAS to an image and document.bytes echo the note and add it to the
result's `warnings`. An image written with a `version` option goes through
the same writer (same bytes), so it is noted too.
- report_notes adds to `warnings` instead of replacing them;
report_dwg_notes uses it (no result had `warnings` before it, so DWG
results don't change). Without the hook nothing changes.
Not covered: the plot preview and the canvas show no message.
Fixes#1069.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The filter labels were translated on the dialog's thread, where the
interface language (thread-local) is English. They are now read on the UI
thread and handed to the dialog's thread.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The Open, Save, APPLOAD and ALIASEDIT dialogs ran in the window's event
handler and waited there for the desktop portal's dialog. For as long as it
was open the window answered nothing, and after a few seconds the desktop
offered to force-quit the app. The dialog now waits on a thread of its own,
through Services::start_pick, as the macOS sheets do.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A dashed run is laid out over at most two million pattern elements, but
nothing bounded the total, and a pattern of mostly gaps visits many elements
for each point it draws, so the 64M-point display budget never stopped it:
1,000 lines on a 256-element pattern of gaps and one dash (a 58 KB DXF) took
11.6 s to PNG and 12.7 s to a 69 MB PDF on a dev build. A run past the
per-run limit was also drawn continuous without a word (#1069).
- MAX_DASH_ELEMENTS (64M, as many as the list's points) is charged by
linetype::layout before a run is laid out, on a counter shared like the
point budget's (parallel parts, XCLIP parts, viewport contents). Once a run
does not fit, the rest of the build's dashed runs are drawn continuous.
The per-run limit is MAX_RUN_DASH_ELEMENTS, unchanged.
- A run drawn continuous because of either limit sets DisplayList::truncated
and counts in the new DisplayList::undashed, merged where lists are joined.
Runs drawn continuous by rule (short, sub-pixel, the screen's 50,000-period
level of detail) are not counted.
- cadcraft_io::write_framed_noted (and png/svg/pdf "noted" variants) return
the note; cadcraft-cli convert and run --export print it.
- Linetype texts are placed only on a run whose dashes were laid out; phase
checks the limits without laying the run out again.
On 11 real drawings the most a complete plot asked was 26.5M elements; a
16M total would have drawn 8,241 runs of that drawing solid. With 64M the
gap-pattern file takes 0.8 s / 0.4 s, the #1069 controls and three real
drawings export byte-identical, and the audit's dense dash/gap file stays as
on main (it fills the point budget at the same time).
Part of #1923 (F-05 f). Part of #1069: the app's EXPORT and PLOT don't show
the note yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nightly launch fix under Skylar's Exec 454: the Launcher's trailing `--` no longer reaches the file list where that applied, and a refused launch no longer blocks on macOS (the reason goes to stderr and the app exits 2).
acadrust 0.6.6 writes and reads a DWG linetype's element count as one
byte, so a linetype of 256 elements came back from a DWG save with none
(continuous) and one of 300 with 44. The DXF read cap of #3482 lets 256
through, so every capped DXF linetype hit the 256 -> 0 case.
The DWG bridge text now writes at most 255 elements per linetype (the
first ones, with group 40 totalling them); DXF output is unchanged.
cadcraft_io::dwg_notes gives one note counting the linetypes cut, counted
by the writer so an xref linetype the file leaves out is not counted. An
engine hook installed by the apps echoes it and returns it in `warnings`
on every DWG write: QSAVE/SAVEAS, document.bytes, EXPORT, WBLOCK,
-WBLOCK, LAYOUT SAVEAS; cadcraft-cli convert prints it.
Part of #1923 (F-05).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
muda's predefined Quit ends the process through terminate: without asking. The menu item
is craft-quit's Quit, a close request of the main window, so the close path asks first
as the close button does (#2157).
A press in the drawing, and a drawing that opens or becomes active, give the drawing the focus; a text field, a dialog
or a menu keeps it. The focused drawing keeps Tab (KeepKeys::Tab) only while a command runs, text is typed, value boxes
are live or a snap marker is under the cursor. A bare Tab with nothing focused is the framework's: capture_tab is gone.
Conflicts: Cargo.toml (kept the next/egui pins for every craft-libs entry, including main's new craft-csv and hayro-interpret/cmap/postscript patches), apps/cadcraft/src/main.rs (port's framework frame decision and apply_frame with main's os_window identity, persistence path and exit hook), crates/ui-egui/src/updates_ui.rs (next's argument-free check calls with main's check_updates_at_start gate). Main's new tests and dialogs switched to install_headless and escape_pressed.
Linux nightly packaging by @dylanmtaylor, with the per-app Nightly flavor commits stacked on his branch.
Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
The native menu bar refreshed enablement with the command's own check,
so Edit > Paste stayed disabled there until something was copied in this
window. It now asks clipboard::offered, like the in-window menus and the
context menu.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The runtime is installed in the desktop and web shells, before_input runs in the raw hook,
the close path decides in embed::logic, and the interface scale is the runtime's RootEnv
scale. The dock is next's DockArea over the saved workspace with CADCraft's panel bodies
and the drawing as its canvas group; ui.dock keeps its JSON vocabulary. Update dialogs run
on a DialogHost, the macOS title row is shell::TitleBar, screenshots use the runtime's
screenshot slot, and Escape with nothing focused is read as the window's cancel.
A LARGE_RADIAL_DIMENSION or ARC_DIMENSION CADCraft keeps as read draws the
*D block its AcDbDimension part names, as AutoCAD does; without one, the
proxy graphics in its AcDbEntity part (the decoder learns POLYLINE_WITH_NORMAL,
chunk 32). Saving counts that block as used, so it is written and AutoCAD
reads the dimension again. cadcraft-cli no longer counts unknown entities
that draw graphics as not drawn.