Commit Graph
24 Commits
Author SHA1 Message Date
Hakan SevenandClaude Sonnet 4.6 641cc2d70b Feat: JOIN command — merge collinear Lines or co-circular Arcs
Selection-gathering mode: select objects, press Enter to apply.
- Lines: checks collinearity + no-gap, merges into single line span
- Arcs: checks same center/radius + contiguous angles, merges to Arc or Circle
- Uses CmdResult::JoinEntities; geometry computed in cmd_result from document

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:41:53 +03:00
Hakan SevenandClaude Sonnet 4.6 4b8ae08a19 Feat: BREAK command (BR) — split Line/Arc/Circle/LwPolyline at two points
3-step interactive flow:
  1. Entity pick (first break point recorded at click location)
  2. Optional first point refinement
  3. Second break point → CmdResult::BreakEntity applied in cmd_result

Geometry:
- Line: project p1/p2 onto line parameter space → two line fragments
- Arc:  project p1/p2 to arc angles → trim CCW from p1 to p2
- Circle: same as Arc, converts Circle → Arc
- LwPolyline: nearest-vertex split → two polyline fragments

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:39:51 +03:00
Hakan SevenandClaude Sonnet 4.6 a3bb2714c1 Feat: DIST / ID / AREA inquiry commands
Add three classic CAD measurement commands:
- DIST (DI): two-point pick → distance, angle, delta XYZ
- ID: one-point pick → coordinates
- AREA: multi-point polygon pick (Enter to close) → area + perimeter

New CmdResult::Measurement(String) variant ends active command and
prints result to command line without modifying the document.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:36:53 +03:00
Hakan SevenandClaude Sonnet 4.6 db66982098 Fix: update HELP text — accurate command list, fix dim command names
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:31:36 +03:00
Hakan SevenandClaude Sonnet 4.6 bf5d083453 Feat: SELECTALL, DESELECT, LIST commands for entity selection and info
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:30:36 +03:00
Hakan SevenandClaude Sonnet 4.6 582c7c09f9 Feat: CHPROP command — change layer/color/linetype/ltscale on selected entities
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:29:24 +03:00
Hakan SevenandClaude Sonnet 4.6 70a8f5bf3f Feat: ZOOM IN/OUT/WINDOW commands; ZoomToWindow CmdResult
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:28:00 +03:00
Hakan SevenandClaude Sonnet 4.6 6f5c58612d Feat: RENAME command — rename layers, text styles, dim styles, linetypes, UCS, views
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:24:13 +03:00
Hakan SevenandClaude Sonnet 4.6 375a910e4a Feat: Update HELP command — comprehensive command reference
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:23:34 +03:00
Hakan SevenandClaude Sonnet 4.6 927e72a3c6 Feat: LINETYPE LIST, PURGE (layers/textstyles/linetypes) commands
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:23:08 +03:00
Hakan SevenandClaude Sonnet 4.6 9e8b52c55d Fix: LAYER command — remove shadowed LA alias (already bound to ToggleLayers)
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:20:34 +03:00
Hakan SevenandClaude Sonnet 4.6 f918f1c0d9 Feat: DIMSTYLE command — list, new, set key dim properties (Phase 5.1 partial)
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:19:57 +03:00
Hakan SevenandClaude Sonnet 4.6 2b91ec4637 Feat: LAYER command — list, new, on/off, freeze/thaw, lock, color, set current
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:18:41 +03:00
Hakan SevenandClaude Sonnet 4.6 8c360110c3 Feat: UCS command — save/list/delete named UCSs (Phase 6.1 partial)
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:16:37 +03:00
Hakan SevenandClaude Sonnet 4.6 44f539c1ab Feat: STYLE/TEXTSTYLE command — list, new, font, width management
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:14:51 +03:00
Hakan SevenandClaude Sonnet 4.6 28f441b3f2 Feat: RAY and XLINE creation commands (2-point interactive draw)
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 23:05:57 +03:00
Hakan SevenandClaude Sonnet 4.6 7c3cf7accc Feat: Phase 1.2 — VIEW command (save/restore/list/delete named views)
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 19:19:12 +03:00
Hakan SevenandClaude Sonnet 4.6 7a5e3ed6ed Feat: Phase 6 — Face3D, PolygonMesh, PolyfaceMesh render; DRAWORDER command
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 19:13:37 +03:00
Hakan SevenandClaude Sonnet 4.6 73b224c191 Feat: viewport display lock, extended properties, VPLAYER and VPORTS commands
- Enforce status.locked in pan_active_viewport and zoom_active_viewport:
  locked viewports now reject pan/zoom inputs entirely
