Commit graph

2,471 commits

Author SHA1 Message Date
Hakan
0e5dec0948 feat: annotation scale system (CANNOSCALE, PSLTSCALE, MultiLeader, Leader)
- Scale popup dropdown replaces cycle behavior; paper-space viewport scale
  editable when a viewport is active/selected
- CANNOSCALE persisted via DXF $USERR1 (read on open, write on save)
- PSLTSCALE: linetype dash lengths scaled by viewport anno_scale so dashes
  appear uniform physical size in paper space
- MultiLeader: arrow size, dogleg length, and text height scale with
  anno_scale; leader line paths (world coords) stay fixed
- Leader: arrow size and hookline length scale with anno_scale; also
  corrects world_offset subtraction that was previously deferred to the
  TruckObject::Lines path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 17:50:46 +03:00
Hakan
543c626feb chore: release v0.2.3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 11:50:13 +03:00
Hakan
534e4ff26b feat: implement Grippable and PropertyEditable traits for Solid3D, Region, and Body; add snap points and geometry properties 2026-05-06 10:00:37 +03:00
Hakan Seven
899b3f4796 feat: GPU scissor rect for paper-space viewport wires
Viewport-projected wires now clip at pixel level to their viewport boundary.

- WireModel.vp_scissor: Option<[f32; 4]> — paper-space bbox set on projection
- WireGpu.vp_scissor carries it through to the draw loop
- Pipeline.compute_wire_scissors() converts paper→NDC→pixel each frame
- render() calls set_scissor_rect() per wire, reset after viewport group
- INTEGRATION_GAPS.md: Viewport ⚠️, all 51 gaps resolved

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 07:12:05 +03:00
Hakan Seven
27aca41dd1 feat: plinegen + SAB parsing for Solid3D/Region/Body
LwPolyline PLINEGEN=0 (DXF default): emit SegmentedLines with NaN
separators between vertex-to-vertex segments; wire_gpu resets
arc-length to 0 after each NaN so linetype pattern restarts per vertex.
PLINEGEN=1: existing Contour path unchanged (continuous pattern).
WireModel gains plinegen field propagated through tessellate pipeline.

Solid3D/Region/Body: call SabReader::read() when parse_sat() returns
None due to binary SAB format (DWG files / newer AutoCAD exports).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 06:55:28 +03:00
Hakan Seven
63b17547f9 fix: warn on missing non-ASCII CXF glyphs; close ellipse snap gap
cxf.rs: missing non-ASCII glyphs now emit eprintln! once per font+char
pair via a global Mutex<HashSet> dedup set. ASCII chars silent (expected).

INTEGRATION_GAPS.md: ellipse partial arc snap marked done — endpoints are
correctly emitted via key_vertices → SnapType::Endpoint in snap engine.
Unicode warning gap closed. plinegen behaviour documented.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 20:20:16 +03:00
Hakan Seven
f000a8acfb feat: add OLE2Frame interactivity + fix Shape rotation from DXF
OLE2Frame: full TruckConvertible/Grippable/PropertyEditable/Transformable
impls in src/entities/ole2frame.rs — grips on corners + center, properties
panel, translate/scale transforms.

Shape: rotation (DXF code 50) now converted degrees→radians on load in
fix_dxf_dimension_rotations(), matching Dimension and Attribute behaviour.

All  gaps resolved. Remaining: Viewport GPU scissor, LWPolyline plinegen.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 20:12:44 +03:00
Hakan Seven
de520199ac docs: mark 5 more gaps resolved — thickness, Hatch OCS, RasterImage clip, complex lt, MLine OCS
thickness:  Arc/Circle/Line/LwPolyline/Polyline2D all extrude along WCS normal
Hatch OCS→WCS:  all boundary edge types transformed
RasterImage clip_boundary:  polygonal + rectangular implemented
Complex linetype text:  already done in complex_lt.rs (gap was wrong)
MLine/Leader OCS:  N/A — vertices already in WCS per DXF spec

