Commit graph

2,470 commits

Author SHA1 Message Date
8908a20902 CMMS embedding: AI Assistant editor-buffer bridge (read/replace the open drawing)
The CMMS AI Assistant's Stage 3 editor-buffer bridge already covers the
circuit / drawio / OpenSCAD editors; this adds the DXF/DWG one.

- src/sys.rs: ai_editor_bridge module - a window 'message' listener
  (installed from boot_web only when cmms_config() is present) that parks
  a 'cmms-ai-editor-get-buffer' / 'cmms-ai-editor-apply' request in a
  thread-local. The listener can't reach app state, so:
- src/app/view/mod.rs: a 250ms CmmsAiBridgePoll subscription (embedded only)
- src/app/update/mod.rs: the poll handler - reply with the active drawing
  serialized as ASCII DXF (save_to_bytes), or replace the active tab's
  document in place with an applied buffer (reset the tab to blank so
  on_file_opened reuses the slot, then load through the standard pipeline).
- src/io/mod.rs: load_ai_buffer_web() - load_from_cmms_web minus the fetch,
  always DXF.

Additive, wasm-only, gated on window.CAD_EDITOR_CONFIG like every other
CMMS hook. Standalone use unaffected. cargo check --target wasm32 clean.
2026-09-03 12:08:50 +10:00
Stuart
c38bd6e8f5 EXTRUDE REGION: one-step extrude of outline + hole loops
The plain EXTRUDE only extrudes a single closed loop, so a plate outline with
bolt holes meant extrude-outline / extrude-each-hole / SUBTRACT-each by hand.
The kernel already has brep::extrude_region() for the multi-loop case.

- sweep_model::extruded_region(outline, holes, height) -> Option<Body>
- CmdResult::ExtrudeRegion + ExtrudeRegionCommand (pick outline, pick hole
  loops, Enter, height) + command_driver handler, modelled on EXTRUDE / LOFT
- EXTRUDEREGION command name (+ inventory registration); 'EXTRUDE REGION' also
  accepted. Prompts are literal English via the t! fallback.

Loops are taken in the outline's plane (world-XY for any flat DXF); a
non-coplanar hole makes the kernel refuse -> clean error.
2026-09-03 11:38:16 +10:00
5c42f88f23 CMMS embedding: follow the CMMS light/dark theme
CAD_EDITOR_CONFIG.dark (set by cad-edit.php from theme_is_dark()) ->
CmmsConfig.dark (src/sys.rs). boot_web() (src/app/mod.rs) overrides the
persisted active_theme/ui_theme with iced::Theme::Light or ::Oxocarbon so
the embedded editor opens to match the CMMS chrome. Standalone use keeps
its own persisted theme.
2026-08-31 11:57:42 +10:00
6b07760943 Merge remote-tracking branch 'upstream/main'
# Conflicts:
#	src/app/update/file.rs
#	src/scene/convert/solid3d_tess.rs
2026-08-27 22:57:25 +10:00
768b3ee97b Fix Export to CAM's default filename appending .stl instead of replacing the extension
tab_display_name() is the drawing's real filename including its own
extension (e.g. "Drawing1.dwg") - the CamExportDialogOpen handler
appended ".stl" directly onto that, producing "Drawing1.dwg.stl" instead
of "Drawing1.stl". Strips the existing extension via file_stem() first.
2026-08-27 19:03:43 +10:00
4a61c54826 Fix the 3D-solids save/reopen bug: body_transform() dropped SAB integer tokens
Root cause of "reopen shows nothing, Zoom Extents finds nothing" for any
solid saved to DWG and reopened: SabWriter round-trips exact transform
values (0/1 in an identity matrix - the common case for a freshly drawn
solid) as compact SAB integer tokens (tag 0x04), not doubles.
body_transform()'s value-extraction loop only tried
coordinate_components() -> as_float() -> as_string(), never as_integer(),
so it silently parsed 0 of 13 values out of a perfectly valid transform
record. tessellate_sat() then hit its own (already-instrumented) "no
resolvable transform" bailout and aborted the whole document.

Reproduced directly against a real saved/reopened file (a standalone
harness against acadrust+cadkernel, bypassing the app's own broken native
desktop build - unrelated pre-existing issues, not touched here): the
transform record's tokens were confirmed to be Sab{tag:4,...}, and adding
the as_integer() fallback resolved them to the expected identity matrix.

