Commit Graph
4990 Commits
Author SHA1 Message Date
Afonsop 12fd04790f web: autosave snapshots with crash-recovery restore, persistent storage
The web build had no autosave: on_autosave was a no-op and the
subscription was native-only. Both gates are gone; every savetime tick
now serializes each dirty tab (same pre-serialize sync as the web save
path, no thumbnail, serialized serially off the critical paint path)
into a dedicated opencadstudio-autosave OPFS directory, keyed by
drawing name, without touching the dirty flag, downloads, or recents.

On boot the web app scans that directory and offers any snapshot
newer than the last saved copy in a localized Recover Drawing modal
(Restore opens it as "name (recovered).dwg" through the standard
open pipeline; Discard removes it; Escape discards). Saving or
closing a drawing clears its snapshot; the boot scan also garbage-
collects stale entries. run_web now requests navigator.storage.persist
so settings and OPFS data survive browser eviction.

(cherry picked from commit 101d167ebc)
2026-10-12 12:02:04 +03:00
Afonsop 6cb8c00fa0 web: enable STL/STEP export and OBJ import, drag-and-drop open
STLOUT/STEPOUT wrote via std::fs and IMPORTOBJ read via std::fs, all
of which fail on wasm32. The export pickers now mirror the PDF path
(pick_*_owned returns a name-only PathBuf; the browser download names
the file) and the write tail swaps fs::write for sys::download_bytes.
OBJ import reads the picked file's bytes directly, like the web open
picker.

Opening by drag-and-drop was dead on the web build: winit never emits
FileDropped there. A wasm-gated io::web_drop module installs DOM
dragover/drop listeners, filters .dwg/.dxf, reads the File bytes
async, and queues them; the existing 50 ms PollWebControl tick drains
the queue into the same open path the picker uses (progress overlay,
recovery, OPFS recent cache).

Also floors the model-space plot sheet: extents smaller than 10 mm
(or the 0x0 paper a fresh unsaved drawing carries) now fall back to
the standard sheet instead of producing a ~3 pt page.

(cherry picked from commit ad60be11ed)
2026-10-12 12:02:04 +03:00
Afonsop 112060e370 web: harden plot preview after adversarial review
Three reviewers (security, correctness, performance) converged on:

- Download PDF died on the second click: Closure::once_into_js throws
  when invoked twice. The handler is now a plain FnMut kept for the
  overlay's lifetime.
- Rasterisation was bounded by page count, not pixels: 12 A0 sheets at
  150 DPI peaked near 1.8 GB of RGBA plus ~1.7 GB of decoded images,
  and a drawing declaring absurd paper sizes made the rasteriser
  saturate its u16 dimensions into a ~17 GB allocation that aborts the
  tab. Preview now computes a uniform DPI under a 64-Mpx total budget
  (floor 24 DPI) from the page tree before allocating, with a per-page
  4096-px edge clamp.
- Overlays stacked when previewing twice and their blob URLs were only
  revoked via Close. The overlay is now single-instance (id-tagged);
  a replacement or Close revokes every URL through a shared registry.
- emit_image resampled before probing the XObject cache, so a title
  block placed on 12 layouts ran 12 Lanczos passes to embed once.
  The cache is now probed with the target dimensions first.
- Preview downloads are named {stem}_preview.pdf instead of a constant
  plot_preview.pdf, and the page label says 'first N of M' when the
  preview is capped while the PDF keeps every page.

(cherry picked from commit 2a05479d69)
2026-10-12 12:02:04 +03:00
Afonsop 8cce362009 web: warn when an opened drawing's name collides with an open tab
Web builds identify drawings by bare file name (the browser picker
exposes no real path), so two tabs with the same name also share the
single browser-stored copy: the last save silently replaces the other
tab's. Warn on open instead of letting that surface later.

(cherry picked from commit 6306359390)
2026-10-12 12:02:04 +03:00
Afonsop 4d1f9d5960 web: render plot preview in-page instead of a new tab
A plot preview should show the plotted result on screen instead of
producing a file. The web build now does: the plotted PDF bytes
are rasterised with the hayro pipeline already used for PDF underlays
(150 DPI, first 12 pages) and shown in an in-page overlay with
Download-PDF and Close actions.

The previous strategy opened a new tab via window.open from the async
plot task; browsers withhold popups without a live user gesture, and
embedded hosts ship no PDF viewer plugin at all — so the fallback
download fired and preview behaved like an export. Plain PNG <img>
elements need neither permission.