Remaining: Viewport GPU scissor, LWPolyline plinegen, OLE2Frame, Shape rotation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 20:06:35 +03:00
Hakan Seven
fe954fa3ff feat: extrude LwPolyline and Polyline2D thickness along WCS normal
Tessellates bottom + top paths with NaN-separated walls at each vertex.
Arc segments (bulge != 0) use 16-step parametric tessellation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 20:06:35 +03:00
Hakan Seven
18cc51f498
Merge pull request #15 from HakanSeven12/arc
refactor: replace angle calculations with radians for consistency
2026-05-03 22:04:38 +03:00
Hakan Seven
603d07412e refactor: replace angle calculations with radians for consistency 2026-05-03 21:58:38 +03:00
Hakan Seven
3fd346729a
Replace old screenshot with new one
Updated the screenshot in the README file.
2026-05-03 21:45:46 +03:00
Hakan Seven
8be415213a chore: release v0.2.2 2026-05-03 21:40:24 +03:00
Hakan Seven
d7422b9396 fix: store arc angles in radians 2026-05-03 20:14:28 +03:00
Hakan Seven
1b4c5e13e5 fix: keep open drawing when creating new file 2026-05-03 19:55:38 +03:00
Hakan Seven
c51eeb4ad0 feat: extrude Arc and Circle thickness along WCS normal
Arc: tessellates bottom + top arcs (32 segs each) with 2 endpoint walls.
Circle: tessellates bottom + top circles (64 segs each) with 4 quadrant walls.
Both use TruckObject::Lines with NaN-separated segments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 20:30:30 +03:00
Hakan Seven
ce17e8abdf feat: extrude Line thickness along WCS normal
When line.thickness != 0, renders 4 NaN-separated wire segments
(bottom, top, left wall, right wall) using TruckObject::Lines.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 20:27:15 +03:00
Hakan Seven
9b29db61d4 feat: apply OCS→WCS transform to Hatch wire outline boundary edges
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 20:24:38 +03:00
Hakan Seven
3ca038bec8 docs: remove Iced 0.14 batch reference from viewport gap description
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 20:18:28 +03:00
Hakan Seven
4527819b2d chore: remove stale multi-viewport limitation comment from ViewportPaneMode
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 20:18:08 +03:00
Hakan Seven
654b8d579b docs: correct viewport status — compositing largely works, GPU scissor and multi-viewport 3D missing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 20:16:16 +03:00
Hakan Seven
ba063db617 docs: final gap status update — 39 done, 2 partial, 2 remaining
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 20:06:46 +03:00
Hakan Seven
9dcb5ad718 feat: apply OCS→WCS to Text and Attribute insertion snap points
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 20:06:22 +03:00
Hakan Seven
5297aea001 feat: apply OCS→WCS transform for Polyline2D (elevation + normal)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 20:04:30 +03:00
Hakan Seven
4da32eb320 docs: update gap status — mark 8 more items resolved, correct inaccuracies
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 20:03:40 +03:00
Hakan Seven
ece2069c9d feat: apply clip_boundary outline for RasterImage when clipping enabled
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 20:01:21 +03:00
Hakan Seven
645737b3f9 feat: add Node snap points for MLine vertices
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 19:59:37 +03:00
Hakan Seven
60be861cbe feat: add Node snap points for MultiLeader vertices and connection points
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 19:59:11 +03:00
Hakan Seven
62b179e33e docs: update INTEGRATION_GAPS.md to reflect 8 completed integrations
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 19:57:54 +03:00
Hakan Seven
f4160c4e8a feat: apply OCS→WCS transform for LwPolyline (elevation + normal)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 19:56:23 +03:00
Hakan Seven
e64eb0f463 feat: apply correct OCS→WCS transform for Ellipse entity
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 17:20:25 +03:00
Hakan Seven
3c414f43a3 feat: apply OCS→WCS transform for Point entity
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 17:18:54 +03:00
Hakan Seven
5a7ebbbb38 feat: add Node snap points to dimension defpoints
Dimension measurement origin points (first_point, second_point,
definition_point, angle_vertex, etc.) are now emitted as Node snap
hints so OSNAP Node mode can locate them precisely without relying on
the tessellated geometry wire alone.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 17:15:41 +03:00
Hakan Seven
000f74f951 feat: render CircularArc and EllipticArc hatch boundary edges
Hatch boundaries with arc or ellipse edges were silently dropped from
the wire outline, leaving gaps in the hatch contour. CircularArc and
EllipticArc boundary edges are now tessellated as polyline segments and
their centers are emitted as Center snap hints.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 17:15:02 +03:00
Hakan Seven
674a94f756 feat: implement OCS→WCS transform for Arc, Circle, and Line
Entities carrying a non-standard extrusion normal (normal ≠ (0,0,1)) were
rendered flat in the XY plane. The DXF arbitrary-axis algorithm is now
implemented in scene::transform::{ocs_axes, ocs_point_to_wcs} and applied
during tessellation of Arc, Circle, and Line so they render correctly on
tilted planes in 3D DXF files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 17:13:42 +03:00
Hakan Seven
7b7186a470 feat: use rational NURBS (NurbsCurve) when spline weights are present
Splines backed by rational NURBS (circles, conics) were tessellated as
uniform B-splines, losing the weighting that defines the curve shape.
Now BSplineCurve<Point3> is used only when weights are absent or empty;
when weight data is present a NurbsCurve<Vector4> is built from the
homogeneous control points so circles and conics render accurately.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 17:10:38 +03:00
Hakan Seven
c7b050fb09 feat: emit Insertion snap point for block references
Block INSERTs are expanded into sub-entity wires for rendering but the
OSNAP Insertion hint at the block reference origin was never generated.
Now a zero-geometry WireModel carrying the Insertion snap hint is appended
so OSNAP Insertion mode can locate the block origin.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 17:08:20 +03:00
Hakan Seven
97169bf1d6 chore: bump version to 0.2.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 15:46:17 +03:00
Hakan Seven
2eb19a21bb fix: identify DWG sheet viewport by center=(0,0) instead of scale heuristic
Debug output revealed the sheet viewport has id=0 (DWG reader never sets
the field), scale=0.8965 (not ≈1.0, so the 0.02 tolerance missed it),
and center=(0.0, 0.0) — exactly at the paper-space origin.

