* 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>
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.
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.
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.
Double-clicking single-line text, an attribute definition or a dimension
(no command running) now opens a one-line text box over it on the canvas,
as AutoCAD does, instead of asking at the command line (#842). Enter or a
click outside keeps the text, Esc cancels, and an emptied box keeps the old
text. A dimension's box shows its text override, or <> for the measured
value, with the measured value beside it; emptying it or typing <> alone
gives the measurement back.
The box answers TEXTEDIT's prompt, so the edit is one undo step and
scripts, the command line and engine.execute behave as before. The engine
describes what to edit through Interactive::text_editor, TextEditor and
EditorKind (MText, Line, Dimension), following the design in #2320.
Co-authored-by: Luminati <347279204+luminatiguy@users.noreply.github.com>
Conflicts in io/dxf_write/common.rs and sections.rs: the writer keeps the
used-handle set from #3304 and the paper-units marker from #3309 next to the
UCS tables and each layout's UCS.
The removal prompt picks one object since #2070, so an object given by name
arrives as a point. STRETCH looked the point up itself and could find a
different object lying there. It now asks the session, which returns the
named one.
Conflicts in cmd/image.rs (the unsaved-drawing hint and the read check both
stay) and lisp/value.rs (work counting and the cell check both stay). The
handle reservation that #3304 added walks record slices, as the rest of
the reader does here.
- DIMLINEAR on a selected circle measures its diameter along the dimension line in a turned UCS.
- DIST turns the difference vector onto the UCS axes, so a far UCS origin cannot round it away.
- A distance typed at TK with the cursor on the tracking point runs along the UCS X axis.
- A refused UCS save is checked before the drawing is touched, so it stays unmodified.
- A given non-numeric Z is refused instead of read as 0.
- UCS Origin as JSON moves a tilted UCS and keeps its axes, as the interactive option does.
- UCS ? turns saved axes as directions and names records whose axes are unusable.
- Named UCS axes in DXF match relative to their length.
- BREAK and BREAKATPOINT drop the selection their pick made when cancelled
after it, as Enter does.
- A polyline that is its own cutting edge is cut where it crosses itself near
its open start or end in parameter but not in length (a long first or last
segment).
- A retained piece of two arc spans whose ends meet is closed.
- A crossing window's pick is kept 1e-6 from a segment's end, not the window
tolerance, so it stays before a cut near that end in a large window.
ARRAYEDIT reads both key points before it resets or replaces items, so a bad one changes
nothing, and a new base point keeps replaced items in place (their blocks' base points move
with the source block's). A key point of a circle under an uneven array scale is one of the
ellipse it is drawn as. -ATTEDIT measures a picked height or angle from the point the text is
placed by, Angle turns an aligned or fit attribute's baseline, and Position, Height, Angle and
Style change a multiline attribute's text too. Reading layer states charges the file's budget
for the strings each entry writes, updates included.