(cherry picked from commit 8722d84910)
2026-10-12 12:02:04 +03:00
Afonsop c8386c6d3a build: make the Trunk web-worker hook work on Windows
Trunk passes TRUNK_STAGING_DIR as an extended-length path (\?\C:\...)
on Windows, which MSYS sh tools cannot stat, so post_build failed and
the whole web build aborted. Strip the prefix with sed before use;
Linux CI paths are unaffected.

(cherry picked from commit e3c86eca29)
2026-10-12 12:02:04 +03:00
Afonsop 38f0e2b25f app: wire web export, preview, and print flows through the plot UI
- plot dialog: the web build defaults to 'Save to PDF file...' (its only
  output choice); native dropdowns and defaults are untouched.
- on_plot_dlg_commit forces to_file on wasm so a stale page setup can no
  longer route the web build into the (unreachable) printer path; both
  preview branches now go through preview_page_pdf, which is identical to
  the old inline temp-PDF + OS-viewer flow on desktop.
- Print ribbon / PRINTALL on wasm render the PDF and open it in a tab
  instead of erroring; PrintAllPdf picks a virtual path and downloads.
- pdf_plot_options maps the dialog's Quality dropdown into PdfPlotOptions.

(cherry picked from commit 892d693d2d)
2026-10-12 12:02:04 +03:00
Afonsop 978000d37c io: enable the PDF pipeline on wasm32 and add plot quality presets
- pdf_export: drop the stale wasm32 gates (printpdf 0.9.1 compiles for
  wasm; the memchr/lopdf incompatibility is gone with memchr 2.8.3).
  Rendering is portable via render_pdf_bytes; only persistence differs:
  atomic temp-file write on desktop, browser download on the web.
  pick_pdf_path_owned on wasm returns a virtual path so the existing
  message flow works unchanged.
- printpdf moves from the native-only dependency table to the shared one.
- print_to_printer: preview_page_pdf / preview_pages_pdf render the same
  bytes and open them in a browser tab on the web (the browser's print
  dialog takes over); desktop keeps the temp-PDF + OS-viewer flow.
- sys: open_bytes_in_new_tab (blob URL, popup-blocked falls back to a
  download).
- New PlotQuality preset caps embedded raster resolution (High = native,
  Normal = 300 DPI, Low = 150 DPI effective); vector output is untouched.
  The image resource cache keys on the post-resample dims so one pixels
  Arc placed at different effective DPIs embeds per-placement XObjects.

(cherry picked from commit 4812bc775d)

