Commit Graph
234 Commits
Author SHA1 Message Date
Karim Jerbi 91900c4e73 bench(flatten): add FLATTEN metrics with extracted helpers
Moves the flatten projection fns and command helpers into modules/draw/modify/flatten.rs (behavior unchanged) and adds flatten_plan / flatten_scene_apply to the COMMANDS suite.
2026-09-28 20:29:39 +01:00
Hakan SevenandClaude Opus 5.5 97a5bc1d39 fix(offset): the offset just created can be hovered and offset again
A running command only knew the entities that existed when it started;
committed results are now handed back to it, and OFFSET adds them to its
pick set.

Fixes #673

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 19:35:19 +03:00
Hakan SevenandClaude Opus 5.5 746edaa32b feat(explode): MTEXT explodes into single-line TEXT at its laid-out runs
EXPLODE left MTEXT untouched. Each laid-out run becomes a TEXT at its own
baseline origin, height, rotation and width, keeping inline colours.

Fixes #760

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 19:22:41 +03:00
Hakan SevenandClaude Opus 5.5 1db1ea0140 fix(fillet): polyline re-fillet replaces the old arc, open ends close, arc segments are not filleted as chords
Fixes #1422

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 18:18:41 +03:00
Hakan SevenandClaude Opus 5.5 eac19348d5 refactor(draw): TRIM geometry helpers come from the kernel; drop a probe test
#1511 added an orthogonal ellipse projection and a nearest-end
arc_parameter to draw/modify/geom.rs, the latter shadowing the kernel
function of the same name. Both now live in opencadkernel 237827e and
are re-exported here, so every kernel caller gets them too.

test_coincident_line_and_arc_grip_move only printed values and asserted
nothing; removed.

Pins opencadkernel 237827e, opencadgraph fe36957.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:08:36 +03:00
Hakan Seven 66ac8c4ec0 Merge pull request #1511 from yztink/feat/fluid-tangent-arc
feat(draw): add fluid tangent arc, circle, and line construction and snap trim cuts to boundary contacts
2026-09-28 14:02:11 +03:00
yztink c827b87cf9 fix(trim): snap trim cut parameters to exact boundary contact points 2026-09-28 01:56:47 -07:00
ramox81andClaude Opus 5.5 7f8f8457c7 Frames: state-following ribbon list, DWF/DGN frames, image frame encoding and profile, frame-only picking
- The Frames list shows the drawing's frame state (hide / display and plot /
  display but not plot / frames vary), follows commands, undo and document
  switches, and lists the mixed state as a disabled item.
- DWFFRAME and DGNFRAME are frame variables of their own, kept in the header,
  and FRAME sets them with the others.
- Out-of-range frame values say "Requires an integer between 0 and 2." and
  ask again; a set value reports "Regenerating model.".
- IMAGEFRAME is stored in the image variables as bits (2 is written as 3) and
  a drawing without them uses the profile value, which setting IMAGEFRAME
  updates and the settings file keeps.
- Raster images, PDF underlays and wipeouts are picked on their frame only;
  underlay snap geometry is never picked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:53:53 +03:00
Karim Jerbi 801882314f perf(explode): batch erasure, section map, pre-sized vectors
EXPLODE apply 504ms -> 61ms (-88%), geometry 70.2ms -> 58.1ms (-17%) on the 2,500-compound fixture.
2026-09-28 06:58:47 +01:00
Karim Jerbi 7978d1eb2e bench: add COMMANDS suite with EXPLODE metrics
Shares the benchmark harness between both suites, extracts the plan/batch/apply helpers out of the EXPLODE command arm, and adds the command_benchmarks target.
2026-09-28 06:58:47 +01:00
Hakan SevenandClaude Opus 5.5 f537aff75c feat: node graph overlay; move to opencadcodec/opencadkernel/opencadgraph
The codec and kernel repositories and crates are renamed opencadcodec and
opencadkernel. Inside OCS they are depended on under short keys, so code
reads `codec::`, `kernel::` and the new `graph::` (opencadgraph, the node
graph engine). File-format and protocol spellings stay as they were: the
ACIS product id `acadrust`, the ACADRUST_* switches and the plugin
version keys `acadrust_version` / `acadrust_source`.

