Commit graph

101 commits

Author SHA1 Message Date
Hakan Seven
34076b26bb feat: MLineStyle manager (MLSTYLE command + dialog)
- MLSTYLE command: LIST, NEW, SET, DEL subcommands
- Multiline Style Manager dialog: style list, element details (offset,
  color, linetype), Set Current / New / Delete buttons
- MLINE/ML command now reads document header.multiline_style to apply
  the current style to newly created MLine entities
- MlineCommand.with_style() constructor for style-aware multiline drawing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 14:54:05 +03:00
Hakan Seven
7e6de57c8d feat: Wipeout solid fill masking
Wipeout entities now render a background-colored solid fill polygon
(via the hatch GPU pipeline) that masks other hatch fills beneath them.
Fills use model space background (0.11 grey) or paper space background
(0.22/0.24/0.28). Polygon and rectangular clip boundaries both supported.
Selected wipeouts use a translucent blue highlight instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 14:46:47 +03:00
Hakan Seven
6f19b4fd81 feat: add Underlay entity support (PDF/DWF/DGN)
- New src/entities/underlay.rs: TruckConvertible (clip boundary polygon
  or cross marker), Grippable (insertion + boundary vertex grips),
  PropertyEditable (position, scale, rotation, contrast, fade, flags),
  Transformable (translate, mirror, scale, rotate)
- Wire EntityType::Underlay into all four match arms in traits.rs
- UNDERLAY command: FADE/CONTRAST/ON/OFF/CLIP ON|OFF/MONO ON|OFF
  subcommands to edit selected underlay entities
- Entity type name map entry for UNDERLAY

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 14:43:44 +03:00
Hakan Seven
1db3ad6a33 Feat: implement CTB/STB plot style table with PDF export integration
- src/io/plot_style.rs: PlotStyleTable and PlotStyleEntry data structures;
  CTB reader (deflate/zlib decompressed text format) with ACI→RGB and
  ACI→lineweight lookup; CTB writer (zlib compressed); LW_TABLE constant
- src/io/pdf_export.rs: accept optional PlotStyleTable; apply ACI color
  and lineweight overrides during PDF rendering
- src/scene/wire_model.rs: add `aci: u8` field to carry ACI index
- src/scene/render.rs: render_style() now returns ACI alongside RGBA
- src/scene/mod.rs + tessellate.rs: propagate aci through wire building
- app: PlotStyleLoad/Loaded/Clear messages and handlers;
  PLOTSTYLE LOAD | CLEAR | STATUS command; active_plot_style state on H7CAD
- flate2 added as dependency

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 14:37:23 +03:00
Hakan Seven
911e36ba04 Feat: add Dimension Style Manager dialog (DIMSTYLE/DDIM)
- Add DimStyleDialogOpen/Close/Apply/Select/Tab/New/SetCurrent/Delete
  messages and DsEdit/DsToggle with DsField enum for fine-grained edits
- Store active dialog state (selected style, current tab, edit buffers)
  directly on H7CAD for all 28 most-used DimStyle properties
- dimstyle_overlay: 5-tab modal panel (Lines, Arrows, Text,
  Scale/Units, Tolerances) with style list, Apply and Close buttons
- DIMSTYLE / DDIM with no sub-command now opens the dialog;
  DIMSTYLE LIST / NEW / SET sub-commands remain available

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 14:25:13 +03:00
Hakan Seven
20629d587a Feat: implement WCS↔UCS coordinate transform pipeline
- Add `active_ucs: Option<Ucs>` per-tab state to DocumentTab
- Add `ucs_to_wcs`, `wcs_to_ucs`, `ucs_z_axis`, `ucs_rotated_z` helpers
- Add `Camera::pick_on_plane` for ray–plane intersection against any plane
- Mouse picks project onto the active UCS XY plane instead of world XY
- Typed coordinates are converted from UCS space to WCS before dispatch
- UCS command now really activates/deactivates a UCS:
  - `UCS W` resets to WCS (clears active_ucs)
  - `UCS <name>` activates a named UCS
  - `UCS SAVE <name>` saves the current active UCS
  - `UCS ORIGIN x,y,z` shifts origin (in current UCS space)
  - `UCS X/Y/Z <angle>` rotates the UCS around its own axes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 14:16:06 +03:00
