Commit Graph
3043 Commits
Author SHA1 Message Date
Hakan Seven 996412c405 Merge pull request #1359 from HakanSeven12/plot/b4-windows-printer-media
feat(plot): Windows printer media and printable areas

# 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/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/locale_catalog.rs
2026-09-19 23:00:18 +03:00
Hakan Seven 377f551b48 Merge pull request #1358 from HakanSeven12/plot/b4-windows-printer-routing
fix(print): send Windows plots to the chosen printer, name the default, report failures

# 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/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/locale_catalog.rs
2026-09-19 23:00:18 +03:00
Hakan Seven 1c0ef9d7a0 Merge pull request #1353 from HakanSeven12/ui/options-ok-apply-close
feat(options): OK / Apply / Close with a discard guard

# Conflicts:
#	src/app/view/modal.rs
#	src/ui/window/options.rs
2026-09-19 22:59:56 +03:00
Hakan Seven b1080e02ca Merge pull request #1344 from HakanSeven12/plot/b3-psetupin
feat(plot): PSETUPIN, page-setup import and page setup for new layouts
2026-09-19 22:59:36 +03:00
Hakan Seven 879bb70c12 Merge pull request #1343 from HakanSeven12/plot/b2-dialog-options-sysvars
feat(plot): page-setup units, custom scale, dialog options and plot sysvars
2026-09-19 22:59:36 +03:00
Hakan Seven 10827283ee Merge pull request #1339 from mechpanos/snap/line-endpoint-lookup
fix(snap): keep the key-vertex lookup linear and pin the vertex layouts
2026-09-19 22:59:36 +03:00
Hakan SevenandClaude Fable 5.1 5ba72ec3e4 chore: pick up cadcodec #47 and cadkernel #66; guard the re-align length
- acadrust 7ea4247: clamped-knot degree and MINSERT reservation fixes
  (cadcodec #47). cadkernel a0b962a: dogleg fails on a non-finite
  Jacobian (cadkernel #66) and pins the same codec rev, so one acadrust
  stays in the graph.
- The axis re-alignment from #1361 retains its transformed length through
  retain_segment_length, which holds a zero-length segment with per-axis
  differences instead of a P2PDistance whose gradient is NaN there.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-18 22:16:06 +03:00
Hakan Seven edc45caa14 Merge pull request #1363 from ramox81/codex/capture-minimized-guard
Refuse an automation capture while the window is minimized
2026-09-18 22:12:21 +03:00
Hakan Seven f137ce96f1 Merge pull request #1362 from ramox81/codex/axis-point-reprompt
Report a missed first 2Points pick at once for Horizontal/Vertical
2026-09-18 22:12:21 +03:00
ramox81andClaude Fable 5.1 02a75ead50 Refuse an automation capture while the window is minimized
A minimized window has a 0x0 surface; the renderer's screenshot path
panicked on the empty read-back buffer and took the whole application
down. The capture op now checks the window size first and answers with
an error instead of requesting the screenshot.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-18 20:36:08 +03:00
ramox81andClaude Fable 5.1 cda0627804 Report a missed first 2Points pick at once for Horizontal/Vertical
The first empty-space click of the 2Points flow was only resolved against
the document together with the second one, so "No valid constraint point
found." appeared one pick late. The command now hands the first pick to
the host (`CmdResult::CheckHorizontalPoint`), which resolves it right away:
a miss reports and re-asks for the first point, a hit moves on to the
second point.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-18 20:36:01 +03:00
ramox81andClaude Fable 5.1 b45e8bce1f Keep the transformed length when an axis-constrained entity re-aligns
The temporary end-point pin of a transformed Horizontal/Vertical entity is
paired with the length the transform left it, so a scaled vertical line
stays scaled while a rotated one stays vertical at its rotated length.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-18 19:18:13 +03:00
ramox81andClaude Fable 5.1 5ac6dc279b Keep only the end point of a transformed axis-constrained entity pinned
10) A transformed entity with a Horizontal or Vertical relation keeps only
    its end point where the transform put it; the rest re-aligns to the
    axis at the retained length, so a rotated vertical line stays vertical
    below its moved end instead of the whole-entity pin contradicting the
    axis and leaving the constraint unmet.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-18 19:18:13 +03:00
ramox81andClaude Fable 5.1 e572625de3 Refuse an edit the constraints can only satisfy by collapsing the entity
9) When an edit contradicts a fixed point together with another constraint
   so that the only solution collapses the entity (a rotated line with a
   fixed start and a Vertical relation), the entity returns to its pre-edit
   shape instead of degenerating, as the reference does.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-18 19:18:13 +03:00