A button left of MCP on the command line opens a translucent node graph
over the viewport, with a palette of object, input, math, logic, list,
text and geometry nodes added by click or drag. An object node owns
drawing entities and its rows are the Properties panel's own rows for
them: the single-object page is extracted from refresh_properties as
entity_property_sections, values use the control protocol's
property_json, and writes go through set_property_value with a property
target override, so the panel, MCP and the graph share one read/write
path. A list reaching an object row makes one entity per element. Each
graph action is one undo step; the canvas pans and zooms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 07:34:23 +03:00
Karim Jerbi 531ba44faa chore(lints): fix compiler warnings and clippy array suggestions 2026-09-24 10:37:52 +01:00
Karim Jerbi 652f4d6bbc feat(blocks): implement Block Definition dialog (BLOCK/BMAKE) with on-screen sequencing
Implement the complete Block Definition dialog window launched via BLOCK
and BMAKE commands, featuring standard CAD layout, workflows, and entity
creation pipelines.

- Dialog UI & Layout:
  - 2-column compact CAD grid with synchronized vertical heights (580 × 390px).
  - Editable combobox with existing block names, invalid character validation,
    and inline redefinition badge.
  - Multi-line text editor widget for block descriptions (replacing single-line input).
  - Quick Select (QSELECT) button integration restoring dialog state upon completion.
  - Confirmation guard when attempting to redefine an existing block definition.
  - Centered radio buttons, clean coordinate inputs, and accessible keyboard shortcuts.

- Base Point & On-Screen Workflow:
  - BlockOnScreenCommand strictly enforces prompt sequencing: Base point is
    prompted before object selection.
  - Dynamically recalculates world_to_block and block_to_world affine transforms
    when base point is specified on-screen, preventing stale (0,0,0) normalization.
  - Supports Retain, Convert to block (INSERT placement), and Delete modes.

- Explode Enforcement:
  - Guarded EXPLODE command to prevent decomposing blocks flagged as non-explodable.