Hakan Seven
98578cc5c0 Chore: bump version to 0.1.3 2026-04-03 22:03:26 +03:00
Hakan Seven
3b9cbd90a1 Remove ROADMAP.md from tracking (was in .gitignore) 2026-04-03 21:56:18 +03:00
Hakan Seven
b6c2b1130e Fix: guard UCS icon drawing against zero-size viewport and non-finite projections
Before layout completes the viewport bounds are 0×0, causing project_point3
to produce NaN/Inf coordinates which panicked in lyon_path assertions.
Added early-return when bounds < 10px, and finite checks on all projected
and derived coordinates before calling any canvas drawing functions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 21:53:19 +03:00
Hakan Seven
6f62a6eb6f acadrust update 2026-04-03 21:52:00 +03:00
Hakan Seven
39346146c7 Docs: mark completed ROADMAP items — dim grips, hatch grips, solid entity, UCS icon
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 19:26:39 +03:00
Hakan Seven
6a4813ce42 Feat: UCS icon — animated XYZ axis tripod in viewport bottom-left corner
Screen-space UCS icon drawn on the existing selection canvas overlay.
Axes are projected from world space so the icon rotates with the camera,
always showing the correct X/Y/Z orientation relative to the drawing plane.
Each axis has its canonical color (X=red, Y=green, Z=blue) with arrowheads.
Icon visibility controlled by show_ucs_icon flag (default on); toggled by
UCSICON ON/OFF command which also updates paper-space viewport entities.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 19:25:55 +03:00
Hakan Seven
e38aa6b611 Feat: Solid entity (2D) — render, grips, properties, transform
TruckConvertible renders the 4 perimeter edges as wireframe outline.
The scene injects a solid-fill HatchModel for the filled quad using the
existing hatch GPU pipeline (DXF Z-order: p0→p1→p3→p2).
Grippable provides 4 square corner grips; grip moves rebuild the fill model.
PropertyEditable exposes all 4 corners and thickness. Transformable handles
move/rotate/scale/mirror via the standard entity transform path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 19:22:10 +03:00
Hakan Seven
749f3b99dc Feat: hatch boundary grip editing — all edge types supported
Polyline, Line, CircularArc, EllipticArc, and Spline boundary edges
all get diamond grips at their control vertices. Dragging a grip updates
the underlying DXF boundary vertex and immediately rebuilds the GPU
hatch model via Scene::apply_grip.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 19:16:17 +03:00
Hakan Seven
36d51286d4 Feat: dimension grip editing — all dimension types get stretch grips
Linear/Aligned: first point, second point, definition point, text position
Radius/Diameter: center (angle_vertex), radius point, text position
Angular2Ln/Angular3Pt: vertex, two extension points, arc def point, text
Ordinate: origin, feature location, leader endpoint, text position
Text position grip shared across all types; measurement recalculated after edit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 19:11:21 +03:00
Hakan Seven
0aef1fc12f Feat: ROADMAP Phase 1-5 batch — trim/extend, plot scale, viewport UX, mline caps, table alignment
- TRIM/EXTEND: Ray and XLine entities supported as cutting boundaries and trim targets;
  trim results in Ray→Line/Ray, XLine→Ray/Ray or Line; hover preview added
- Plot scale override: Fit/1:1/1:2/1:5/1:10/1:20/1:50/1:100/2:1 buttons added to Page Setup
  panel; PageSetupCommit applies scale to PlotSettings
- Viewport UX: locked viewport gets orange border; selected viewport gets white border
- Named view → viewport assignment: Choice dropdown in properties panel copies
  view_target/direction/height to the viewport entity
- MLine caps: perpendicular start/end cap lines added for open (non-closed) MLines
- Wipeout polygon grips: boundary vertices become editable grips when clipping_enabled+Polygonal;
  world→pixel back-projection on drag
- Table cell alignment: CellStyle.alignment (1-9) drives left/center/right + top/middle/bottom
  text positioning; cxf::measure_text() helper added
- New commands/features: DIMCONTINUE (DCO), DIMBASELINE (DBA), TOLERANCE (TOL), TABLE,
  ATTDEF, ATTEDIT, ATTDISP, BREAKATPOINT (BAP), PLOTWINDOW (PW), MLINE (ML);
  DIMSTYLE/DIMCURRENT/CLAYER/LTSCALE/CELTSCALE/SCALETEXT/XDATA/UCSICON/REGEN/DRAWORDER extended
- PLINE arc mode: A/L/CLOSE text input, bulge computation, arc preview
- Warning cleanup: removed unused imports and unreachable patterns

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 15:31:05 +03:00
Hakan Seven
27b5e124c7 Feat: enhanced LIST command with entity-specific geometry details
LIST (LI) now shows per-type details:
- Line: from/to coordinates + length
- Circle: center + radius + area
- Arc: center + radius + start/end angles
- LwPolyline: vertex count, closed flag, elevation
- Text/MText: content preview + height + insertion point
- Insert: block name + position + scale + rotation
- Spline: control point count + degree + closed flag
- Ellipse: center + major length + minor ratio

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 09:31:03 +03:00
Hakan Seven
77327bf730 Feat: DIMALIGNED (DAL) and DIMDIAMETER (DDI) dimension commands
DIMALIGNED: 3-click flow (p1 → p2 → dim line position) → DimensionAligned.
Rubber-band preview shows extension lines and dim line offset.