In DWG format the overall/sheet viewport always has its center at the
origin. Content viewports are placed at their actual paper positions and
always have a non-zero center. Switching from the scale heuristic to the
center-position check makes the detection reliable regardless of what
scale value the sheet viewport happens to carry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 15:15:13 +03:00
Hakan Seven
b346eb4d6e fix: remove dead code warning and fix sheet viewport double-click in DWG files
Remove unused `screen_delta_to_world` camera method (superseded by the
corrected pan_active_viewport formula).

Fix `is_content_viewport`: the old geometry fallback required the viewport
center to be near the origin, but DWG files never write the viewport id
field (stays 0) and the sheet viewport center is the paper centre
(e.g. 105, 148.5 mm for A4) — not the origin. This caused the sheet
viewport to be classified as a content viewport in DWG files, making it
both tessellated (border visible) and enterable via double-click.

The new heuristic uses only the scale: a sheet viewport has scale ≈ 1:1
(view_height ≈ paper height); true content viewports have deliberate
drawing scales (1:50, 1:100, …) that are far from 1.0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 14:55:12 +03:00
Hakan Seven
fbb6a20f10 fix: correct MSPACE viewport pan speed to match mouse movement
The old formula (distance × 0.001) was a fixed approximation that ignored
the paper camera's current zoom level and the viewport's paper-space size,
causing panning to feel sluggish.

New formula: model_per_pixel = (2 × paper_half_h / canvas_height) × (view_height / vp_height)
This converts screen pixels → paper-space mm → model units correctly,
making the content follow the cursor regardless of paper zoom or scale.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 21:39:05 +03:00
Hakan Seven
2434427583 fix: viewport grip resize preserves scale instead of zooming content
When a corner grip is dragged, view_height is now updated proportionally
with the new frame height so that scale = height/view_height stays constant.
The visible model-space area grows/shrinks with the frame instead of the
content appearing to zoom.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 21:26:02 +03:00
Hakan Seven
49d5cf1c61 feat: disable OSNAP by default
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 21:22:01 +03:00
Hakan Seven
928e7df274 fix: don't add model-space world_offset to paper-space grip absolute positions
GripApply::Absolute adds world_offset to convert local-space coordinates
back to DXF space for model-space entities. Paper-space entities (viewports,
etc.) use sheet mm coordinates with no world_offset, but the grip drag code
was unconditionally adding scene.world_offset — causing grips to jump by the
full model-space centroid offset (potentially hundreds of km for UTM drawings).

Now world_offset is only applied when current_layout == "Model".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 21:19:09 +03:00
Hakan Seven
93614ab554 fix: apply global LTSCALE to linetype pattern rendering
Entity linetype_scale is a per-entity multiplier applied on top of the
document-level $LTSCALE header variable. The previous code used only the
entity scale (defaulting to 1.0), ignoring $LTSCALE entirely. Drawings
with a non-default LTSCALE showed dash patterns at the wrong size.

Effective scale is now: document.header.linetype_scale * entity linetype_scale.
Applied in both render::render_style_for and the complex-linetype path in
tessellate_entity.

Fixes part of #10

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 21:13:56 +03:00
Hakan Seven
ebef467720 fix: hide sheet viewport border and improve crossing selection
Two layout-related fixes:

1. Sheet viewport (id=1) was rendered as a grey rectangle border in
   paper-space layouts. It is the paper boundary, not a user viewport,
   and should not appear. Now filtered via is_content_viewport() before
   tessellation. The redundant id==1 color branch is removed.

2. Box crossing-selection (right-to-left drag) only detected wires whose
   vertex points fell inside the selection box. Large entities like viewport
   frames could be visually crossed without any corner inside the box and
   would not be selected. Added segment-box edge intersection tests so any
   wire segment that crosses the selection rectangle boundary is included.

Fixes part of #10

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 21:12:14 +03:00
Hakan Seven
c0ee0d6edc fix: MODEL button in MSPACE now returns to paper space instead of Model tab
When editing inside a viewport (MSPACE), the status bar MODEL button was
sending LayoutSwitch("Model") which switched the entire layout to the
Model tab. The intended behavior (and what the comment documented) is
ExitViewport — just exit the active viewport back to PSPACE.

Fixes part of #10

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 21:06:41 +03:00
Hakan Seven
7b7622910c fix: apply world_offset when committing interactively created entities
Commands receive click coordinates in local space (DXF coords minus
world_offset) for camera precision. Without correction, entities were
placed world_offset away from the clicked position in existing drawings
that have a non-zero centroid (e.g. UTM-coordinate drawings).

Re-add world_offset via acadrust::Transform::from_translation (f64
precision) in commit_entity before the entity is inserted into the
DXF document. Paper-space entities are exempt as they use sheet coords.

Fixes #11

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 21:00:27 +03:00
Hakan Seven
428a115acf chore: update H7CAD version to 0.2.0 in Cargo.lock 2026-05-01 20:53:45 +03:00
Hakan Seven
1f25997716 chore: bump version to 0.2.0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 16:21:57 +03:00