Commit graph cad-editor/src
Author SHA1 Message Date
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
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
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
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
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
Hakan Seven
cefe861203 fix(viewport): preserve hidden-border content
Keep layout viewport content active when its boundary layer is off.

Refs #844
2026-08-26 00:50:09 +03:00
Hakan Seven
9a8f29ae45 fix(print): avoid Windows dispatch hangs
Use unique temporary PDFs and keep shell print handlers off the UI thread. Report missing PDF print associations explicitly.

Refs #855
2026-08-26 00:00:23 +03:00
Hakan Seven
2ed4a5d8f3 fix(dimension): hide definition markers
Keep direct POINT helpers out of baked dimension pictures while preserving nested arrow block geometry.

Refs #864
2026-08-25 23:51:11 +03:00
Hakan Seven
b2b84283ae fix(io): trust decoded current layer
Remove the application-side CLAYER fallback now that cadcodec resolves the header handle during document construction.

Refs #743
2026-08-25 23:21:24 +03:00
Hakan Seven
450135960c fix(ui): widen linetype dropdown menus
Refs #782
2026-08-25 23:06:10 +03:00
Hakan Seven
fd801fac1b fix(hatch): render weighted pattern strokes
Show styled boundaries only while selected.\n\nRefs #821
2026-08-25 22:44:51 +03:00
Hakan Seven
81de94fdbb fix(zoom): include inserted block extents
Use current rendered geometry instead of load-time cluster spans when fitting model extents.

Refs #853
2026-08-25 22:11:18 +03:00
Hakan Seven
968ee3fda4 fix(dimension): complete ordinate workflow 2026-08-25 21:36:04 +03:00
Hakan Seven
9ded5eb04f feat(dimension): complete diameter workflow 2026-08-25 20:57:28 +03:00
Hakan Seven
8140c39e0d feat(dimension): complete radius workflow 2026-08-25 19:26:24 +03:00
Hakan Seven
649dfae337 fix(dimension): complete angular workflow 2026-08-25 18:55:25 +03:00
Hakan Seven
47612fd662 fix(plot): correct style mode behavior (#874) 2026-08-25 18:08:52 +03:00
ramox81
e34b67c709 fix(dimension): complete ordinate workflow 2026-08-25 17:10:55 +03:00
ramox81
75f042607e Align diameter properties and graphics 2026-08-25 15:39:48 +03:00
ramox81
0ba33a55ff Add associative diameter dimension workflow 2026-08-25 15:39:44 +03:00
ramox81
656501e91d Remove extra radius primary unit properties 2026-08-25 14:28:00 +03:00
ramox81
f7d8522520 Restore radius extension line properties 2026-08-25 14:14:46 +03:00
ramox81
205893c784 Align radius dimension properties and graphics 2026-08-25 13:56:35 +03:00
ramox81
d33c52a0b8 Add associative radius dimension workflow 2026-08-25 13:56:34 +03:00
Hakan Seven
97ec3ed67e fix(dimension): complete aligned workflow
Preserve association modes, source geometry, and sub-unit formatting.
2026-08-25 13:18:09 +03:00
ramox81
6bbef80a26 Complete angular dimension layout and fitting 2026-08-25 12:23:29 +03:00
ramox81
24b344b2b2 Complete angular dimension interaction and associations 2026-08-25 12:23:21 +03:00
ramox81
04d824974d Align angular dimension properties and rendering 2026-08-25 11:29:39 +03:00
ramox81
e93815d0c5 Complete angular dimension creation and associations 2026-08-25 11:29:38 +03:00
ramox81
5de38e1124 Correct plot style mode handling 2026-08-25 10:37:56 +03:00
ramox81
a4d913d772 Correct sub-unit scale application 2026-08-25 10:13:35 +03:00
ramox81
a4ee749251 Enable tolerance property controls 2026-08-25 10:13:35 +03:00
ramox81
9b79abc9a3 Align dimension property behavior 2026-08-25 09:52:35 +03:00