feat(dimstyle): block/linetype Handle cyclers for arrowheads & ext lines

The arrowhead-block (DIMBLK/DIMBLK1/DIMBLK2/DIMLDRBLK) and ext-line
linetype (DIMLTYPE/DIMLTEX1/DIMLTEX2) Handle fields are now editable in
the Dimension Style manager. Each shows the resolved block-record /
linetype name and a Cycle button that advances through the available
records (NULL = Default arrowhead / ByBlock linetype). Edits bump
geometry so dimensions re-render with the new arrowheads/linetypes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-03 20:34:09 +03:00
1 parent df44031ae8
commit 1b7edf6cae
4 files changed
+132

No files matched your search

+47
View File
@@ -6534,6 +6534,53 @@ impl OpenCADStudio {
self.apply_ds_toggle(field);
Task::none()
}
Message::DsCycleHandle(field) => {
let i = self.active_tab;
let name = self.dimstyle_selected.clone();
let is_lt = matches!(
field,
"dimltex_handle" | "dimltex1_handle" | "dimltex2_handle"
);
let doc = &self.tabs[i].scene.document;
let mut candidates: Vec<acadrust::types::Handle> =
vec![acadrust::types::Handle::NULL];
if is_lt {
candidates.extend(doc.line_types.iter().map(|lt| lt.handle));
} else {
candidates.extend(doc.block_records.iter().map(|b| b.handle));
}
let Some(ds) = doc.dim_styles.get(&name) else {
return Task::none();
};
let cur = match field {
"dimblk" => ds.dimblk,
"dimblk1" => ds.dimblk1,
"dimblk2" => ds.dimblk2,
"dimldrblk" => ds.dimldrblk,
"dimltex_handle" => ds.dimltex_handle,
"dimltex1_handle" => ds.dimltex1_handle,
"dimltex2_handle" => ds.dimltex2_handle,
_ => return Task::none(),
};
let idx = candidates.iter().position(|h| *h == cur).unwrap_or(0);
let next = candidates[(idx + 1) % candidates.len()];
self.push_undo_snapshot(i, "DIMSTYLE EDIT");
if let Some(ds) = self.tabs[i].scene.document.dim_styles.get_mut(&name) {
match field {
"dimblk" => ds.dimblk = next,
"dimblk1" => ds.dimblk1 = next,
"dimblk2" => ds.dimblk2 = next,
"dimldrblk" => ds.dimldrblk = next,
"dimltex_handle" => ds.dimltex_handle = next,
"dimltex1_handle" => ds.dimltex1_handle = next,
"dimltex2_handle" => ds.dimltex2_handle = next,
_ => {}
}
}
self.tabs[i].dirty = true;
self.tabs[i].scene.bump_geometry();
Task::none()
}
}
}
}