Hakan Seven a7ab5314f2 Merge pull request #1356 from ramox81/codex/fixed-constraint-parity
Let other constraints reconcile a partly fixed entity's free points
2026-09-18 18:59:26 +03:00
Hakan SevenandClaude Fable 5.1 2b69e6e94c fix: point cadkernel at upstream after #1352; unify duplicate-constraint message
- #1352 pinned cadkernel/cadkernel-constraints to ramox81's fork. Its one
  extra commit (cadkernel #67, SymmetricLineDirections) is now on
  HakanSeven12/cadkernel main as the same SHA, so the manifests and lock
  point back at the upstream repo at rev 0493b59.
- SYCONSTRAINT reports a repeated relation with the same message Fix and
  Vertical use, as an error instead of plain output.
- The knot-less spline test consumes the add_entity results.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-18 18:58:00 +03:00
Hakan Seven 3ba7b38934 Merge pull request #1357 from ramox81/codex/vertical-constraint-parity
Match Vertical geometric constraint behavior

# Conflicts:
#	src/app/commands/draw.rs
#	src/scene/parametric_constraints.rs
#	src/ui/overlay.rs
2026-09-18 18:54:12 +03:00
Hakan Seven 7ef4e9f336 Merge pull request #1356 from ramox81/codex/fixed-constraint-parity
Match Fix geometric constraint behavior

# Conflicts:
#	src/scene/parametric_constraints.rs
#	src/scene/parametric_solve.rs
2026-09-18 18:53:18 +03:00
Hakan Seven da02e38208 Merge pull request #1352 from ramox81/codex/symmetric-constraint-parity
Complete Symmetric constraint behavior
2026-09-18 18:52:41 +03:00
Hakan Seven 9613e6edf9 Merge pull request #1351 from helenkwok/feat/web-open-from-bytes
Web control: open a drawing from bytes
2026-09-18 18:52:37 +03:00
Hakan Seven 752894e82b Merge pull request #1350 from helenkwok/fix/set-properties-number-expected
set_properties: compare expected numbers by value
2026-09-18 18:52:37 +03:00
Hakan Seven 4905d99e51 Merge pull request #1347 from helenkwok/fix/wasm32-main-build
Fix wasm32 build: gate the font download and XREF open call sites
2026-09-18 18:52:37 +03:00
Hakan Seven ce6db72c78 Merge pull request #1346 from huaninstratech/fix/block-text-wipeout-depth
fix: keep block text above its own block's wipeouts (compose glyph depth through the scene graph)
2026-09-18 18:52:37 +03:00
Hakan Seven 3c1ad62e9b Merge pull request #1340 from CiberNin/fix/editor-crashes
Fix editor crashes from typed input, text, and degenerate geometry
2026-09-18 18:52:37 +03:00
Hakan Seven 37b24296d8 Merge pull request #1338 from ramox81/codex/properties-hyperlink-control
Fix Properties hyperlink collection editing
2026-09-18 18:52:37 +03:00
ramox81andClaude Fable 5.1 d837109076 Let other constraints reconcile a partly fixed entity's free points
8) A moved entity that a Fixed holds only in part no longer pins its free
   points as hard anchors: they stay where the edit put them unless another
   constraint on the entity (e.g. Vertical) moves them, so the fixed point
   holds and the solve no longer fails when the two disagree.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-18 18:49:48 +03:00
Hakan SevenandClaude Fable 5.1 9978713acc fix: UCS FACE/OBJECT pick from the interactive prompt; reuse ocs_axes
Follow-up to #1341:
- interactive UCS offers Face / OBject; bare UCS OBJECT starts an entity pick
- one UcsPickCommand serves both FACE and OBJECT
- ucs_from_normal calls the existing arbitrary-axis helper instead of a copy
- prompt catalogue key and en-US text follow the new option list

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-18 18:42:44 +03:00
PanosandClaude Opus 5 b8472a00b4 feat(plot): Windows printer media and printable areas
The plot dialog asks CUPS printers for their sheets and margins; on Windows
the query was a stub, so every printer showed the paper catalogue with
unverified margins. The driver is now asked the way the plot dialog expects:

