Bump acadrust to a46cb8b (spline knot parameterization + mtext line-space
style now stored) and populate rows the builders left blank:
Entity-local: spline Knot Parameterization + closed-spline Area (shoelace),
mtext Line space style, hatch Spacing (pattern-line offset), leader Text
offset (annotation offset), region Area + Perimeter (wire-loop approx).
Doc-dependent (resolved in app/properties.rs where the document is
reachable): insert Block Unit + Unit factor (block record units vs
INSUNITS), underlay Name + Path (definition object), leader Text style /
vertical placement / overall scale and tolerance Text style (dimension
style), multileader Max points + segment angles (mleader style).
Rows needing an annotation-scale / sheet-set subsystem or an internal
PDF/DWF layer parser are intentionally left blank.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fill the two placeholder rows added earlier. Read the General group's
Hyperlink from the entity's XDATA (the "PE_URL" application record's first
string). When an entity carries an explicit material (material_flags == 3),
resolve its material_handle to the Material object's name and show it in the
3D Visualization group instead of "Custom".
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Resolve a dimension's DimStyle from the document and inject its full spec
groups — Lines & Arrows, Text, Fit, Primary Units, Alternate Units,
Tolerances — mirroring the ~80 dimension variables (dimasz, dimclrd, dimtxt,
dimdec, dimtol, dimzin bit flags, …) as read-only rows. The panel already had
doc access for the dim-style picker; extend it to append style_sections(style)
after the dimension's own Misc/Geometry groups.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Selecting an INSERT with attributes now adds an editable "Attributes"
section to the Properties panel — each tag is a row whose value can be
changed inline (Enter commits, undo works, the attribute text repaints).
Previously attribute values could only be reached through ATTEDIT, which
didn't let them be changed (#192).
Attribute tags are runtime strings, so they can't ride the geometry
edit path whose field key is `&'static str`; a dedicated PropValue::
AttrText variant plus PropAttrInput/PropAttrCommit messages carry the
tag. Values are stored verbatim (no expression evaluation, since
attribute text is free-form).
Also guard the panel's in-progress edit buffer: it now only carries
across a rebuild when the selection is unchanged (a commit-triggered
refresh), so a typed-but-uncommitted value can't display or commit onto
a different entity — e.g. two title blocks sharing a REV1 tag. This
closes a latent stale-buffer leak that affected geometry fields too.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Relocate three root-level modules into io/, where they belong by concern:
- update_check.rs -> io/update_check.rs (its own doc-comment notes it
mirrors how crate::io wraps blocking calls in async).
- patterns.rs, linetypes.rs -> io/ (standard resource catalogs parsed
from asset files and populated into the document — IO-shaped work).
Fix the moved files' include_str! paths (one level deeper), add the
mod declarations to io/mod.rs, drop them from lib.rs/main.rs, and
re-point all crate:: references to crate::io::. No behavior change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Creating a viewport in a layout commits through document.add_entity_to_layout
+ Scene::auto_fit_viewport, both of which skip the geometry-cache bump that
Scene::add_entity performs for every other entity. So the new viewport's
border wasn't tessellated until the next zoom/pan happened to invalidate the
cache. Bump the wire tessellation (no-blocks: a viewport touches no block
definitions) right after the viewport is added.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Clean up the last zero-valued world_offset locals outside the scene
tessellation core: the UCS wire-affine / grid-basis origin shift
(document.rs), the coordinate readout (view.rs), grip absolute-apply
(update.rs), the dead properties-edit re-offset guard, the MTEXT preview
glyph-box shift (mtext_editor.rs), and the cross-drawing paste correction
(commands.rs / cmd_result.rs) — including the now-dead
`clipboard_world_offset` field. Coordinates are absolute throughout.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Delete the world_offset field from Scene and DerivedCaches and the
load-time assignment; every reader now uses a zero origin. Geometry is
absolute and the double-single relative-to-eye pipeline keeps it precise,
so the coarse origin is gone. world_offset_from_centers still derives
local_extent_max (camera/cull span) but returns no offset. The remaining
`world_offset: [f64;3]` function parameters are now always zero — dead
plumbing left for a later mechanical sweep; behaviour is unchanged.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
ACIS solids bake their colour into the mesh, so a property-panel or ribbon
colour (or layer) change left the solid showing its old colour — only the
wires, which resolve colour at render time, updated. Run recolor_meshes
(now covering block-definition meshes too) when property targets are
invalidated, and route the ribbon colour change through the same path.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move the 30 flat modules under src/scene/ into six folders by role:
convert (entity→geometry), text (fonts/shaping), model (render models),
pick (hit-test/selection/grips/xclip), view (camera/transform/render),
cache (block + property caches). pipeline/ is unchanged.
Full path migration — all `scene::X` references become
`scene::<group>::X`, no compatibility re-exports. render.rs items that
were `pub(super)` (parent was scene) become `pub(in crate::scene)` to
keep their original scene-wide visibility.
No behavior change; build and tests are green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Properties color dropdown stayed open after deselecting, reselecting, or
clicking into the viewport. refresh_properties carried color_picker_open across
rebuilds, so a selection change never closed it; and a viewport press starts a
box selection, so it only closed on the second click. Stop preserving the
picker state across rebuilds and dismiss both color dropdowns on the first
viewport press.
Fixes#104.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A new multileader was built from defaults and ignored the current
MLeaderStyle, so the style editor's settings had no effect on it (the
renderer reads the entity's own fields, not the style). commit_entity_handle
now copies the style's content/path type, text attachment/alignment/angle,
colours, sizes, scale and landing into the new entity (enum types
round-trip through i16 since the entity and style enums are distinct).
Text styles already render correctly and tables already resolve their
style live via table_style_handle, so no change was needed there.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Follow-up to the text/dimension fix: MultiLeader and Table were created
at their default style too. Their styles live in the objects dictionary,
so commit_entity_handle now resolves header.current_mleader_style_name /
current_table_style_name to the matching style object's handle and
assigns it, unless the command already set one or no such style exists.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
New annotation entities were created at the entity "Standard" default
instead of the document's current style, so making a style current had
no effect on creation.
- Text / MText: seed the new entity (and the MText editor preview) from
header.current_text_style_name.
- Dimension: commit_entity_handle fills the new dimension's style_name
from header.current_dimstyle_name, covering every dimension command
centrally.
Applied only when the entity is still at its default so an explicitly
styled entity is preserved. MLeader and Table styles need their style
tables modelled first and are left for follow-up.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Annotate style dropdowns (text / dimension / multileader / table) and
the layer dropdown were hard-coded to "Standard" / "0" and never synced
from the opened document, so they showed placeholder values even with no
file open and stale values after closing one.
- Start the ribbon's style and layer lists empty instead of with a
placeholder entry.
- Sync the style dropdowns from the document on file open and on tab
new/switch/close (the layer sync already ran there).
- Guard sync_ribbon_layers / sync_ribbon_styles / sync_ribbon_from_selection
for the Start (welcome) tab so all three dropdowns stay empty there.
- When a style family is absent (e.g. no table/multileader styles), fall
back to empty rather than a non-existent "Standard".
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A block reference with a visibility parameter now shows a triangular
lookup grip at the parameter point. Clicking it opens a dropdown of the
named states (current one marked); picking a state toggles which of the
anonymous block's members are visible and rebuilds, so the reference
shows the chosen profile instead of being frozen on the saved state.
The state list is data-driven (owned strings from the file) and applying
it mutates other entities (the anonymous block's members), so it stays
separate from the static GripMenuAction grip-menu: a dedicated
VisibilityPopup and an app-level apply path. The anonymous block is a
parallel-ordered clone of its definition, so a member visible in the
definition's state maps to the same index in the inserted block; the
chosen visibility flags round-trip through the DWG writer.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Grip markers drew visibly offset from the entity on large-coordinate
(UTM-scale) drawings: every Grippable impl cast the f64 entity coordinates
to f32 BEFORE the world-offset subtraction, and at 1e7 magnitude an f32
holds ~0.9 drawing units of rounding error. The wires subtract the offset
in f64 first (precision-preserving), so the grips landed up to ~1 unit
away from the geometry they belong to.
GripDef.world is now DVec3: producers fill it straight from the f64
entity data, refresh_selected_grips subtracts the world offset in f64,
and only the small offset-local result is cast to f32 for screen-space
projection (grips_to_screen / find_hit_grip) and drag state.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Read the model-space annotation scale from the standard CANNOSCALE /
CANNOSCALEVALUE header variables instead of a user-variable hack, and
populate both the status-bar scale picker and the viewport Scale
property purely from the drawing's ACAD_SCALELIST — no built-in
fallback set. Xref-derived scales (`_XREF` suffix, `name|` prefix)
are filtered out so only the host drawing's own scales appear.
Bumps the patched acadrust to the commit that adds CANNOSCALE/
CANNOSCALEVALUE read/write.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Route every text-bearing entity to an in-place editor instead of the
command line: a plain text box for single-line text (Text, attributes,
dimension override, tolerance) and the rich MText editor for MText /
MultiLeader. A Leader resolves to the entity it annotates.
- TEXT places a plain text box at the click; double-click edits in place.
- DDEDIT and double-click on any text entity open the matching editor.
- MLEADER places the leader then opens the MText editor on its content.
- LEADER follows the classic flow: points, Enter, then a linked empty
MText annotation opens in the editor; the leader's annotation_handle
links the pair so they edit/erase as a unit.
Adds shared field read/write helpers and a begin_text_edit router, plus
CommitAndEditText / CommitManyAndEditText results that commit an entity
and open its editor (commit_entity now returns the new handle).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Joining the OpenAEC Foundation (open-aec.com). Crate/struct become
OpenCADStudio, user-facing strings use the spaced "Open CAD Studio"
form, repo URLs point to HakanSeven12/open-cad-studio. Logo (window
icon + assets/logo.svg) redrawn with OCS initials. Drop examples/
binaries — unused.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Property-panel coordinate display and block-insert scaling were both
hard-coded, ignoring the document's stored unit configuration.
- LUNITS / LUPREC: edit_prop() now formats values through a thread-local
UnitContext seeded by refresh_properties(). Decimal / Scientific /
Engineering / Architectural / Fractional all render correctly without
threading the document handle through every entity properties builder.
- AUNITS / AUPREC: format_angle() helper available (decimal degrees, DMS,
grad, rad). Callers that already format angular values via radians can
switch over without touching the helper signatures.
- INSUNITS + MEASUREMENT: xref's source INSUNITS is carried onto the
host BlockRecord.units during merge. commit_entity() then scales new
INSERTs so 1 source-unit maps to the host's INSUNITS length. When
either side is unitless (0) MEASUREMENT acts as the fallback
(0=Imperial / inches, 1=Metric / mm), matching AutoCAD's rule.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The Home ribbon's creation-default chips were hard-coded to ByLayer
whenever the selection went empty. New entities therefore ignored the
file's saved CECOLOR / CELTYPE / CELWEIGHT and started fresh at ByLayer.
Pick those defaults up from header instead:
- sync_ribbon_from_selection() reads current_layer_name, current_entity_color,
current_linetype_{name|handle} and current_line_weight when nothing is
selected, mapping the i16 weight code through LineWeight::from_value.
- commit_entity() stamps header.current_entity_linetype_scale onto the
fresh entity's linetype_scale when it differs from 1.0.
ELEVATION / PAPER_ELEVATION / CMLSCALE / CMLJUST will follow with the
commands that consume them; PLINEGEN already routes through the per-
polyline bit at render time.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Selecting an entity refreshed the Properties panel but the Layer / Color /
Linetype / Lineweight dropdowns kept showing the creation-time defaults
— so they couldn't be used to inspect or edit a single object's settings.
refresh_properties() now also calls sync_ribbon_from_selection(), which
walks the current selection and mirrors common values into ribbon.active_*
fields. Mixed selections leave the prior value in place (no "*Varies*"
chip yet); an empty selection restores per-tab creation defaults.
Closes#17
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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>
- 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 <noreply@anthropic.com>
Entity grips() return world-space coordinates (raw DXF values). After
the world_offset change the camera view_proj is in local space, so
projecting world-space grips through it gave wrong screen positions and
hit-test failures.
- refresh_selected_grips: subtract world_offset from every grip.world
so selected_grips are stored in local (camera) space
- Grip drag: cursor/snap positions are already local space; for
GripApply::Absolute add world_offset back before passing to entity
so entity coordinates stay in world space. Translate deltas are
identical in both spaces so no conversion is needed there.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
White paper fill was calculated from entity bounding boxes (paper_entity_extents),
so adding a viewport caused the paper to visually shrink to the viewport's bounds.
Now paper_limits() (layout min/max limits) is used directly, and the unused
paper_entity_extents() function is removed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- 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>
- 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>
Paper limits:
- Change A4 fallback from 12×9 to 297×210 mm in paper_limits()
Context menu:
- Translate layout context menu labels to English (Rename / Delete)
Viewport clipping:
- Replace AABB-only culling with proper Cohen-Sutherland line clipping
in viewport_content_wires(); each projected segment is now clipped at
the exact viewport boundary instead of being included or discarded whole
- Add cs_clip() and clip_polyline_to_rect() free functions in scene/mod.rs
Frozen layers per-viewport UI:
- Inject a "Frozen Layers" EditText property in the Properties panel for
viewport entities (layer names resolved from handles at display time)
- Handle "frozen_layers" in PropGeomCommit: parse comma-separated names,
resolve to layer handles, update vp.frozen_layers in-place
PDF export improvements:
- Add offset_x/offset_y params to export_pdf() for model-space normalization:
coordinates are shifted so the drawing origin maps to the page origin
- Model space export computes extents via model_space_extents() (now public)
and adds a 5 % margin; falls back to A4 landscape for empty drawings
- Skip __paper_boundary__ wire in PDF (white background covers it)
- Map yellow (active viewport border) → black and cyan (vp border) → dark
blue for print-friendly output
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add model_space_extents() to Scene: collects key_vertices from all
model-space entities to compute an AABB.
- Add auto_fit_viewport() to Scene: sets view_target to model centroid
and derives custom_scale / view_height so the content fits the new
viewport with a 10% margin.
- Call auto_fit_viewport() in commit_entity() after a viewport is added
to a paper-space layout, so newly placed viewports immediately show
model-space content at a sensible scale.
- Scale line_weight_px by the viewport scale factor when projecting
model-space wires into paper space, so dimension arrows and annotation
lines appear at the correct visual thickness.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Viewport ID uniqueness: commit_entity assigns max_existing_id+1
instead of always using id=2
- Lock/On boolean toggles in Properties panel (vp_locked, vp_on)
backed by status.locked / status.is_on fields
- Standard scale Choice picker: 1:500 to 10:1 (also syncs view_height)
- Numeric scale edit now syncs view_height when changed
- Standard view Choice picker: Top/Bottom/Front/Back/Left/Right/4×Iso
updates view_direction vector via apply_geom_prop
- Viewport content not rendered when status.is_on is false
- current_layout_block_handle_pub() added for external access
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>