Fix: fall back to token.as_integer() (cast to f64) alongside as_float()
in body_transform(). Added regression coverage with a synthetic
SAB-integer-encoded transform record.
2026-08-27 17:00:04 +10:00
Hakan Seven
ba91095bcf
Merge pull request #886 from ramox81/codex/complete-jogged-radius-dimension
Complete jogged radius dimension workflow
2026-08-27 08:12:28 +03:00
Hakan Seven
bc750c6d76 fix(dimension): harden jogged radius workflow 2026-08-27 08:09:02 +03:00
5dace5449d Use log::error! instead of log::warn! for the tessellate_sat diagnostics
The web build's logger (sys.rs's BannerLogger) installs
log::set_max_level(LevelFilter::Error) - warn! records never reach it (or
even the browser console) at all, they're filtered at the macro call site.
error! also gets a free on-page banner via show_banner(), not just a
console line - the more useful behavior for a user hitting this without
DevTools open.
2026-08-27 11:46:57 +10:00
6bfdd6c31d Log which body/step fails inside tessellate_sat() instead of a silent None
Every early-out here (a bad-body abort, or zero triangles produced) used
to vanish with no trace anywhere, including upstream's own UI - the exact
reason the open '3D solids don't survive save/reopen' bug has resisted
diagnosis so far. Now logs the body index, which step failed, and (for the
zero-bodies case) how many surfaces/curves/pointers lift() couldn't
resolve, so the next real occurrence is diagnosable from the browser
console instead of another silent None. No behavior change - purely
diagnostic.
2026-08-27 11:39:36 +10:00
0d654a8a79 Skip Start-page decoration fetches (patrons/videos/discussions) when embedded in CMMS
Every one of those requests 404s from a CMMS deployment - the embedded
editor's build never carries opencadstudio.com's supporters.json /
video_thumbs/*.jpg / discussions payloads (fetched from pages.dev-style
static hosting upstream, not part of trunk build's output), and the
Start page they'd populate is never shown anyway (embedded launches go
straight into a file). Gated on the existing window.CAD_EDITOR_CONFIG
check; standalone/opencadstudio.com use is unaffected.
2026-08-27 11:33:17 +10:00
Karim Jerbi
513ab958a8 perf(grid): cache overlay geometry behind a params-keyed key
Introduce a cache for the grid overlay to prevent redundant geometry
reconstruction on every UI redraw. Extract the pure projection logic
from draw_grid into a renderer-free grid_segments function, and add
GridKey and GridCanvasState to memoize the resulting Geometry.

The cache key includes all per-pane GridParams and the overlay bounds,
preventing stale geometry when camera changes within the same canvas
size. On a params-key miss, the iced cache is cleared before redrawing
to bypass its bounds-only reuse.

Tests: 8 new unit tests cover key invalidation and state handling.
Benchmarks: uncached geometry ~32 us/frame vs cached decision ~90 ns,
a >99% reduction. Verified: 472 passed / 1 pre-existing failure / 4
ignored.

Tests:
  ui::overlay::grid_key_tests::grid_key_matches_identical_params
  ui::overlay::grid_key_tests::grid_key_invalidates_on_changed_fields
  ui::overlay::grid_key_tests::grid_key_invalidates_when_any_pane_changes
  ui::overlay::grid_key_tests::should_reuse_empty
  ui::overlay::grid_key_tests::should_reuse_equal
  ui::overlay::grid_key_tests::should_reuse_changed
  ui::overlay::grid_canvas_state_tests::default_state_has_no_cached_key
  ui::overlay::grid_canvas_state_tests::stored_key_is_recognized_by_should_reuse
2026-08-26 23:53:31 +01:00
Hakan Seven
ae2886d5fb
Merge pull request #885 from ramox81/codex/complete-arc-length-dimension
Complete arc length dimension workflow
2026-08-27 01:00:50 +03:00
Hakan Seven
6ef2d75e84 fix(dimarc): complete merge integration
Preserve source-plane geometry and associative arc parameters while combining the latest properties and tolerance workflows.
2026-08-27 01:00:23 +03:00
Hakan Seven
752e066501 fix(tolerance): merge workflow integration
Merge PR #884 with current main and pin the merged companion codec revision.
2026-08-27 00:18:39 +03:00
Hakan Seven
81e7add1dd
fix(tolerance): complete workflow integration
Sync current main and companion codec changes before preserving unsupported frame rows, rendering in the entity plane, and sharing final layout metrics with placement preview.
2026-08-27 00:14:08 +03:00
Hakan Seven
24b0fdd8e5 build(deps): update cadcodec revision 2026-08-26 23:35:01 +03:00
Hakan Seven
e4364b4f1d feat(branding): update application logo 2026-08-26 22:57:22 +03:00
Hakan Seven
5b302fbd7b
Merge pull request #883 from ramox81/codex/complete-mtext
Complete multiline text creation, editing, properties, and layout
2026-08-26 22:52:47 +03:00
Hakan Seven
522a3f0ff5 fix(mtext): harden editor and column layout
Merge current main while preserving text property behavior. Bound column allocations and correct boundary, UCS, caret, and column-flow calculations.
2026-08-26 22:51:32 +03:00
Hakan Seven
0e98c4857b
Merge pull request #882 from ramox81/codex/fix-single-line-text
Complete single-line text behavior and properties
2026-08-26 22:24:14 +03:00
Hakan Seven
0603aae286 fix(text): correct scaled text placement
Derive two-point layout and continuation spacing from the effective annotation scale. Keep style flags out of per-entity mirror overrides.
2026-08-26 22:21:40 +03:00
gianlucafiore
3a817cb379
Merge pull request #889 from gianlucafiore/feat/offset-reference-distance
Improve OFFSET distance input
2026-08-26 15:59:34 -03:00
gianlucafiore
79f045ce68 feat(offset): add reference distance input 2026-08-26 15:58:36 -03:00
Hakan Seven
f157b4a9ff
Merge pull request #881 from schoeller/v4-selection-broadcast
feat(plugin): emit SelectionChangedV4 to V4 plugins and add ocs_plugi…
2026-08-26 21:48:35 +03:00
Hakan Seven
4053f2c381 docs(plugin): fix runner connection flow 2026-08-26 21:48:02 +03:00
Hakan Seven
cfe1ad0006 perf(selection): cache plugin fingerprint 2026-08-26 21:48:02 +03:00
gianlucafiore
0c68fe1084
Merge pull request #888 from gianlucafiore/fix/align-ux
Improve ALIGN command UX
2026-08-26 15:20:06 -03:00
gianlucafiore
0754c928ce improve ALIGN command interaction and preview 2026-08-26 15:15:03 -03:00
ramox81
5a9894fd3e Complete jogged radius dimension workflow 2026-08-26 17:17:55 +03:00
ramox81
83d41b0f7d Remove handle from general properties 2026-08-26 15:56:03 +03:00
ramox81
8aca9a0aef Complete arc length dimension workflow 2026-08-26 15:32:37 +03:00
Hakan Seven
bbd58eb9f2 fix(layout): identify sheet viewports reliably 2026-08-26 14:23:08 +03:00
ramox81
66bf4b1d5f Honor fixed tolerance text styles 2026-08-26 14:19:24 +03:00
ramox81
d039bcd4f9 Expose tolerance annotation properties 2026-08-26 14:19:01 +03:00
ramox81
aa552d48e4 Align tolerance property rows 2026-08-26 14:18:43 +03:00
ramox81
de294447a9 Complete geometric tolerance workflow and properties 2026-08-26 13:54:20 +03:00
ramox81
1922492a95 Make MText defined width read-only 2026-08-26 12:06:51 +03:00
ramox81
b1df6dddd8 Use MText column persistence revision 2026-08-26 11:48:25 +03:00
ramox81
8b6724700e Render MText column masks independently 2026-08-26 11:48:24 +03:00
ramox81
af4401ce67 Complete MText editor controls and persistence 2026-08-26 11:48:23 +03:00
ramox81
96ca741f35 Align MText properties and column layout 2026-08-26 11:48:22 +03:00
ramox81
4be01774e1 Complete MText boundary creation flow 2026-08-26 11:48:21 +03:00
ramox81
0f5f47b37d fix(properties): correct text position editability 2026-08-26 10:05:07 +03:00
ramox81
c00d08d40a fix(text): honor two-point geometry and grips 2026-08-26 09:50:31 +03:00
ramox81
3e9fcaed7c fix(properties): align single-line text fields 2026-08-26 09:50:21 +03:00
ramox81
fff811577b feat(text): complete single-line creation workflow 2026-08-26 09:50:15 +03:00
Sebastian
5c125f96be docs(plugin): remove superseded ocs_plugin_api/REPORT.md
The out-of-process plugin design proposal in REPORT.md has been
implemented and evolved to API v4. The current architecture is
documented in ARCHITECTURE.md. REPORT.md is unreferenced and no
longer needed; its content remains in git history for reference.
2026-08-26 08:49:51 +02:00
Hakan Seven
8c61d89b1e fix(layout): complete paperspace integration
Apply each layout's embedded page setup and plot style consistently across display, PDF, printing, and multi-layout output.\n\nRefs #844
2026-08-26 08:58:44 +03:00
Karim Jerbi
9c8f841f71 fix(insert): capped interactive block search and CLIPROMPTLINES
INSERT enumerated all block names in a single prompt string, causing unbounded overlay growth and full-screen occlusion in drawings with many blocks. Replace prompt enumeration with a ranked, incrementally filtered suggestion model: BlockPicker maintains precomputed lower/upper caches and usage ranks (MRU/frequency), filters via O(n) substring scan and partial sorting (select_nth_unstable) to O(k), bounded to CLIPROMPTLINES.

Introduce CLIPROMPTLINES (Integer 0-50, Registry, default 3) for the number of temporary prompt lines above the command window; persist in UserSettings, expose via SETVAR and direct entry, enforce in CommandLine::view. Suggestion count is in direct relation to CLIPROMPTLINES (limit = clip, capped to 50).

Make search live without requiring Enter: add CadCommand::on_live_input, implement for INSERT/MINSERT via picker.set_needle, and wire to command-line input paths (Message::CommandInput, on_command_append_char, on_command_backspace). Updates use upper/lower caches and partial sort for <0.2ms per keystroke on 10k blocks, with debounced block-usage persistence (MRU cap 20, freq cap 200) to avoid I/O thrash. Correct tri_count test helper to use display_from_solid.
2026-08-25 23:18:05 +01:00