- windows_media (compiled and tested everywhere): the three parallel
  DeviceCapabilities tables (ids, sizes in tenths of a millimetre, 64-WCHAR
  names) become one PrinterMedia per distinct size — a rotated or
  borderless twin folds onto its sheet, catalogue sheets keep their name,
  unknown sizes carry the driver's — with the device's margins on every
  entry and the driver's default sheet found by id or by user size.
- print_to_printer (Windows): DeviceCapabilitiesW for the tables, the
  default DEVMODE for the default sheet, one portrait printer DC for the
  unprintable margins (physical offsets and extents, per device — a
  documented approximation). The DEVMODE fetch is shared with the print
  path (with_printer_devmode).
- A direct print now asks the driver for the plot's own sheet (by id, or
  as a user-defined size), so an A3 plot prints on A3 rather than shrunk
  into the driver's default; a driver that refuses the sheet is asked for
  the orientation alone.
- The capability cache remembers printers that could not be asked, so a
  slow failing query runs once per session, not on every dialog open.
- PRINTERS <name> reports a printer's sheets, margins and default sheet.

Tests: names (NUL trim, full slot, lossy), media folding and dropping,
default by id / user size / none, DC margins, paper id lookup.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-18 18:42:03 +03:00
ramox81andClaude Fable 5.1 26e458d6f7 Match Vertical geometric constraint behavior
1) VCONSTRAINT (and the new GCVERTICAL name) uses the axis constraint flow:
   "Select an object or [2Points] <2Points>:", 2Points mode with the
   reference's re-prompts and messages, and the same object types as
   Horizontal — line, polyline segment, text, MText, ellipse axis.
2) Object mode turns the object about its first vertex; a two-point relation
   across two objects slides the second object rigidly onto the axis.
3) Re-applying an axis constraint reports that the constraint already
   exists; Vertical follows the UCS Y direction.
4) The constraint bar draws Vertical as the reference's axis mark, with the
   point marker for a two-point relation.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-18 18:19:49 +03:00
dichhead b356baa5e5 Merge branch 'HakanSeven12:main' into main 2026-09-18 16:09:59 +02:00
ramox81andClaude Fable 5.1 45f3088a89 Draw the Fix constraint bar glyph as a padlock
7) The constraint bar draws Fix as a padlock instead of the letter F: a
   white lock with a small orange point marker when one point is held, a
   red lock when a whole curve or polyline segment is held.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-18 16:55:11 +03:00
Karim Jerbi b7de6a3287 refactor(ui): centralize muted_style in style::common
Delete the byte-identical 0.68 muted_style copies across 13 window modules and import crate::ui::style::common::muted_style instead. print_all keeps its local name via muted_style as muted so call sites are untouched. Divergent alphas (0.60/0.62/0.65/0.72) and missing_fonts weak.text left alone to avoid visual changes. Net: +13 / -78, no visual change. Verified: cargo check --all-targets clean, cargo test --lib ui::style (3 passed).
2026-09-18 14:00:05 +01:00
PanosandClaude Opus 5 c36ae08fd0 fix(print): send Windows plots to the chosen printer, name the default, report failures
On Windows a plot with no printer chosen went to the PDF application's
bare "print" verb — whatever that application considered its default —
and a viewer without a "printto" verb (Edge, store readers) silently
dropped the printer the dialog had chosen. The dialog also never named the
system default, and a failed printer enumeration left only "Default" and
"PDF" with the reason written to a console nobody sees.

- The default printer is looked up by name (GetDefaultPrinterW) both for
  the dialog's "System default printer (…)" entry and before every job.
- A pure route decision (plan_print_route) resolves "Default" to that
  name and uses the PDF application only when it registered a "printto"
  verb for .pdf (AssocQueryStringW); otherwise the job goes straight to
  the spooler through the existing GDI path. The report says which:
  "Sent to printer: NAME (direct print | via the PDF application)".
- list_printers reports the system's own error; the plot dialog shows it
  under the printer row and the command line warns once. A desktop without
  CUPS is an empty list, not an error.
- PRINTERS command: default printer, listed printers (or the error) and,
  on Windows, the print route — a report to paste into an issue.
- Properties… on the Default entry opens that printer's preferences sheet.
- GDI path: the driver's dmSize is kept (its private data lives behind
  it), the print raster is no longer memoised for the session, and a
  spooled temporary PDF is removed.

