Survey feet, inches, yards and miles fell through to the millimetre
case, so a page imported into a drawing in survey feet came in 304.8
times too large. A survey foot is 1200/3937 m.
The alignment search projected the cursor onto a ray as if it were an
xline, so a point behind the ray's base could be the target; behind it the
base is now the nearest point. It also passed no frozen layers, so an object
on a layer frozen in the active MSPACE viewport (not drawn there) could be
aligned with; `nearest_with_direction` now takes the viewport's frozen
layers, as the osnap search does.
Review of #3424 (CodeRabbit).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review: copying block contents into the graphics multiplied nested
dimensions exponentially, missed nested pictures and the block's draw
order. One reference to the block lets the renderer's depth and size
limits, nesting and SORTENTS apply as for any block reference. PURGE keeps
the block a kept dimension names; picking uses the drawn block.
Proxy graphics name layers by their index in the file's LAYER table.
- Layers proxy graphics draw on count as used for PURGE and layer.delete,
as in AutoCAD.
- Drawing::proxy_layers keeps the file's layer order under current names;
saving turns each ATTRIBUTE_LAYER index into the written table's, so
purging a layer before them no longer moves the graphics (AutoCAD itself
saves the old indices).
- RENAME, LAYMRG and LAYDEL update the decoded graphics and that list.
- A LAYER or LTYPE record without a handle or name keeps its place in the
index lists, so the records after it don't shift (review of #3423).
A canvas click reaches INSERT as Input::Point while the attribute prompts wait. The Attribs arm treated any non-text input as the default and advanced, so the dialog closed and the first attribute took its default. Ignore Input::Point and keep prompting, as Verify does; Enter still keeps the default.
Set ATTDIA's session default to 1, AutoCAD 2026's initial value, and update tests that assumed 0 to set it explicitly. Add tests for a point at the plain command line and a canvas click with the dialog open.
* Add the Write Block dialog for WBLOCK
WBLOCK typed or started from a menu now opens a Write Block dialog instead of
failing with "`path` is required": source (block, entire drawing or objects),
base point and destination file, with Select objects and Pick point that hide
the dialog for a canvas pick and bring it back. JSON calls are unchanged.
A new WBLOCKPICK command runs those picks and keeps the result in
Session::wblock_picks, like HATCHPICK does for the Hatch dialog. Escape closes
the dialog, and ends the command while picking.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(wblock): address CodeRabbit review comments
- WblockPickM Objects: use SelectPhase::default() instead of begin(s)
so canvas picking always prompts explicitly, even with a pre-existing
selection (the dialog pre-fills handles itself)
- wblock.rs: reject non-numeric/non-finite base coordinates with an
error message instead of silently defaulting to 0
- Add i18n strings for the two new coordinate-error messages (it)
- Add test: preexisting_selection_still_prompts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(wblock): address review comments from skylartaylor
1. EntireDrawing now passes `name: "*"` to run_wblock, which clones the
whole drawing (all layouts, paper space, INSBASE preserved) instead of
sending only d.model handles and resetting INSBASE.
2. Add integration tests in wblock_dialog.rs that call run_wblock and
read back the written file for EntireDrawing and Objects+base modes.
3. Reformat parse_coord's early return to satisfy rustfmt.
4. Drop the two "Mouse wheel zooms…" rows from it.tsv; they belong to
the wheelzoom PR, not this one.
5. resume() now checks that the current drawing UID matches the one the
pick started in, mirroring hatchdlg::resume; start_pick restores the
dialog when wblockpick fails to start instead of closing silently.
6. Add all wblock dialog labels to uk.tsv (Source, Destination, Base
point, Pick point, File name and path, etc.); fix the period mismatch
in the "No objects selected" error key.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test(wblock): call confirm() directly and add layout-entity coverage
- Make confirm() and picked_handles pub so integration tests can reach them.
- wblock_dialog.rs now calls wblock::confirm() instead of app.run, so the
test fails if confirm constructs wrong params (addresses CodeRabbit comment).
- app_with_two_entities adds one paper-space entity via Drawing::add so the
EntireDrawing test can also assert j["layouts"] == 1 (second CodeRabbit
comment).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test(wblock): assert base-point translation and INSBASE preservation
- write hook now records Line endpoints so the Objects test can verify
that the base-point offset is actually applied to entity coordinates:
line (0,0)→(10,0) with base (5,3) becomes (-5,-3)→(5,-3).
- EntireDrawing test sets INSBASE to (7,3) before confirm() and asserts
the exported drawing still carries (7,3), covering the preservation
behaviour of whole-drawing mode.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* wblock: the chosen path clears an earlier file-dialog refusal
Clicking "…" while the save panel is still open shows "A file dialog is
already open; answer it first." The message stayed after the panel was
answered; the path chosen now clears it. The button's code moves into
browse(), with a test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* wblock: the dialog belongs to the drawing it was opened on
Opened on drawing A and left open while drawing B was shown (its file tab),
OK applied the retained source, handles and destination to B: with
drawing-local handles colliding, B's objects were written to A's file.
The dialog now keeps the drawing's uid when it opens (and binds to the
current drawing when opened by name with no state). It closes once another
drawing is shown, as the Hatch dialog does, and confirm() refuses to write
from another drawing, saying why.
Tests: for Objects, Block and Entire drawing, the dialog opened on A, B
shown through document.switch (what the tab runs), B holding the same
handles and a block of the same name: confirm() writes nothing, one frame
closes the dialog, and back on A nothing is written either. The two
existing confirm() tests now open the dialog first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* wblock: English keys only, and the completion message through i18n
As AGENTS.md rule 16 asks, the Italian and Ukrainian rows this PR added
to the app catalogs go to a linked storytold/craft-i18n PR instead. The
Chinese row for the WBLOCKPICK command label stays: every command label
must be in zh for chinese_menus_and_commands_are_fully_translated, and a
test can't be weakened to make a check pass (rule 31).
The completion message ("N objects written to …") and the dialog's
selected-object count were English built with format!; they now go
through crate::tf! and crate::i18n::count, so each has a catalog key
and a plural form.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A script's flag was the only origin INSERT consulted, and only Session::script
set it. A LISP (command "-INSERT" …) — in a LISP file, APPLOAD, or
engine.execute {"command":"lisp"} — started INSERT outside a script, so a
routine that ended before the first attribute answer left ATTDIA 1 to open a
dialog it could never answer; a routine resumed after a yield had the same gap.
Commands now record who started them for their whole life
(Session::command_origin(): a person at the command line or from a menu,
toolbar or palette, or a program), and INSERT opens the dialog only for a
person's command. Session::start_programmatic marks an AutoLISP (command …)
start, and Session::start takes a script's commands as the program's, so the
scripted INSERT still asks at the command line. A typed or menu INSERT keeps
the dialog.
INSERT copied ATTDIA into the command without asking who started it. A
script that ends before the first attribute answer leaves INSERT waiting,
so a scripted -INSERT with ATTDIA 1 exposed the Edit Attributes dialog,
which a script cannot answer.
InsertM now records whether a script started it (Session::script_running)
for its whole life, and ATTDIA opens the dialog only for a command the
user started. A typed INSERT with ATTDIA 1 still asks in the dialog.
The dialog kept its draft by block name and row count alone. A cancel
through the control channel runs before the dialog frame, so a second
INSERT of the same block could reach its attribute prompts in the same
drained batch and then inherit the cancelled draft; OK, or a queued
confirmation, submitted those values to the new command. A redefined block
with the same name and row count got values meant for other tags.
Session::attribute_entry now stamps each entry with the active drawing's
uid and the command's number in Session::commands_started, and the dialog
shows its draft only while both still match. A replacement command starts
from its own defaults, so a confirmation left over from the old dialog can
only submit what the new one shows.
Conflicts: dxf_read.rs (proxy tables next to the UCS names), render/blocks.rs
(proxy graphics inherit the proxy's own transparency without its locked-layer
fade, as block contents now do), roundtrip test (allow_in_process). Two tests
main added build an Unknown and get the graphics field.
Main gained ATTREQ, Preset and Verify prompts (#2535) while this branch was
open, so what is new here is ATTDIA and the Edit Attributes dialog: the
setting and its SETVAR registration, Session::attribute_entry and its guard
hook, the dialog, and the tests. Main's prompt flow is kept as it is: every
attribute value at the command line (or in the dialog), then the Verify
attributes asked again.
INSERT counts its attribute answers per definition (`asked`) instead of by
tag, as main still does: a block with two definitions of one tag stopped
asking until the map grew, which it never did. The duplicate-tag test fails
without it.
docs/gaps.md and docs/ui-parity.md keep main's rows; the affected rows are
named in the pull request instead.
Leave fixed-property visual styles out of DWG 2007 saves and count them in the save report. Expose the same count to hosts and cover the affected and unaffected save paths with synthetic tests.
PDFIMPORT (File > Import PDF...) adds a chosen page to the current drawing,
with page, scale, insertion point, password and content options. OPEN and
IMPORT take a PDF too; OPEN reads its first page into a new metric drawing,
and cadcraft-cli convert writes it to DXF or DWG.
The mapping is adapted from PR #2787 (MIT OR Apache-2.0) onto craft-pdf's
interpreter. Nonzero fills whose contours don't cross keep their loops and
arcs; crossing contours are split into triangles so the filled area matches.
Content the import leaves out or approximates is named in the read notes,
and a page with no vector content is refused instead of opening empty.
Since #2882 a DXF of 2010 or earlier leaves out solids whose geometry only
the data store holds, and the interactive QSAVE asks before it does. The
warning's hint still said DXF 2010 and earlier keep them, which is the
version that loses them. The hint now depends on the version the file is
saved in: 2013 and later keep such solids, and the proxies a DXF before
2007 leaves out as well. Also rustfmt of the merged finish signature.
Conflicts with #2882 resolved: a DXF's loss report counts both what #2882
leaves out (solids whose ACIS geometry the version has no place for, in
either direction of 2013) and what #3234 leaves out before 2007 (proxies
whose strings it can't hold, with what goes with them), each named with its
own reason, for SAVE/SAVEAS, document.bytes, EXPORT, -WBLOCK and the
interactive QSAVE question. dxf_raw::finish takes both flags.
At a non-unit annotation scale an annotative TEXT, attribute definition or
dimension is drawn scaled; the editor box now takes its height, position
and extents from that scaled object, as the renderer and EXPLODE do.
The one-line editor was narrower than the text it edits: an egui area
caps its width, and a centred or right-justified text's box started at
its insertion point. TEXTEDIT now gives the editor the drawn text's
extents (TextEditor::extents, from the renderer's text placement), and
the box starts at the drawn left edge, is at least as wide and as tall as
the drawn text, and still grows as more is typed.