forked from 1b-agent/opencadstudio-upstream
fix(commands): ADDSELECTED keeps CLAYER, adopts dimension style (#239)
Two follow-ups to ADDSELECTED: - It no longer permanently changes the current layer/colour/linetype/ lineweight. The template's properties are captured as the drawing defaults only while the launched draw command runs; a snapshot taken in cmd_add_selected is restored the moment that command ends (central hook in apply_cmd_result) or is interrupted by another command. - Dimensions are supported: add_selected_verb maps each DimensionType to its DIM* command, and the template's dimension style is adopted as the current DIMSTYLE (restored afterwards). commit_entity_handle now stamps every new dimension with the current DIMSTYLE — the DIM commands left the default "Standard" on the entity, so a normal dimension also picks up the active style now. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
f9b6834ad9
commit
5e4e7c1020
5 files changed
+145
-4
No files matched your search
@@ -667,6 +667,22 @@ impl OpenCADStudio {
|
||||
entity.as_entity_mut().set_layer(layer.clone());
|
||||
}
|
||||
|
||||
// A new dimension adopts the current dimension style (DIMSTYLE), like
|
||||
// AutoCAD — the DIM commands leave the default "Standard" on the entity,
|
||||
// so stamp the header's current style here. ADDSELECTED sets DIMSTYLE to
|
||||
// the template's first, so a cloned dimension keeps its style (#239).
|
||||
if let acadrust::EntityType::Dimension(ref mut d) = entity {
|
||||
let cur = self.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.header
|
||||
.current_dimstyle_name
|
||||
.clone();
|
||||
if !cur.trim().is_empty() {
|
||||
d.base_mut().style_name = cur;
|
||||
}
|
||||
}
|
||||
|
||||
// INSUNITS: when inserting a block whose BlockRecord.units differ
|
||||
// from the host's header.insertion_units, scale the new INSERT so
|
||||
// 1 source-unit equals the matching host length. When either side
|
||||
|
||||
Reference in new issue
Block a user