Tests: route planning (named / blank / no default / printto or not), the
PRINTERS command; the two Windows-only GDI tests pass the resolved name.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-18 15:49:27 +03:00
Karim Jerbi b8a7f5edfb refactor(ui): centralize hdivider/vsep in style::form
Deduplicate the byte-identical 1px divider helpers previously copy-pasted across 6 modules. form::{hdivider, vseparator} is now canonical, with a form::vsep alias for legacy call sites. style_manager re-exports both so scale_manager and anno_object_scale imports keep working unchanged. Delete locals in style_manager, plotstyle, dimstyle, layout_manager, attribute_editor. Replace thin wrappers in window/plot with direct imports. no visual change.
2026-09-18 13:43:29 +01:00
ramox81andClaude Fable 5.1 f998b59193 Match Fix geometric constraint behavior
1) FXCONSTRAINT (and the new GCFIX name) prompts "Select point or [Object]
   <Object>:" — a pick fixes that constraint point; Enter or O asks for one
   line, polyline segment, circle, arc, ellipse or spline; misses and
   unsupported objects report the reference messages and re-prompt.
2) Point, block, text, MText, attribute and table insertion points are
   addressable constraint points.
3) Re-applying Fixed to the same point or object reports that the constraint
   already exists instead of adding a duplicate.
4) A persistent Fixed holds its pre-edit geometry through MOVE, ROTATE,
   SCALE, STRETCH, grip and Properties edits: fixed points stay, free points
   of a partly fixed entity follow the edit, and size retention skips fixed
   entities.
5) Object mode on a polyline fixes the picked segment (natively persisted)
   instead of the whole polyline; arc segments pin endpoints, center and
   radius.
6) Ribbon label "Fix" with a padlock icon.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-18 15:38:33 +03:00
PanosandClaude Opus 5 1448909b6f feat(options): OK / Apply / Close with a discard guard
The Options window used to commit every control the moment it was
touched, with no way back but re-editing. It now works like the Drafting
Settings window: changes still show at once (a theme, a cursor size or a
language is seen immediately), but nothing is committed until Apply or OK.
Close — and the window's × or Esc — puts everything back the way it was
when the window opened or Apply was last pressed, asking first when there
is something to lose.

The commit point is a snapshot of the persisted configuration plus the
drawing variables the 3D Modeling page edits (with the drawing's modified
flag), so every control the window has or gains is covered without being
registered; reverting re-applies the snapshot the way start-up does and
re-bakes text or regenerates solids when those settings moved.

The "unsaved changes" guard is now a shared modal helper used by both
windows.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-18 14:53:54 +03:00
PanosandClaude Opus 5 74936063f9 feat(plot): PSETUPIN and page-setup import, page setup for new layouts
- PSETUPIN / -PSETUPIN: with no arguments a file picker offers the chosen
  drawing's named page setups in the Plot dialog; `PSETUPIN <file>` opens
  the same chooser on that file; `PSETUPIN <file> *` or
  `PSETUPIN <file> name,name` import straight away. Same-named setups are
  replaced, the import is one undo step, and the report counts both.
- The Plot dialog's page-setup list gains "Import…": the chooser shows the
  source drawing's setups with a tick each, All, Import and Cancel, and
  selects the first imported setup afterwards. The source is read off the
  UI thread with the same reader the editor uses for its own setups
  (`scene::document_page_setups`), and handles that only meant something
  in the source drawing (plot view, visual style) are dropped on import.
- Options → General → Plotting: "Show the page setup for new layouts"
  opens the Plot / Page Setup dialog whenever a layout is created
  (persisted with the plot preferences).

Tests: the document reader, the command (all / named / unknown / missing
file / undo) against a drawing saved by the app, the chooser flow, and the
new-layout option. Nine new strings in all 21 locales.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-18 14:53:09 +03:00
PanosandClaude Opus 5 7efb04a666 feat(plot): page-setup units, custom scale, hide-paperspace, save-to-layout and the plot sysvars
Plot dialog:
- "Units" (millimetres / inches) is the page setup's own unit: the offsets
  and the custom scale are shown in it, the stored ratio converts with it
  so the plotted result and the paper space's unit stay the same
- "Custom: [paper] mm = [drawing] units" spells the picked scale in that
  unit and accepts a typed ratio, which selects the list's name for it or
  becomes a ratio entry of its own
