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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Implements a full in-app file browser window for Save As, replacing the
rfd dialog that could not expose the selected filter index on Linux.
The new chooser includes directory navigation, a scrollable file list,
filename input, and a format drop-down (DWG/DXF × 2018/2013/2010/2007/2004/2000/R14).
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
rfd does not expose the selected filter index, so the old DWG/DXF version
filters had no effect — every file was always saved as AC1032 (R2018).
Replace with a single custom iced Save As window that shows:
- File name text input
- Save-in folder input + Browse button (rfd folder picker)
- Format dropdown: DWG/DXF × 2018/2013/2010/2007/2004/2000/R14
- Save / Cancel buttons
The selected format is passed to save_as_version() which temporarily sets
doc.version before writing, so DwgWriter/DxfWriter emit the correct file
format. Also works in the unsaved-changes Save flow.
Closes#9
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- Grip points in paper space now use the 2-D linear to_px transform
(tx/ty/ortho_size) instead of the 3-D view_proj matrix, matching the
coordinate system used by PaperCanvas
- world_offset is no longer subtracted from paper-space entity grip
positions — paper-space coordinates are already unoffset (same rule
as wire tessellation in wires_for_block)
- MTEXT v_offset corrected for all attachment points: CXF glyphs sit
on the baseline and extend upward, so Top attachment needs v_offset=-h,
Bottom needs (n_lines-1)*line_h, Middle is the midpoint of the two
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Previously \\U+XXXX was in the "strip until ;" list, silently dropping
all Unicode character references (°, ±, ⌀, Ø, €, …).
Changes:
- \\U+XXXX / \\u+XXXX decode to the actual Unicode character (was stripped)
- \\S upper/lower; stacked fractions/tolerances render as "upper/lower"
or "upper^lower" instead of leaking as literal text
- \\t tab → four spaces (was leaking as literal 't')
- Unknown escapes silently consume the code char (was leaking it)
- \\M+...; DBCS multibyte — stripped (added to semicolon-arg list)
- \\X paragraph-align end marker — stripped cleanly
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Line spacing: DXF code 44 (line_spacing_factor) is a multiplier on
AutoCAD's default baseline-to-baseline distance of 5/3 × text_height.
The renderer was using factor × 1.0 instead of factor × 1.667, making
all MTEXT appear cramped.
Blank paragraphs: split_mtext_lines was filtering out empty strings, so
\\P\\P (double paragraph break used to separate sections) was silently
collapsed. Empty lines in the middle of the block are now preserved;
only leading/trailing blank lines are stripped.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Opens a floating OS window when the user tries to close a dirty tab or
quit with unsaved changes. The main window stays alive until the dialog
is resolved — Cancel aborts the close entirely. For quit with multiple
dirty tabs the dialog loops through each one individually.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>