- Add perspective, render_mode, shade_plot_mode, hide_plot, ucs_icon_visible
  fields to the viewport property panel with appropriate pickers/toggles
- Add VPORTS command: lists all user viewports in the current layout
  (id, size, position, scale, on/locked state) in the command line
- Add VPLAYER command: per-viewport layer freeze/thaw from the command line
  (F <layer> to freeze, T <layer> to thaw, Enter to exit)
- Add CmdResult::VpLayerUpdate variant and its handler in apply_cmd_result

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-03-31 23:52:18 +03:00
Hakan SevenandClaude Sonnet 4.6 0beb589f2c Fix: viewport MSPACE activation and navigation
Four bugs prevented viewports from working like AutoCAD model-space windows:

1. Dead-code double-click block: `!is_down2` was always false because
   `is_down2 = sel.left_down` is captured while the button is still held
   (before the selection block clears it). Changed to `is_down` so the
   double-click handler actually fires.

2. Inverted pan direction: pan_active_viewport used `-=` on the delta
   returned by screen_delta_to_world, which is the same delta that cam.pan
   *adds* to its target — causing reversed drag. Changed to `+=`.

3. Zoom not cursor-centered: zoom_active_viewport now accepts an optional
   paper-space cursor position and adjusts view_target so the model point
   under the cursor stays fixed (same as cam.zoom_about_point).

4. ESC did not exit MSPACE: CommandEscape now calls ExitViewport when
   active_viewport is set and no command is running.

Also added MS/MSPACE and PSPACE command aliases, and MspaceCommand /
PspaceCommand messages so MS auto-enters the first viewport.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-03-31 12:52:07 +03:00
Hakan SevenandClaude Sonnet 4.6 e1d296da10 Phase 7: Plot settings and PDF export
- Add printpdf 0.9.1 dependency for native PDF generation.
- New src/io/pdf_export.rs: converts paper-space WireModels to a PDF
  page (per-wire stroke color, line weight in Pt, NaN-split segments).
  White/near-white colors are inverted to black for print output.
- Add PlotExport / PlotExportPath messages: opens a save-file dialog
  and writes a .pdf next to the drawing file.
- Add PageSetupOpen/Close/WidthEdit/HeightEdit/Commit messages: a
  centered modal panel lets the user enter paper width and height (mm);
  on commit the Layout object's min/max_limits are updated in-place.
- Register PRINT / PLOT / EXPORT and PAGESETUP (PS) commands in
  dispatch_command; fix MVIEW error message to English.
- Layout ribbon gains a "Plot" group with Page Setup and Export PDF
  ribbon buttons.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-03-31 08:05:17 +03:00
Hakan SevenandClaude Sonnet 4.6 a88542a69a Fix ribbon active state, polar snap, FILLET pick mode, and arc preview plane
- Deactivate ribbon tool highlight when command ends (issue #1)
- Reset last_point on new command dispatch to fix polar snap offset (issue #2)
- FILLET/CHAMFER: disable text input during entity pick so clicks reach viewport (issue #3)
- Dropdown icon buttons now use RibbonToolClick so they highlight blue when active
- FILLET/CHAMFER: AutoCAD-style sub-step UX — typing R/D + Enter prompts for value
- Fix FILLET arc preview plane: arc was rendering in XZ instead of XY
- Bump version to 0.1.1

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-03-31 00:31:28 +03:00
Hakan SevenandClaude Sonnet 4.6 468633c1fe Co-locate CadCommand impls with their ribbon toolbar modules
Each command implementation is now in the same file as its ribbon
tool definition. Groups moved to a dedicated groups/ toolbar folder.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-03-22 23:21:29 +03:00
Hakan SevenandClaude Sonnet 4.6 ed9cbc2092 Refactor src/main.rs into modular src/app/ structure
Split the 4500-line main.rs into focused submodules under src/app/:
- mod.rs: H7CAD struct, Message enum, boot/new/run
- document.rs: DocumentTab, HistorySnapshot, HistoryState
- helpers.rs: pure helper functions
- history.rs: undo/redo logic
- properties.rs: properties panel logic
- layers.rs: layer sync
- commands.rs: dispatch_command
- cmd_result.rs: apply_cmd_result
- view.rs: view, subscription, tab bar
- update.rs: update message handler

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-03-22 22:44:32 +03:00