- "Hide paperspace objects" is the page setup's plot-hidden flag; it is no
  longer derived from the "Hidden Line" shade mode
- "Save changes to layout" (paper layouts, on by default) writes the dialog
  into the layout when a plot is sent; previews never touch it
- offsets are labelled in the page-setup unit and kept in millimetres in
  the file

System variables (typeable, through SETVAR, listed by SETVAR ?):
- PLOTOFFSET, PAPERUPDATE, PLOTROTMODE, PLOTTRANSPARENCYOVERRIDE and
  BACKGROUNDPLOT live with the persisted plot preferences: the plot origin
  counts from the printable corner unless PLOTOFFSET says the paper edge;
  a printer that does not list the sheet either warns or switches to its
  default sheet; transparency can be forced on or off; BACKGROUNDPLOT bit 1
  is the dialog's background switch and bit 2 drives batch plots
- CTAB and TILEMODE read and switch the current layout

Tests cover every new control and variable; six new strings in all 21
locales; the Plot dialog grows to 940×690 for the two extra rows.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-18 14:53:01 +03:00
Karim Jerbi 2b38f798c0 Add GPU backend probe with automatic fallback for older GPUs
Older GPUs without usable DirectX 12 Feature Level 12_0 or working
Vulkan support (e.g. legacy Intel iGPUs and other old parts), and old
GLES drivers whose shader compiler rejects iced's own shaders, crash
at startup or on the first drawing viewport: StagingBelt aborts in
Buffer::get_mapped_range (panic=abort, silent exit) on the DX12 path,
and shader compilation fails inside iced's gradient pipeline on the
GLES path. Selecting a working backend via WGPU_BACKEND before iced
boots avoids both classes.