Ported onto main (#1717 review): the plot model lives in io::plot; Normal
keeps native pixels like High (only Low caps images at 150 DPI, so desktop
output is unchanged); the searchable TrueType text layer and its allsorts
subsetting now build on the web too; the plot stamp reads the time through
js_sys on wasm.
2026-10-12 12:02:04 +03:00
ramox81andClaude Opus 5.5 bd4029fb50 Blend gradient backgrounds linearly; two colours over twice the view
Measured against the reference: a two-colour gradient reaches its end
colours a viewport beyond the edges, and the bands blend linearly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 11:51:39 +03:00
Karim Jerbi 7b68d274ad feat(mcp): add batch summaries with read-only detail retrieval
Add opt-in response_detail=summary with step and change counts, compact state, warnings, and actionable errors or prompts. Return an ocs_read batch_result request for full cached details without resuming mutations.

Keep compact/full behavior and idempotent batch retries intact. Preserve active-step context and report unavailable cached results explicitly. Document cache scope and retention; update schemas and digest.

Validation: 47 MCP unit tests, live stdio smoke test, rustfmt, and diff checks passed.
2026-10-12 09:39:54 +01:00
ramox81andClaude Opus 5.5 46daf03bc9 Draw gradient backgrounds as the reference does
The rotation is stored in degrees and turns the bottom-to-top direction
counter-clockwise, measured in pixels; a two-colour gradient blends from
the bottom colour to the top one across the whole viewport.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 11:37:53 +03:00
ramox81andClaude Opus 5.5 8055fa710d Restore a view's visual style; no background in 2D wireframe
Restoring a named view gives the model viewport the view's visual style
(the closest render mode), and a 2D wireframe viewport shows no
background, as in the reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 11:24:07 +03:00
Karim Jerbi f4b33d5cde perf(mcp): deduplicate operation schemas with shared definitions
Share operation definitions between individual requests and batch steps, reducing the execute request schema by 39%. Place definitions at the tool input schema root so local references resolve correctly.

Update the schema digest and smoke assertions. Verified with 45 MCP tests, the live stdio smoke test, and 228 schema validation comparisons.
2026-10-12 09:05:38 +01:00
ramox81andClaude Opus 5.5 c8167c54ee -VIEW sEttings Background dialog and view backgrounds
Color, Gradient and Image at the background prompt open a Background
dialog (None / Solid / Gradient / Image, preview, solid colour, two- or
three-colour gradient with rotation, image file with position and
scale). Apply links the view to a new background object in
ACAD_BACKGROUND; restoring a view gives the model viewport a copy of
it (or none), and saving a view copies the viewport's background.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 10:50:00 +03:00
ramox81andClaude Opus 5.5 f4a0b1d68b Apply an EXTRUDE taper only when it is chosen
A taper angle given in one EXTRUDE was applied to every later
extrusion. As in the reference, a new extrusion has no taper; the last
angle stays the Taper angle prompt's default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 09:53:07 +03:00
ramox81andClaude Opus 5.5 c0929b4774 Clear the selection after REGION
The command left its sources selected when DELOBJ keeps them, so the
next command took them as its preselection; the reference clears the
selection after REGION.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 09:27:16 +03:00
Karim Jerbi 2b50b6c858 fix(blocks): one block definition service for delete, rename and purge on every path
new src/scene/block_service.rs (references, delete, rename, purge candidates, name validation, one error type and message). The command-line RENAME, palette Remove, plugin API, control/MCP block_delete and PURGE all use it. Layout, xref, dynamic-block, anonymous and open-in-editor records are protected; PURGE removes an anonymous block only when nothing references it. PROTOCOL CHANGE: control/MCP block_delete refuses a referenced block unless force=true (erases referencing INSERTs in one undo step). New REST route DELETE /api/v1/blocks/{name}?force=true. MCP tool digest re-pinned. Undo labels are Delete block X, Rename block X to Y and Purge.
2026-10-12 07:25:11 +01:00
Karim Jerbi 5dfa41c032 fix(blocks): one base point convention for creation, redefine, insert, explode, XCLIP and REFEDIT
world = insert_point + Rot * Scale * (P - base_point). Attribute placement, EXPLODE, XCLIP storage, REFEDIT's working copy, the UCS reframe of attributes and the dynamic-block visibility grip ignored the base point and were offset by Rot*Scale*base. They now share insert_transform_with_base. Creation stores a ZERO base and redefine resets it; a no-op redefine moves nothing; the Block Definition dialog prefills the base from the definition. XCLIP filters stored by older builds keep their old displacement.
2026-10-12 04:35:19 +01:00
Karim Jerbi a456367b26 fix(save): baked dimension blocks and block clones must not share extension dictionaries
bake_dimension_blocks copied the dimension's whole EntityCommon, including its extension dictionary handle, into every baked child, so many entities claimed one dictionary and file validation reported an error per entity. Baked children now get no extension dictionary. The same defect is fixed in define_transformed_block and the cross-document paste clone. Each has a test.
2026-10-12 04:35:19 +01:00
Hakan SevenandClaude Opus 5.5 cd07141cde fix(fonts): keep missing font names clear of the list's scrollbar
The missing-fonts list is as wide as its longest name, so its scrollbar
was drawn over the end of every name ("ROMANT.sh").

Fixes #1715

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 01:17:20 +03:00
Hakan SevenandClaude Opus 5.5 551d4c1c60 fix(grips): arcs, circles and solids with a flipped normal show grips in place
Their grip code already works in world space, and the dispatch layer
converted the grips through the OCS a second time, so for a normal of
(0,0,-1) the grips (and grip edits) were mirrored across the Y axis.

Fixes #1683

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 01:13:12 +03:00
Hakan SevenandClaude Opus 5.5 15c566c286 fix(render): thickened polylines without width keep their colour
A polyline with a thickness but no width is drawn as its extrusion edges
alone, and those edges were forced black (the outline colour meant for the
filled tube of a wide polyline). On a dark background the polyline looked
black and changing its colour did nothing. Only a wide polyline's tube
edges are black now.

Fixes #1682

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 01:13:12 +03:00
Hakan SevenandClaude Opus 5.5 1973605cb0 test(dock): drive the real view on a large stack, one at a time
The two dock tests that build and drive the real view overflowed a
default test thread's stack, and made in parallel their headless
renderers crashed the test process about one run in three.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 00:49:27 +03:00
Hakan Seven 1333efcad2 Merge pull request #1549 from MarcelP102/codex/graphic-attributes-cleanup
[UX] Introducing graphic attributes panel

# Conflicts:
#	locales/ar-SA/opencadstudio.ftl
#	locales/bg-BG/opencadstudio.ftl
#	locales/cs-CZ/opencadstudio.ftl
#	locales/de-DE/opencadstudio.ftl
#	locales/el-GR/opencadstudio.ftl
#	locales/en-US/opencadstudio.ftl
#	locales/es-ES/opencadstudio.ftl
#	locales/fi-FI/opencadstudio.ftl
#	locales/fr-FR/opencadstudio.ftl
#	locales/hi-IN/opencadstudio.ftl
#	locales/hu-HU/opencadstudio.ftl
#	locales/it-IT/opencadstudio.ftl
#	locales/ja-JP/opencadstudio.ftl
#	locales/ko-KR/opencadstudio.ftl
#	locales/lo-LA/opencadstudio.ftl
#	locales/nl-NL/opencadstudio.ftl
#	locales/pl-PL/opencadstudio.ftl
#	locales/pt-BR/opencadstudio.ftl
#	locales/ru-RU/opencadstudio.ftl
#	locales/tr-TR/opencadstudio.ftl
#	locales/zh-CN/opencadstudio.ftl
#	locales/zh-TW/opencadstudio.ftl
#	src/app/mod.rs
#	src/app/update/dialog.rs
#	src/app/view/mod.rs
#	src/locale_catalog.rs
#	src/ui/dock.rs
2026-10-12 00:49:27 +03:00
Hakan Seven 7ca457a6cc Merge pull request #1702 from MarcelP102/Pallet-placement
[UX] Pallets you can dock, group and float (including LAYERS panel)
2026-10-12 00:27:53 +03:00
Hakan SevenandClaude Opus 5.5 7a942222c9 docs(plugin): describe XRecord storage without a vendor name
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 00:23:46 +03:00
Hakan Seven e917c23b46 Merge pull request #1716 from schoeller/xrecord_crud
Xrecord crud
2026-10-12 00:21:14 +03:00
Hakan Seven f618d695e2 Merge pull request #1684 from turbuczn/hungarian-translation-only
Improve existing Hungarian CAD translations

# Conflicts:
#	locales/hu-HU/opencadstudio.ftl
2026-10-12 00:21:07 +03:00
Hakan SevenandClaude Opus 5.5 64e9b612cb fix(plot): EXPORTPDF proposes PDF after EXPORTSVG; SVG strings in every locale
EXPORTSVG left the plot dialog's SVG device on, so a later EXPORTPDF still
offered a .svg file. The SVG save dialog and plot button texts had no
catalog entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 00:20:20 +03:00
Hakan Seven fb474eb77c Merge pull request #1701 from hvfrancesco/main
added SVG export feature

# Conflicts:
#	src/io/mod.rs
#	src/io/pdf_export.rs
2026-10-12 00:17:35 +03:00
Hakan Seven 5bb0efd93e Merge pull request #1679 from ramox81/codex/surface-associativity-sources
Associative extruded, revolved and lofted surfaces; spline and ellipse sources

# Conflicts:
#	src/app/command_driver/solid3d.rs
#	src/scene/dwg_native_constraints.rs
#	src/scene/model/mod.rs
#	src/scene/model/sweep_command_model.rs
#	src/scene/model/sweep_model.rs
#	src/scene/modify.rs
2026-10-12 00:14:34 +03:00
Hakan SevenandClaude Opus 5.5 a542a401d9 fix(view): -VIEW settings open no undo step for a view that is gone
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 00:12:51 +03:00
Hakan Seven e5df2fd113 Merge pull request #1667 from ramox81/codex/view-presets
-VIEW command-line form: presets with orthographic UCS, sEttings and Window

# Conflicts:
#	src/app/commands/mod.rs
#	src/io/mod.rs
2026-10-12 00:10:22 +03:00
Claude 3d7db54c23 Show ° and % inside the Select Color number boxes
Draw the unit as the NumberInput icon on the right of the digits
instead of a separate label beside the box. The unit is not part of the
value, so users still only type the number.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
2026-10-11 20:55:38 +00:00
Hakan Seven df1f9bd0e7 Merge pull request #1680 from ramox81/codex/block-wire-buffer-packing
Block wires: pack definitions into shared buffers

# Conflicts:
#	src/scene/pipeline/mod.rs
#	src/scene/pipeline/wire_gpu.rs
2026-10-11 23:50:38 +03:00
Hakan SevenandClaude Opus 5.5 f4001b88e2 fix(automation): selection events are native-only like their caller
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-11 23:48:40 +03:00
Hakan Seven 3cc3ead3a6 Merge pull request #1714 from yztink/fix/arc-tangent-line
fix(draw): support line tangency in arc construction and resolve trim contact precision
2026-10-11 23:42:48 +03:00
Hakan SevenandClaude Opus 5.5 23b21b5d77 fix(snap): typed overrides yield to the prompt's options; one point-step gate
#1707 took any snap name typed at a point prompt as an override, so a
prompt offering Center, Tangent, Parallel or None (ARC, ELLIPSE, CIRCLE
TTR, ...) could no longer be answered with that option's name. An option
the prompt offers now wins. The point-step test it copied from MTP is one
helper shared by MTP and the override on both input paths.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-11 23:41:55 +03:00
Hakan Seven 45bc31f730 Merge pull request #1707 from yztink/feat/snap-overrides
feat(snap): add transparent object snap overrides in active commands typed on command-line

# Conflicts:
#	src/app/update/command.rs
2026-10-11 23:39:07 +03:00
Hakan SevenandClaude Opus 5.5 7e0866e647 fix(input): fire a rebound SPACE only from the command line
#1713 dispatched a captured SPACE as a shortcut whenever it was rebound,
so with SPACE on FINALIZE a space typed into any other text field (layer
names, Properties, find) also ran FINALIZE, and the space it typed stayed
in the command line. Ask whether the command input has focus before
running the binding, and drop the space the field already inserted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-11 23:38:06 +03:00
Hakan Seven c56cdd6a26 Merge pull request #1713 from theluckystrike/fix/1710-space-finalize-focus
fix(input): let a rebound SPACE fire while the command line has focus
2026-10-11 23:35:37 +03:00
Claude 43f88732ea Fix Select Color panel layout found in screenshots
- Give the panel body room for the gray row and info line.
- Keep NumberInput digits clear of its arrows and draw the arrows
  as plain icons in the text colour.
- Split the Current / New swatch with a thin divider.
- Load the iced_aw icon font in the headless snapshot test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
2026-10-11 20:35:12 +00:00
Hakan SevenandClaude Opus 5.5 b9ef8c50ed fix(fillet): keep no-trim for every pair and the Trim prompt; share TRIMMODE with CHAMFER
#1692 limited no-trim FILLET to two lines and refused arcs and polyline
segments, which #1558 already filleted without trimming (only the arc is
added). It also turned T/N at the object prompts into silent toggles, so
the Trim option no longer reached its Trim/No trim prompt and the choice
was not saved. Keep the arc bookkeeping it added (the new arc can be
picked next, and stays on the picked layer), restore every pair and the
Trim prompt.