DIMDIAMETER: 3-click flow (center → arc point → text position) → DimensionDiameter.
Previews the diameter chord line.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 09:29:11 +03:00
Hakan Seven
a9aedb4c7c Feat: PASTEORIG command — paste clipboard at original coordinates
Pastes clipboard entities without translating to a pick point.
Useful for pasting between drawings at exact original positions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 09:27:21 +03:00
Hakan Seven
426081e8be Feat: ZOOM ALL (ZA) and ZOOM SCALE (ZS) commands
ZOOM ALL (ZA)       — fit all entities (alias for ZOOM EXTENTS)
ZOOM SCALE <n> (ZS) — set zoom factor (1/n multiplied to camera distance)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 09:26:15 +03:00
Hakan Seven
7fea8bce53 Feat: LAYISO, LAYUNISO, FLATTEN, QSELECT utility commands
LAYISO    — turn off all layers except selected entities' layers
LAYUNISO  — restore all layers (turn-on all, mirrors LAYON)
FLATTEN   — move selected (or all) entities to Z=0; handles Line/Circle/Arc/
            LwPolyline/Text/MText/Insert/Point/Spline/Ellipse
QSELECT   — select entities by TYPE, LAYER, COLOR, or LINETYPE

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 09:25:39 +03:00
Hakan Seven
0de21fd169 Feat: QSELECT command — quick-select entities by property
QSELECT TYPE <type>       — select all entities of given type (e.g. LINE, CIRCLE)
QSELECT LAYER <name>      — select all entities on the given layer
QSELECT COLOR <n|BYLAYER> — select all entities with given color index
QSELECT LINETYPE <name>   — select all entities with given linetype

Deselects current selection and replaces with matched entities.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 09:23:57 +03:00
Hakan Seven
ec5022d725 Feat: COUNT command — entity statistics by type or layer
COUNT             — count all entities grouped by type
COUNT LAYER       — group by layer name
COUNT TYPE        — group by entity type (same as default)
COUNT <layername> — count entities on a specific layer by type

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 09:23:17 +03:00
Hakan Seven
e8b749a8ac Feat: FIND / FINDALL — search and replace text in drawing entities
FIND <search>                    — list all Text/MText/Attribute containing search
FIND <search> REPLACE <rep>      — replace first occurrence
FINDALL <search> REPLACE <rep>   — replace all occurrences

Works on Text, MText, AttributeDefinition, AttributeEntity.
Case-insensitive search; replaces preserving case in replacement.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 09:22:27 +03:00
Hakan Seven
330b8b58f4 Feat: PEDIT command (PE) — polyline edit (close/open/width)
Entity pick → text input subcommands:
  C / CLOSE  → set closed flag
  O / OPEN   → clear closed flag
  W <value>  → set uniform width on LwPolyline vertices
  X / EXIT   → cancel

Command stays active after each op (CmdResult::PeditOp) for multiple edits.
Supports LwPolyline and Polyline2D.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 09:19:36 +03:00
Hakan Seven
05ccc80048 Feat: Phase 5.3 — MLINE command (ML) — create multiline entity
Pick vertices, Enter to finish (≥2 pts). Text input while picking:
  C / CLOSE  → close and commit (≥3 pts)
  S <value>  → set scale factor (default 1.0)
  S alone    → prompt for scale then continue

Uses acadrust MLine::from_points / closed_from_points + scale_factor field.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 09:17:45 +03:00
Hakan Seven
e4a7970c3e Feat: Phase 4.4 — WIPEOUT command (WO)
Creates rectangular (2-corner pick) or polygonal (multi-pick, Enter to close)
wipeout masking entities. Uses acadrust Wipeout::from_corners / ::polygonal.

Options: WIPEOUT → rectangular; WIPEOUT P → polygonal.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:54:07 +03:00
Hakan Seven
1572d0c38f Feat: Phase 1.5 — viewport count in status bar + REVCLOUD command
Status bar: shows "N VP" pill (with tooltip) when in a paper layout that has
user viewports (id > 1). New Scene::viewport_count() method.

