Commit Graph
862 Commits
Author SHA1 Message Date
C00kieMonsta d7088aab34 Merge main into feat/pdf-import
main gave HatchLoop a boundary_flags field, so the gate's merge build
no longer compiles the PDF importer's loops.
2026-11-25 01:48:22 +00:00
C00kieMonsta 13b956c166 PDF import: convert to US survey units (INSUNITS 21 to 24)
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.
2026-11-25 01:26:59 +00:00
Tanish Manku 94b1174806 Merge main (after #3454, #3455); a block's image is hit on the outline of what it shows 2026-11-24 15:32:15 -07:00
Tanish Manku d538a468e4 Merge pull request #3455 from storytold/stack/u10
Land #3368, #3390, #3399, #3405, #3392, #3411, #3366: Thai PDF text, layout plot settings, Polish strings, dimension inline editor, table cell text, ATTDIA, system clipboard paste
2026-11-24 15:31:19 -07:00
Tanish Manku f80dbb461a Merge pull request #3454 from storytold/stack/p1
Land #3425, #3426, #3095, #3435, #3439, #3437: hatch edge, dependency prune, tilt check, proxy graphics follow-ups, kept dimensions
2026-11-24 15:23:27 -07:00
Tanish Manku c1f771d5cd Merge pull request #3424 from storytold/stack/b1
Land #963, #993, #1752 (with #1030, #1098, #1699, #1723): dynamic block references rotate, flip, array, scale, align and look up
2026-11-24 15:04:29 -07:00
Tanish Manku 59e7a0b178 Merge #2969: fix(engine): preserve hatch direction when mirroring 2026-11-24 14:36:27 -07:00
Tanish Manku df624b7a49 Merge #2977: fix(engine): respect DIMASSOC1 for new dimensions 2026-11-24 14:36:25 -07:00
Tanish Manku 6deb10f4a8 Merge #3152: Images: IMAGEATTACH refuses a wrongly typed at, scale, rotation or name 2026-11-24 14:36:19 -07:00
Tanish Manku b2c35cd100 Merge #3151: Images: loaders start a file only while its largest size still fits the loaded-image limit 2026-11-24 14:36:17 -07:00
Tanish Manku 137c8e8a08 Merge #3431: Use dimension text height for DIMSPACE Auto 2026-11-24 14:36:15 -07:00
Tanish Manku 7f5750dc1f Merge #3446: SPLINE: handle Method and Object at the CV first-point prompt 2026-11-24 14:36:14 -07:00
Tanish Manku 603852d47e Merge #3411: INSERT: ATTDIA and the Edit Attributes dialog (repair of #2376) 2026-11-24 14:35:28 -07:00
Tanish Manku 6db635aadb Merge #3437: keep proxy graphics on their layers when the layer table changes (#3094) 2026-11-24 14:34:57 -07:00
Tanish Manku 8fb4d81338 Merge #1752 again: the six review fixes (array budget, alignment grips, frozen layers) 2026-11-24 14:28:29 -07:00
Cody VogtandClaude Opus 5.5 ced6984630 Alignment grips: targets stay on a ray and off layers frozen in the viewport
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>
2026-11-24 10:46:32 -06:00
bic98andOpenAI Codex 1a0363905b SPLINE: handle Method and Object at the CV first-point prompt
Co-authored-by: OpenAI Codex <noreply@openai.com>
2026-11-24 22:04:03 +09:00
bic98andOpenAI Codex 877ce87557 SPLINE: ask again when the CV degree is fractional
Co-authored-by: OpenAI Codex <noreply@openai.com>
2026-11-24 21:32:04 +09:00
Walter Haslbeck 3ac368c013 Kept dimensions reference their *D block instead of copying it
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.
2026-11-24 12:08:09 +01:00
Walter Haslbeck a4aa6cfa68 fix: keep proxy graphics on their layers when the layer table changes (#3094)
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).
2026-11-24 09:25:46 +01:00
cloutier a888218786 fix(engine): use dimension text height for DIMSPACE Auto (#3429) 2026-11-23 22:36:37 -05:00
code-compliant d759668ff6 INSERT: a point does not answer an attribute prompt; ATTDIA defaults to 1
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.
2026-11-24 11:16:51 +08:00
Tanish Manku ddb9a424ef Merge pull request #3423 from storytold/land/2697
Land #2697: draw the proxy graphics of objects from other applications
2026-11-23 17:12:17 -07:00
icelyfireandClaude Opus 5.5 a974b2026f Add the Write Block dialog for WBLOCK (#1778)
* 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>
2026-11-23 17:36:26 -06:00
Tanish Manku e2cd875560 Merge #1752: Dynamic blocks: base point and alignment parameters; lookups of angles, flips, XY and positions 2026-11-23 12:50:36 -07:00
Tanish Manku d1a4809b2b Merge #963: Dynamic blocks: a stretch or move carries a multiline attribute's text along 2026-11-23 12:50:18 -07:00
Tanish Manku fc82a0d148 Merge #2697: draw the proxy graphics of ACAD_PROXY_ENTITY (#2646) 2026-11-23 12:49:40 -07:00
Tanish Manku 6601baf63d Merge pull request #3418 from storytold/stack/u9
Land #3397, #3409, #3369, #3370, #3374, #3367, #3363, #2979: MTEXT corner and Ortho, window selection drift, CLI fixes, per-column MTEXT boxes, DIMASSOC in DXF
2026-11-23 12:47:43 -07:00
Tanish Manku 051b11a271 Merge #3393: DWG 2007: omit older-layout visual styles and report the loss 2026-11-23 12:22:09 -07:00
Tanish Manku 685bc51442 Merge #3389: DXF and DWG save: a hatch keeps its boundary path flags, so islands stay holes in other programs 2026-11-23 12:22:06 -07:00
ViktorBystrov72 1cfc7d8f17 PLINE: keep the current drawing elevation 2026-11-23 18:24:18 +05:00
code-compliant d3419d156a INSERT: only a command a person started opens the Edit Attributes dialog
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.
2026-11-23 20:42:26 +08:00
code-compliant ed012ca376 INSERT: a command a script starts never opens the Edit Attributes 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.
2026-11-23 20:42:04 +08:00
code-compliant 5b00e36200 Edit Attributes: a dialog draft belongs to the drawing and command that asked for it
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.
2026-11-23 20:42:04 +08:00
Walter Haslbeck 4680fd28a6 Merge main (a70b9b02) into fix/2646-proxy-graphics
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.
2026-11-23 10:56:07 +01:00
code-compliant bd7b7b77b0 Merge main into pr/insert-attrib-modes
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.
2026-11-23 13:21:47 +08:00
Zaxaerith e5972c994e fix(engine): ignore Ortho mode for MTEXT opposite corner (#3388) 2026-11-23 10:58:38 +08:00
Jon Breen 6c5fdfdd32 DWG 2007: omit older-layout visual styles and report the loss
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.
2026-11-22 17:29:42 -06:00
Jon Breen a4d8cae573 DXF and DWG save: a hatch keeps its boundary path flags, so islands stay holes in other programs
See the pull request description for the cause, the change and the tests.
2026-11-22 16:24:59 -06:00
C00kieMonsta d4fd0dd7a2 PDFIMPORT: a page of a PDF imports as editable lines, polylines, solid hatches and text
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.
2026-11-21 21:31:15 +01:00
Vincent Cloutier a1b77015b6 Refresh MIRROR hatch direction against current main 2026-11-21 14:04:42 -05:00
Vincent Cloutier fbcebf3392 Refresh DIMASSOC mode handling against current main 2026-11-21 13:53:54 -05:00
Cody Vogt b92da359bd Merge storytold/cadcraft main into feat/dynblock-params
# Conflicts:
#	crates/engine/src/snap.rs
2026-11-21 11:02:42 -06:00
Tanish Manku b39170aded HATCHGENERATEBOUNDARY: a mirrored hatch's boundary goes to its world height; the command is classified as using no files 2026-11-20 16:45:17 -07:00
Tanish Manku e5a7d38a67 Merge #2804: Generate Boundary in a hatch's right-click menu (#2801) 2026-11-20 16:37:35 -07:00
Tanish Manku ea4a59b662 Save warning: a DXF before 2013 that leaves out solids points to 2013 and later
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.
2026-11-20 14:23:07 -07:00
Tanish Manku 9e645ba17a Merge #3234: DXF: write kept proxies in the layout of the version written (#3229)
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.
2026-11-20 14:22:04 -07:00
Tanish Manku af5c658a4b Merge #2882: Solids: no empty modeler records before 2013; list ACIS 4.0 SAT a DWG can't keep (#2334)
# Conflicts:
#	crates/io/src/dxf_write/sections.rs
2026-11-20 14:19:21 -07:00
Tanish Manku 4b97a1a25e Size the in-place box of annotative text and dimensions as drawn
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.
2026-11-20 11:45:43 -07:00
Tanish Manku 44e0e431ee Make the in-place text box cover the text as drawn
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.
2026-11-20 10:56:18 -07:00