CHAMFER's new no-trim mode starts from and saves the same TRIMMODE value
as FILLET instead of always starting trimmed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-11 23:34:09 +03:00
Hakan Seven 6f2d43820f Merge pull request #1693 from YsDirector/pr/chamfer-no-trim
Add no-trim CHAMFER mode

# Conflicts:
#	src/modules/draw/modify/fillet.rs
2026-10-11 23:31:34 +03:00
Hakan Seven 3f871361f3 Merge pull request #1692 from YsDirector/pr/d7-fillet
Add no-trim FILLET mode

# Conflicts:
#	src/modules/draw/modify/fillet.rs
2026-10-11 23:31:23 +03:00
Hakan Seven 7b8397fe6b Merge pull request #1696 from YsDirector/pr/c11-next-frame
Capture after the next rendered frame

# Conflicts:
#	src/app/control/mod.rs
2026-10-11 23:30:20 +03:00
Claude 00830f8714 Redesign Select Color panel: index and true color tabs
Replace the old index page and the iced_aw ColorPicker popup with one
Select Color panel:

- Index Color tab: standard colors, ACI 10-249 grid, grays; arrow keys
  move through the palette.
- True Color tab: HSB, RGB and gradient-field modes built on two new
  widgets (GradientSlider, ColorArea) and iced_aw NumberInput boxes,
  an editable hex field and a nearest/exact index color button.
- Current/New swatch: clicking Current reverts. A mixed selection opens
  on the color of the most recently drawn object with *VARIES* on top.
- Color field accepts an index, a color name, r,g,b or hex.
- Enter confirms, Esc cancels, other keys stay in the panel.
- New labels translated in all 22 locales.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
2026-10-11 20:29:46 +00:00
Hakan Seven 2e79430930 Merge pull request #1691 from YsDirector/pr/d6-save-verified-fingerprint
Refresh fingerprints after verified saves

# Conflicts:
#	src/app/automation.rs
2026-10-11 23:29:27 +03:00
Hakan SevenandClaude Opus 5.5 9039dadfd9 docs(automation): Spline and MText style in entities_create; drop stale comment
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-11 23:28:39 +03:00
Hakan Seven 207684efb0 Merge pull request #1694 from YsDirector/pr/d8-entities-validation
Validate entities_create fields and geometry strictly

# Conflicts:
#	src/app/control/entities.rs
2026-10-11 23:28:35 +03:00