- Probe each candidate backend (Windows: dx12,vulkan,gl; Linux:
  vulkan,gl) in an isolated --gpu-probe child: device request,
  staging-style mapped upload, render pipeline creation (its fragment
  shader reads a private vec4 array, catching old-Mesa compile
  failures), offscreen render and readback. First fully-passing
  backend wins; explicit --backend / WGPU_BACKEND / --safe-mode
  always win, and Windows keeps preferring DX12/Vulkan (#55).
- Software adapters (WARP/llvmpipe/SwiftShader) are the last resort
  before a best-effort GL attempt: slow but alive.
- The crash sentinel names the attempted backend so only implicated
  backends are skipped next launch.
- Winning probes report adapter limits; GPUs without shader storage
  buffers get the packed compatibility renderer automatically, with
  a startup command-line notice so the switch is never silent.
2026-09-18 11:26:25 +01:00
ramox81 9aadc97c11 feat: complete symmetric constraint behavior 2026-09-18 10:27:00 +03:00
Helen Kwok 2a78ebe2c1 Web control: open a drawing from bytes
On the web build, {"op":"open","path":…} resolves the name against the
browser's recent-files cache, so a file that is not already there cannot be
opened by the control channel. Accept {"op":"open","name":…,
"data_base64":…} instead: the bytes go through the same parse, caching
and recovery path as a file chosen in the browser picker
(io::open_bytes_web, now shared with pick_and_load_web).

Native builds keep path-based open and reject data_base64 with
invalid_request.

Refs #1349
2026-09-18 16:43:29 +09:30
Helen Kwok be78ecc7d9 set_properties: compare expected numbers by value
serde_json keeps 10 and 10.0 as different Numbers, so an expected of 10
never matched a stored whole-number float, and a JavaScript client cannot
send 10.0 at all. Compare numbers by value (recursively through arrays and
objects); everything else keeps structural equality.

Fixes #1348
2026-09-18 15:46:23 +09:30
Helen Kwok 000d8a1687 Fix wasm32 build: gate the font download and XREF open call sites
crate::network and the open crate are desktop-only, but the community-font
download (font_repo.rs) and the XREF row Open action call them
unconditionally, so cargo check --target wasm32-unknown-unknown fails on
main. Gate both; on the web download_fonts returns an error, since the web
build has no network client or fonts folder.
2026-09-18 15:18:54 +09:30
huanld 3a3f0c83d7 fix(test): make the upstream plot-dialog tests pass on Windows
- app_with_fixture embedded CARGO_MANIFEST_DIR straight into an
  automation JSON string; on Windows the backslashes become invalid
  JSON escapes and the open failed. Build the payload with json!.
- driver_options_are_edited_remembered_and_sent_with_the_job exercises
  the CUPS options editor, which Windows never opens (PrinterProperties
  routes to the system dialog there); gate it to non-Windows.
2026-09-18 08:39:01 +07:00
huanld 36d5c4db79 fix(render): compose PLOTSTYLE wire-fill depth like the wire pipeline
When a display plot style maps an ACI to a fill pattern, wire fill
triangles are re-emitted as PLOTSTYLE hatches. Those took
depth_override raw — a per-block child label for block wires and 0.0
for top-level ones — while everything else in the hatch/wipeout pass
sorts at the composed depths[insert] + label * half. The fill could
land outside its host's band and get buried under its own block's
masks (same shape as the block-text bug).

Both the display and PDF paths now travel through wire_draw_depth /
the PlotWire's composed depth, and the display cache key rides the
depth generation so a DRAWORDER edit re-ranks the fills without
needing a wire rebuild.
2026-09-18 08:38:35 +07:00
huanld 454d99b1d3 fix(scene): block text keeps its draw-order slot against sibling wipes
Unselected block text (the BS33-11 Mark/SectionMark labels) was erased by
its own block's wipeout pass and only came back through the selection
xray. Two compounding causes:

- Glyph quads rendered at the bare insert level, an exact depth tie with
  every sibling fill, so the later wipeout pass won LessEqual. Wire
  batches now carry the composed child rank as depth_override (the same
  units the scene graph composes: depths[insert] + label * half), which
  the block-text upload resolves per instance. Glyph vertices stay
  neutral on purpose — baking the raw per-block label into them
  double-counts and, for a negative rank, sinks the text BELOW its own
  masks.
- The wipeout pipeline's depth bias (-8 quanta) was larger than the
  whole within-block band: once child ranks compress into the insert's
  half-band, sibling steps are ~3 quanta and a wipeout-to-text gap is
  only 9-16 quanta of the 24-bit buffer. The mask only needs to break
  exact ties, so the bias is now WIPEOUT_DEPTH_BIAS_QUANTA = 2.

block_text_draw_depth regression pins the contract: neutral vertices,
override carrying the rank, and a margin over the wipe that exceeds the
bias on a 600-entity scene.
2026-09-18 08:38:35 +07:00
dichhead bec382a99b Merge branch 'HakanSeven12:main' into main 2026-09-17 17:56:03 +02:00
Christopher OverbeckandClaude Opus 5 37059cb0d6 Repair knot-less splines on every load path
load_file, used by headless export, xrefs and block import, finalizes a
drawing without purging, so the spline degree repair never ran there and
`--export drawing.dxf out.dwg` still hit the knot underflow. Run the repair
when any load is finalized.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-17 10:33:18 -05:00
Christopher OverbeckandClaude Opus 5 1ac9309f85 Guard constraint solving and DWG export against degenerate geometry
Retaining a line's length added a P2PDistance constraint, whose gradient
divides by the current distance. For a zero-length line the solver got a NaN
Jacobian and its SVD fallback never returned, freezing the editor (e.g.
ECONSTRAINT on a line drawn by clicking one point twice). Hold coincident
endpoints together with per-axis differences instead.

Control-point splines read without knots are given a degree their control
points can carry (at most n - 1) and a clamped knot vector when a drawing
loads. Generating knots for fewer points than the degree underflowed during
DWG write: a panic in debug builds, an unbounded allocation in release, and
reachable from autosave. A lone control point with no knots or fit points is
purged as corrupt.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-17 10:33:18 -05:00
Christopher OverbeckandClaude Opus 5 a3d65e2fc8 Bound typed counts and values that could crash the editor
- ARRAYRECT, ARRAYPOLAR, ARRAYPATH, ARRAY3D and COPY Array reject item
  counts above 100,000 (checked as a product of every dimension) and keep
  the prompt open. Unbounded counts allocated one transform per item and
  aborted on allocation failure. Stored defaults are clamped as well.
- EXPLODE leaves a MINSERT above the same limit intact instead of
  materializing every cell.
- Typed lengths and angles reject non-finite values and magnitudes above
  1e15; SCALE rejects a non-finite factor.
- Zero-radius FILLET compares candidate intersections with total_cmp and
  rejects non-finite results; partial_cmp().unwrap() panicked on NaN.
- SOLID falls back to a minimal kernel tolerance when its corners' extent
  overflows, since Tolerance::new panics on infinity.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-17 10:33:18 -05:00