mirror of
https://github.com/storytold/cadcraft.git
synced 2026-12-01 18:25:32 -06:00
c3d23ce22529e69dc01bbdc8d8a40e5dabc55ecb
11
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
fc992081a7 |
Merge remote-tracking branch 'pr/2794' into stack/t2
# Conflicts: # crates/engine/src/lisp/builtins/files.rs |
||
|
|
65ed2fb7f0 |
Blocks palette: previews, block libraries and placement (#2122)
* Blocks palette: list/medium/large icon modes, visible-only preview cache, grab-and-drop placement * Address CodeRabbit review: repeat-placement tracking, Arc<Drawing> clone, contains_pointer, docstrings * Keep repeat INSERT inside engine state machine and leave canvas hover check intact * Handle Repeat/NoRepeat across all INSERT stages and bound preview work budget * Fix Blocks palette review findings and preflight polyline previews * Fix Blocks palette review findings and menu click ownership * Restore bounded hatch thumbnails and exclude navigation clicks * Support faithful hatch previews with shared work budget and bounded contour fallback * Allow checking Repeat placement while block insertion is already in progress * Address PR 2122 review feedback on hatch budget, ViewCube hit-testing and preview test * Charge leader and wipeout expansion and bound MLeader array inserts in preview preflight * Charge MLeader paths in preview preflight and match ViewCube hit-testing to displayed sheet * Allow block insertion while rename editor is open and clarify hatch preview docs * Limit palette repeat placement to palette-started insertions * Account hatch preview comparisons as work occurs * Bound attribute thumbnail work and preserve palette rotation * Charge spline sampling work to the block preview budget * Charge splines at 1/32 of their sampling cap so ordinary blocks still preview * Charge text lengths in block preview budget and preserve inline INSERT arguments * Bound MText column metadata in block previews * Allow detailed block palette previews * Explain refused block previews and keep them cached while scrolling Previews now return Ready, Empty or Unavailable(reason) instead of an ambiguous empty display list, so a refused thumbnail is no longer shown like an empty block. Preflight separates input, computation and retained output, and reuses the geometry/render sampling rules at a thumbnail tolerance instead of a 4,000-sample worst case. A 64 MiB / 512-result LRU replaces retain_visible. Insertion never depends on preview success. Also: invalid-but-finite splines draw as their control polygon, and the insertion-point prompt advertises REpeat so R keeps meaning Rotate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Remove changes unrelated to the Blocks palette Drop the contributor entry and the two xtask test adjustments so the PR only contains palette, preview and insertion changes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Document the functions touched by the Blocks palette preview work Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Keep placement on unchanged rename and tighten palette click ownership Confirming a block name unchanged no longer cancels the INSERT in progress. Command-line releases are not placed as points when two arrive in one frame, and menu ownership of a press is taken from the press position of the last press in the frame. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Translate palette refusal messages and track canvas click ownership per release Mark the five preview refusal texts for translation and add the palette status texts to the other catalogs. Give each primary release in a frame the owner of its own press, and place a release at its own position when the cursor has moved onto a menu or a new press has begun. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Treat navigation controls as release owners in batched canvas clicks Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Track INSERT ownership and refuse palette edits during a foreign INSERT The palette now cancels only the INSERT it started (identified by a per-run serial), advertises REpeat/NoRepeat at every numeric and point prompt, and refuses Edit, Create, Rename and Delete while an INSERT it did not start is running, so undoing that insertion cannot also undo a palette edit. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Keep clicks on command-line keywords from placing canvas points The command line now records one rectangle covering the bar and every inline keyword, and the canvas treats a press, release or ordinary click there as the command line's, so a keyword pushed past the bar by a long prompt cannot also send a point. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Decide whether the ViewCube is shown from the current space, not the display list The display list is rebuilt after a frame's clicks are handled, so right after a layout switch it was stale or cleared. A click where the ViewCube had just disappeared was dropped, and a click on one that had just appeared reached the drawing as a point. Painting and hit-testing now share viewcube_shown, which follows the layout space. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Treat only a refused charge as hatch budget exhaustion Spending the hatch budget exactly left zero remaining, which hatch::draw and the preview builder read as exhaustion, so a valid preview could lose its hatches or be refused. HatchBudget now records a refused reservation separately and both checks use it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Keep CLOSEALL's confirmation, widen the command-line click area, persist the Blocks window choice Only {json} calls and INSERT with inline arguments bypass the UI router, so CLOSEALL Y still asks before discarding drawings. The command line's click rectangle now includes the history lines or window, the resize grip and the AutoComplete rows. The floating-window preference of the Blocks palette is saved and restored with the other preferences. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Update Z and axis presets with a comma scale; grey the palette's Y scale when exploding A comma-separated scale preset now sets Z to the size of X and the axis presets to X, Y and that Z, so an earlier Scale cannot leave a stale Z. The Blocks palette disables its Y scale while Explode is on, with a tooltip saying the exploded insertion scales both axes by X. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Fix doc comments on the BLOCK and ATTDEF input methods and the INSERT tests BlockM::input and AttdefM::input named the INSERT state machine; the NoRepeat description sat on the comma-scale test instead of the repeat test, and the two newer INSERT tests had none of their own. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Reset the Verify counter between repeated INSERT placements Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Blocks palette: previews, block libraries and placement Rewrite this PR on a smaller base. The Blocks window becomes a dockable palette with a Current Drawing tab and a Libraries tab, icon and list views, a kept list of block libraries (folders and DWG/DXF files) and one-click placement through the existing interactive INSERT. - Previews are built only for the visible tiles, a few per frame, under a time and point budget, in a bounded least-recently-used cache. - BLOCKLIBRARY, BLOCKLIBIMPORT and BLOCKLIBRARIES are commands; importing a library block brings only the layers, linetypes, styles and blocks it needs. - INSERT: Enter at the insertion point ends the command, as in AutoCAD. - Hostile library files and block data are bounded; nothing panics. - The canvas, ViewCube, command-line and interactive INSERT changes of the earlier version are gone. - Translations in all interface languages. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Blocks palette: read libraries off the UI thread, bound preview work CodeRabbit's reviews of |
||
|
|
19495fcfa7 |
Merge remote-tracking branch 'upstream/main' into cursor/automation-roots-merge-3983
# Conflicts: # crates/engine/src/cmd/audit.rs # crates/engine/src/cmd/blocks/insert_file.rs # crates/engine/src/cmd/exchange.rs # crates/engine/src/cmd/file/compare.rs # crates/engine/src/cmd/file/template.rs # crates/engine/src/cmd/layout/plotstyle.rs # crates/engine/src/cmd/table/breaks.rs # crates/engine/src/lisp/builtins/files.rs # crates/mcp/src/backend.rs |
||
|
|
0843770389 |
fix(engine): read local files for RECOVER, INSERT, IMPORT, COMPARE, NEW, DATALINK and STYLESMANAGER through the capped reader (#2687)
A path naming an endless device or a FIFO was buffered to EOF before any size check ran, so one short command could exhaust memory or block. These paths now go through capped_read::read_capped, which refuses non-regular files and enforces the byte limit while reading. |
||
|
|
1a64ca23f5 |
Document the functions the automation roots touch
CodeRabbit measures docstring coverage over the functions a PR touches, and this one was at 62%, under the repository's 80% threshold. |
||
|
|
46ee1a817d |
mcp: port the automation roots onto the clap CLI
The CLI's argument parsing moved to clap on main, so the hand-rolled parser and its McpTarget change are rebuilt as two options, a usage error naming to the modules main split out (wblock, import, export, plot, saveas, compare, template, the LISP file builtins). |
||
|
|
9a112830c5 |
fix(engine): merge another drawing's tables and blocks in linear time (#2689)
INSERT of a file, IMPORT, paste and COMPARE export each checked every incoming layer, linetype, style and block name by scanning the growing destination vector, and restarted the anonymous block name search from 1 at every collision, so a compact drawing with many distinct names made the command quadratic. The four copies of that code become one helper (cmd/merge.rs) that looks names up in a set built once per table and continues each generated prefix from the last number it allocated. Xref loading does the same for its dependent symbols, and no longer rescans the block table after a fetch that imported nothing. |
||
|
|
fa03bf2a29 |
feat(engine): INSERT of a drawing file keeps an attribute definition's field (#2619)
* feat(engine): INSERT of a drawing file keeps an attribute definition's field The attribute definitions of a drawing file read by INSERT name=file lost their extension dictionary, so the ACAD_FIELD dictionary and the FIELD objects of an attribute whose value is a field (the file name in a title block) were gone from the block. adopt() now copies that object tree to the drawing under new handles, with the FIELD class and a field list if the drawing has none. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * foreign: index the kept objects once when walking and copying a dictionary tree A file can keep many objects; a linear lookup per pointer grew with their product. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: andrewbrake <6925387+andrewbrake@users.noreply.github.com> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com> |
||
|
|
210cfc2a1d |
-WBLOCK at the command line, as AutoCAD runs it (#2594)
* -WBLOCK at the command line, as AutoCAD runs it WBLOCK had only its JSON form, so a script's -WBLOCK did nothing: the objects it should write and erase stayed in the drawing. This adds the command-line command, with AutoCAD 2024's prompts: - "Current settings: Object conversion=Delete", then the output file. A name without .dwg or .dxf gets .dwg. A DXF file asks for its decimal places first. A file that exists asks "... already exists, do you want to replace it? [Yes/No] <N>"; No ends the command. - An existing block by name, "=" (the block named as the file), "*" (the whole drawing), or Enter for objects. A name that isn't a block is answered Block "NAME" not found. and asked again. - For objects: the base point (with mOde), then the objects, which are written and erased. AutoCAD erases them whatever mOde says, and keeps Delete as the setting. Nothing selected writes nothing. Its JSON form, -wblock, erases what it writes. WBLOCK's JSON form moves into the new module unchanged, sharing the writer. The web build refuses -WBLOCK rather than erase objects it can't save. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * -WBLOCK's JSON form: nothing to write writes no file With no handles, an empty selection or only handles of objects that aren't there, the JSON form wrote an empty drawing. It now refuses with "no objects selected" before writing or erasing anything, as the command line writes nothing when nothing is selected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * -WBLOCK: only Yes replaces an existing file At "... already exists, do you want to replace it? [Yes/No] <N>", any text starting with "y" counted as Yes, so "yodel" replaced the file, and any other text ended the command. Now only the Yes keyword replaces it, No and Enter end the command, and anything else gets "Invalid option keyword." and the prompt again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WBLOCK and -WBLOCK write their file through a temporary file Replacing an existing file truncated it first, so a write that failed part way lost it. The file now goes through atomic_write::write_atomic, as SAVE, EXPORT and autosave write theirs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
15147260c1 |
INSERT from a file brings the file's multiline styles (#1639)
Inserting a DWG/DXF as a block merged its layers, linetypes and text, dimension, multileader and table styles, but not its multiline styles. A drawing that brings its wall styles in by inserting a library file (AutoLISP add-ons do this: INSERT walls.dwg, ERASE the reference, then MLINE with one of its styles) got "Cannot find multiline style". The styles now merge like the other tables: a name the drawing already has keeps the drawing's definition. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
4010b94919 |
INSERT inserts exploded (*NAME) and drawing files (fixes #340) (#341)
At the block name prompt, *NAME inserts the block's objects: after the insertion point INSERT asks one scale factor and the rotation, and no attribute values. A path (C:\parts\bolt.dxf), NAME=path or NAME= reads the drawing through the io hooks and defines a block named after the file (or NAME) from its model space, with the file's $INSBASE as the base point, adding the layers, linetypes, styles and blocks it needs and keeping this drawing's definitions. A plain path whose block already exists asks whether to redefine it; NAME=path redefines without asking. A file that can't be read is reported at the name prompt. The JSON form takes `file` (optional `name`) and "*NAME". Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |