feat: REFEDIT / REFCLOSE — in-place block reference editing

REFEDIT picks an INSERT, extracts the block entities into model space
with the INSERT transform applied (translate + rotate + uniform scale),
and enters an editing session.  Any normal modify command works on the
temporary entities.

REFCLOSE SAVE applies the inverse transform, replaces the block
definition, and rebuilds all derived caches (hatch/image/mesh), so
every INSERT of that block reflects the edits immediately.
REFCLOSE DISCARD removes the temp entities without changing the block.

Non-uniform-scale inserts are rejected with an error message.
RefEditSession is stored on DocumentTab; undo snapshots bracket the
begin and close operations.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Sonnet 4.6 committed 2026-04-08 12:40:19 +03:00
1 parent 42048362e2
commit a773a1a1f1
6 files changed
+442 -2

No files matched your search

+4
View File
@@ -4,6 +4,7 @@ use crate::command::CadCommand;
use crate::snap::SnapResult;
use crate::scene::grip::GripEdit;
use crate::scene::GripDef;
use crate::modules::home::modify::refedit::RefEditSession;
use acadrust::{CadDocument, Handle};
use acadrust::tables::Ucs;
use crate::linetypes;
@@ -37,6 +38,8 @@ pub(super) struct DocumentTab {
pub(super) bg_color: Option<[f32; 4]>,
/// Custom paper-space background color. `None` = default off-white grey.
pub(super) paper_bg_color: Option<[f32; 4]>,
/// Active REFEDIT session, if any.
pub(super) refedit_session: Option<RefEditSession>,
}
impl DocumentTab {
@@ -65,6 +68,7 @@ impl DocumentTab {
active_ucs: None,
bg_color: None,
paper_bg_color: None,
refedit_session: None,
}
}