- Dynamic Themed Icons:
  - Added pick_point.svg, select_objects.svg, quick_select.svg, and warning_triangle.svg.
  - Routed all icons through the semantic theming engine so line work (#B4B6B9)
    and accents (#6DB7ED) adapt automatically to the active theme.

- Tests:
  - Added unit tests for retain/convert/delete modes, redefinition, explodable flag,
    on-screen base point transform recalculation, and command sequencing.
2026-09-22 17:05:15 +01:00
copilot-swe-agent[bot] 41101efaa5 fix(trim): skip empty preview polyline segment samples
Co-authored-by: dasmatus <330471626+dasmatus@users.noreply.github.com>
(cherry picked from commit fb13a7aaa6)
2026-09-20 21:29:15 +03:00
Claude e83c8a28a5 fix(trim): skip polyline segments with no plan-view shape
`sample_entity_xy` walks a polyline's exploded segments and drops the
vertex each segment shares with the previous one. A segment whose curve
plane is upright — any non-horizontal run of a 3D polyline — has no XY
curve, so `entity_curve_xy` declines it and the segment samples to
nothing. With nothing accumulated yet, the seam test compared the two
empty ends as equal and then sliced the empty sample from index 1:

    panicked at src/modules/draw/modify/trim.rs:3982:42:
    range start index 1 out of range for slice of length 0

On the web build that panic unwinds through winit's event-loop runner
and leaves its state borrowed, which is the "RefCell already borrowed"
follow-on in the same report.

Skip an empty sample instead, which leaves the seam handling to the
segments that do have a plan-view shape.

Fixes HakanSeven12/OpenCADStudio#1318

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TQzYZsXBwPZ5HwBaGitEUV
(cherry picked from commit ac9a6ce91a)
2026-09-20 21:29:15 +03: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) <noreply@anthropic.com>
2026-09-17 10:33:18 -05:00
Christopher OverbeckandClaude Opus 5 38aa2ee34d Avoid slicing text inside multi-byte characters
Right-to-left line reordering walked each atom's byte range and sliced the
line at every byte, panicking when a neutral multi-byte character such as a
guillemet preceded the first strong character. Walk characters instead.

FIND/FINDALL located the REPLACE keyword in a Unicode-uppercased copy and
sliced the original with that offset; uppercasing can change byte length
(dotless i, ligatures). Uppercase ASCII only, which keeps offsets aligned.
FILLET and CHAMFER inline R/D shorthands now test the original text before
slicing past the first character.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 10:33:18 -05:00
PanosandClaude Opus 5 0fbb5bcb4f ui: neutral wording in code and help text; keywords first in the command menu
Comments and the Options help text describe the behaviour of commercial
solutions without naming any product. The command menu puts the command's
keywords directly under Enter / Cancel, with Recent Input and Snap
Overrides below them, so the choices that change from step to step are the
closest to the pointer.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 12:05:15 +03:00
PanosandClaude Opus 5 d753874fe4 feat(modify): commercial solutions keyword options for MOVE, COPY, FILLET, CHAMFER, OFFSET
MOVE: Displacement, Enter at the second point uses the base as the vector.
COPY: Displacement, mOde (Single/Multiple), Undo of the last copy.
FILLET: Undo of the last fillet (the command refreshes its entity cache
through the new CadCommand::on_document_undone hook after the host undoes
the document step). CHAMFER: Multiple and Undo. OFFSET: Erase (the offset
replaces its source), Layer (Current/Source), Undo, Exit.
POLY3D, TRACE, MIRROR and MEASUREGEOM expose the keywords they already
accepted as options, so the context menu and option buttons list them.

The pinned prompt now keeps informational bracket groups such as
"[3 objects]" and only drops real option listings when the buttons take over.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 12:05:14 +03:00
Hakan Seven 65c0fe5494 fix: align dynamic angle input with drawing units 2026-09-17 09:50:41 +03:00
Hakan Seven 48a734ba9b Merge pull request #1272 from kevin9327/fix/linear-dimension-off-world-z 2026-09-15 12:29:27 +03:00
Felix RiestraandClaude Sonnet 5 0f739b459d Add bounding-box object alignment (ALIGNLEFT/TOP/etc.), ported from Mac2CAM
Six one-shot alignment commands for the current selection —
ALIGNLEFT/ALIGNHCENTER/ALIGNRIGHT/ALIGNTOP/ALIGNVCENTER/ALIGNBOTTOM —
distinct from the existing point-picking ALIGN/ALIGN3D command: each
nudges every selected object (or complete group, via new
Scene::selected_object_units) so its bounding-box edge/center lines up
with the extreme edge/center already present in the selection, closer
to a word processor's "align objects" than AutoCAD's 3-point ALIGN.

Wired as plain one-click Tool entries in the Modify extension panel,
next to the existing ALIGN entry, matching that panel's flat-list
convention (no point prompts, so no dropdown submenu needed).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-15 01:08:41 +02:00
kevin9327andClaude Opus 5 c13e86b87d fix(dimension): draw linear and aligned dimensions in their own plane off world Z
A linear or aligned dimension whose normal is not world Z was drawn and
exploded as if it lay in world XY. The builders read the offset and the
extension directions in XY only, so a dimension turned into a working plane
such as XZ lost its offset (now along Z): the dimension line fell onto the
measured points and the extension lines stuck out along world Y.

Move such a dimension into its own OCS before building it and map the result
back onto its plane, as arc length and large radial dimensions already do,
for both tessellation and EXPLODE.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 07:00:47 +09:00
gianlucafiore 5d77c2dd00 feat(fillet): allow radius from two picked points 2026-09-12 21:41:34 -03:00
gianlucafiore 7ab311d86c fix(move): keep source geometry visible during preview 2026-09-12 21:41:34 -03:00
Karim Jerbi f79bad8adf fix(trim): handle polyline arc segments and preserve curvature
- Intersect cutting boundaries against polyline arc segments via KernelArc instead of chord lines
- Project click points onto BulgeArc geometry to evaluate accurate click parameters
- Proportionally scale and preserve bulges on surviving partial arc segments via extract_sub_polyline
- Update crossing trim and hover wire preview to support polyline arc geometry
2026-09-11 14:33:49 +01:00
Hakan Seven 71a7b365ef Merge pull request #1208 from Ramox81/codex/kernel-lengthen-support-curves-20260911 2026-09-11 16:11:42 +03:00
Hakan Seven db684019d9 Merge pull request #1207 from Ramox81/codex/parity-setbylayer-settings-20260911 2026-09-11 16:09:55 +03:00
Hakan Seven f51d492994 Merge pull request #1205 from Ramox81/codex/fix-break-curve-spans-20260911 2026-09-11 16:04:53 +03:00
Hakan Seven 03445c697a Merge pull request #1204 from Ramox81/codex/parity-splinedit-fit-data-20260911 2026-09-11 16:01:27 +03:00
Hakan Seven 173552ed0e Merge pull request #1203 from Ramox81/codex/parity-pedit-jointype-20260911 2026-09-11 15:58:25 +03:00
ramox81 1e82fb9f78 Pass join settings through the shared polyline result handler 2026-09-11 15:17:42 +03:00
ramox81 65161e82db Add independent layer property settings during selection 2026-09-11 15:10:51 +03:00
ramox81 0b880ccda8 Add persisted polyline join type and selected connector geometry 2026-09-11 15:07:11 +03:00
Hakan Seven 7edf0de603 Merge updated pull request #1188 from Ramox81/pedit-enhancements 2026-09-11 14:55:26 +03:00
Hakan Seven 7d28cc5256 Merge pull request #1188 from Ramox81/pedit-enhancements 2026-09-11 14:32:32 +03:00
ramox81 5aaa0e128b Normalize circular arc break fragment angles 2026-09-11 14:24:12 +03:00
ramox81 9ae04cd30f Add fit-data purge and endpoint tangent editing 2026-09-11 14:23:10 +03:00
ramox81 9f37c0eb39 Break polylines at picked segment parameters preserving bulges and widths 2026-09-11 14:15:42 +03:00
ramox81 aa11b10c9a Extend selected polyline terminals using bounded kernel intersections 2026-09-11 14:05:50 +03:00
ramox81 6b12dfc9e7 Use curve spans for arc and ellipse breaks 2026-09-11 14:04:29 +03:00
ramox81 7d1de1d76f Edit spline fit points with add move and delete workflows 2026-09-11 13:57:38 +03:00
ramox81 c3987f427d List polyline conversion in open spline editing prompt 2026-09-11 13:37:03 +03:00
Hakan Seven 30b6441ef9 Complete bounded spline polyline conversion 2026-09-11 13:33:17 +03:00
Hakan Seven e0bc84b4ad Merge latest pull request #1199 from ramox81/codex/join-source-workflow 2026-09-11 13:23:27 +03:00
Hakan Seven e39906b8b7 Merge latest pull request #1187 from ramox81/codex/complete-splinedit-options
# Conflicts:
#	src/modules/draw/modify/splinedit.rs
2026-09-11 13:23:27 +03:00
Hakan Seven da34032ffc Harden spline editing and source joins 2026-09-11 13:23:00 +03:00
ramox81 e875b2ec5d Resolve fit-only source and candidate splines for joining 2026-09-11 13:03:34 +03:00
Hakan Seven e11796af29 Merge pull request #1199 from ramox81/codex/join-source-workflow 2026-09-11 13:02:17 +03:00
ramox81 356c8b5a7b Keep multiple polyline editing active across selected joins 2026-09-11 12:57:58 +03:00