REVCLOUD: closed LwPolyline with arc bumps (bulge = 0.5) along each edge.
Click polygon corners, Enter to close into a revision cloud shape.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:52:35 +03:00
Hakan Seven
c9719bacdf Feat: REVCLOUD command — revision cloud (arc-bumped closed polyline)
Pick polygon corners, Enter to close. Each edge is subdivided into arc
bumps (bulge = 0.5 ≈ 53° arcs). Result is a closed LwPolyline.
Arc bump length defaults to 1.0 drawing units.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:51:17 +03:00
Hakan Seven
8fca75fade Feat: DONUT command (DO) — filled circular ring as LwPolyline
Creates LwPolyline with 2 vertices at (cx ± r_avg, cy), bulge=1.0,
start_width/end_width = (outer - inner) / 2, is_closed = true.

Workflow: inner diameter → outer diameter → click center points (Enter to exit).
Inner diameter 0 → filled solid circle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:50:27 +03:00
Hakan Seven
9a1eeab53d Feat: Phase 6.4 — Draw order render pipeline via SortEntitiesTable
wires_for_block() now looks up the SortEntitiesTable for the current block.
When found, wires are sorted by sort_handle.value() so DRAWORDER F/B results
are immediately visible in the viewport (not just written to DXF).

Entities not in the sort table default to u64::MAX/2 (middle of draw order).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:48:17 +03:00
Hakan Seven
b27b612b5d Feat: ALIGN command (AL) — align objects using 1 or 2 point pairs
Workflow: select objects → 1st src/dst pair → 2nd src/dst pair (optional) → Enter.
- 1 pair: pure translation (src1 → dst1)
- 2 pairs: translate + rotate in XZ plane; optional uniform scale (Y/N prompt)

Transform applied as 3 sequential scene.transform_entities calls:
translate to origin → scale → rotate → translate to dst1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:46:48 +03:00
Hakan Seven
f6efe7a06a Feat: LENGTHEN command (LEN) — extend or trim Line/Arc
Options via text input after entity pick:
  DE <delta>   — extend by delta (negative trims)
  TO <total>   — set absolute total length / arc length
  P <percent>  — scale by percentage
  <number>     — plain number treated as DE delta

Closest end to pick point is modified. Uses CmdResult::LengthenEntity.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:45:06 +03:00
Hakan Seven
ae0a4b12b5 Feat: DIVIDE and MEASURE commands — place points along entities
DIVIDE (DIV): entity pick → type N → places N-1 Point entities at equal spacing.
MEASURE (ME): entity pick → type distance → places points at fixed intervals.

Supported entities: Line, Arc, Circle, LwPolyline.
Uses CmdResult::DivideEntity / MeasureEntity with geometry computed in cmd_result.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:43:33 +03:00
Hakan Seven
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 <noreply@anthropic.com>
2026-04-02 23:41:53 +03:00
Hakan Seven
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 <noreply@anthropic.com>
2026-04-02 23:39:51 +03:00
Hakan Seven
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 <noreply@anthropic.com>
2026-04-02 23:36:53 +03:00
Hakan Seven
db66982098 Fix: update HELP text — accurate command list, fix dim command names
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:31:36 +03:00
Hakan Seven
bf5d083453 Feat: SELECTALL, DESELECT, LIST commands for entity selection and info
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:30:36 +03:00
Hakan Seven
582c7c09f9 Feat: CHPROP command — change layer/color/linetype/ltscale on selected entities
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:29:24 +03:00
Hakan Seven
70a8f5bf3f Feat: ZOOM IN/OUT/WINDOW commands; ZoomToWindow CmdResult
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:28:00 +03:00
Hakan Seven
6f5c58612d Feat: RENAME command — rename layers, text styles, dim styles, linetypes, UCS, views
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:24:13 +03:00
Hakan Seven
375a910e4a Feat: Update HELP command — comprehensive command reference
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:23:34 +03:00
Hakan Seven
927e72a3c6 Feat: LINETYPE LIST, PURGE (layers/textstyles/linetypes) commands
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:23:08 +03:00
Hakan Seven
9e8b52c55d Fix: LAYER command — remove shadowed LA alias (already bound to ToggleLayers)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:20:34 +03:00
Hakan Seven
f918f1c0d9 Feat: DIMSTYLE command — list, new, set key dim properties (Phase 5.1 partial)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:19:57 +03:00
Hakan Seven
2b91ec4637 Feat: LAYER command — list, new, on/off, freeze/thaw, lock, color, set current
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:18:41 +03:00
Hakan Seven
8c360110c3 Feat: UCS command — save/list/delete named UCSs (Phase 6.1 partial)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:16:37 +03:00
Hakan Seven
44f539c1ab Feat: STYLE/TEXTSTYLE command — list, new, font, width management
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:14:51 +03:00
Hakan Seven
d66673a4fa Feat: VPLAYER ALL — freeze/thaw layer across all viewports in layout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:13:09 +03:00