Commit graph

87 commits

Author SHA1 Message Date
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
Hakan Seven
313e7226d2 Feat: Phase 5.4 — Table entity render (grid wireframe + cell text)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:11:09 +03:00
Hakan Seven
28f441b3f2 Feat: RAY and XLINE creation commands (2-point interactive draw)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:05:57 +03:00
Hakan Seven
fa4fcf3c10 Feat: EXPLODE for Polyline, Polyline2D (bulge→Arc), Polyline3D → Lines
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:03:49 +03:00
Hakan Seven
7c3cf7accc Feat: Phase 1.2 — VIEW command (save/restore/list/delete named views)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 19:19:12 +03:00
Hakan Seven
7a5e3ed6ed Feat: Phase 6 — Face3D, PolygonMesh, PolyfaceMesh render; DRAWORDER command
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 19:13:37 +03:00
Hakan Seven
dafa079b6a Feat: Phase 5 — MLine, Tolerance render; DimStyle Choice picker on dimensions
- mline.rs: MLine renders center spine + two parallel offset lines at
  ±scale/2 using the vertex miter directions; vertex grips; scale,
  closed and style-name properties
- tolerance.rs: Tolerance renders the GDT text string via font
  tessellation at insertion_point with rotation from direction vector;
  insertion grip and position properties
- properties.rs: Dimension entity's style_name EditText is upgraded to
  a Choice dropdown when document.dim_styles is non-empty, enabling
  point-and-click DimStyle assignment without a separate panel

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 19:06:20 +03:00
Hakan Seven
27c0e74468 Feat: Phase 4.3/4.4/4.5 — RasterImage, Wipeout, AttributeDefinition, AttributeEntity
- raster_image.rs: RasterImage renders as border rectangle + X diagonals
  (pixel placeholder); Wipeout renders border or polygon clip boundary;
  both support insertion_point grip, brightness/contrast/fade properties,
  clipping toggle, and mirror transform (u/v vectors reflected)
- attribute.rs: AttributeDefinition renders default_value (or [TAG] if
  empty) as font-tessellated text; AttributeEntity renders the live value;
  both support insertion grip, position/height/rotation properties,
  and transform operations
- mod.rs + traits.rs: wire up all four new entity types through the full
  dispatch chain (to_truck, grips, geometry_properties, apply_geom_prop,
  apply_grip, apply_transform)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 19:00:15 +03:00
Hakan Seven
4a93fc4949 Feat: Phase 4.1/4.2 — Polyline, Polyline2D, Polyline3D, Ray, XLine render and grips
- polyline.rs: TruckConvertible/Grippable/PropertyEditable/Transformable
  for all three polyline types; Polyline2D handles bulge arcs via the
  same truck Wire path as LwPolyline; Polyline and Polyline3D use
  TruckObject::Lines for straight-segment rendering
- ray.rs: Ray renders as base→+1e6; XLine renders as ±1e6; both have
  base-point and direction grips; mirror correctly reflects direction
  vector; base X/Y/Z and Dir X/Y/Z exposed in properties panel
- traits.rs: dispatch all five new entity types through
  to_truck_entity, grips, geometry_properties, apply_geom_prop,
  apply_grip, apply_transform

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 18:51:38 +03:00
Hakan Seven
36bda2ac2b Feat: viewport UCS name picker from document UCS table
- properties.rs: inject 'UCS Name' Choice property for viewports when
  document.ucss is non-empty; resolves current handle to display name
- update.rs: intercept PropGeomChoiceChanged for 'vp_ucs_name'; clones
  UCS origin/x_axis/y_axis into viewport and sets ucs_handle — no
  trait signature change required

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 00:30:45 +03:00
Hakan Seven
5ad2f4a8cb Feat: Phase 3 — perspective projection and per-viewport UCS properties
- viewport_content_wires(): conditional perspective divide using
  camera_dist = view_height * lens_length / 24.0 (35mm-film equiv.);
  points behind the camera are mapped to NaN for safe clipping
- viewport.rs: expose lens_length, ucs_per_viewport, ucs_origin,
  ucs_x_axis, ucs_y_axis as editable properties; handle all new
  fields in apply_geom_prop()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 00:22:02 +03:00
Hakan Seven
1aa44ac987 Fix: remove unused imports and suppress dead_code warnings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 00:15:58 +03:00
Hakan Seven
617d7ba56a Feat: Phase 2 — expanded PageSetup panel and PlotSettings integration
PageSetup panel:
- Paper size presets (A4/A3/A2/A1/A0 portrait+landscape, Letter)
- Plot area selector: Layout vs Extents
- Center-on-page toggle
- Plot offset X/Y fields
- Rotation picker: 0° / 90° / 180° / 270°

PlotSettings (acadrust object):
- PageSetupCommit finds or creates a PlotSettings object in the document
- Writes paper size, plot type, centering, offset, rotation to it
- DXF round-trip: PlotSettings persisted to file

PDF export:
- Reads PlotSettings for the active layout
- Applies centering (auto-computes offset from wire extents)
- Applies offset X/Y from PlotSettings
- Applies rotation via PDF CTM transformation matrix
- Swaps paper dimensions for 90°/270° rotation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 00:12:07 +03:00
Hakan Seven
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 <noreply@anthropic.com>
2026-03-31 23:52:18 +03:00
Hakan Seven
b013619c25 Chore: ignore ROADMAP.md from version control
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 23:43:51 +03:00