layers: LAYCUR moves the selected objects to the current layer

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-15 01:53:26 +03:00
1 parent 686fb71780
commit 2414721c14
4 files changed
+40 -1

No files matched your search

+37
View File
@@ -745,6 +745,43 @@ impl OpenCADStudio {
}
}
// LAYCUR: the selected objects move to the current layer.
"LAYCUR" => {
let handles: Vec<_> = self.tabs[i]
.scene
.selected_entities()
.into_iter()
.map(|(h, _)| h)
.collect();
if handles.is_empty() {
use crate::modules::draw::select::SelectObjectsCommand;
let cmd = SelectObjectsCommand::new("LAYCUR");
self.command_line.push_info(&cmd.prompt());
self.tabs[i].active_cmd = Some(Box::new(cmd));
} else {
let layer = self.tabs[i].scene.document.header.current_layer_name.clone();
let editable: Vec<_> = handles
.into_iter()
.filter(|handle| !self.tabs[i].scene.is_layer_locked(*handle))
.collect();
self.push_undo_snapshot(i, "LAYCUR");
for handle in &editable {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(*handle) {
entity.common_mut().layer = layer.clone();
}
}
// The new layer's ByLayer colour, linetype and lineweight
// show at once.
self.invalidate_property_targets(i, &editable);
self.tabs[i].dirty = true;
self.tabs[i].scene.deselect_all();
self.command_line.push_info(
crate::tf!("{} object(s) changed to layer \"{layer}\".", editable.len())
.as_ref(),
);
}
}
"LAYMATCH" | "LAYMCH" => {
use crate::modules::draw::layers::match_layer::LayMatchCommand;
let dest: Vec<_> = self.tabs[i]
+1
View File
@@ -384,6 +384,7 @@ fn command_selection_policy(name: &str) -> &'static str {
"GROUP",
"LAYFRZ",
"LAYLCK",
"LAYCUR",
"LAYMCUR",
"LAYOFF",
"LAYULK",
+1 -1
View File
@@ -82,5 +82,5 @@ impl CadCommand for LayMatchCommand {
// ── Autocomplete registry ─────────────────────────────────
inventory::submit!(crate::command::CommandRegistration {
names: &["LAYMATCH", "LAYMCH"]
names: &["LAYMATCH", "LAYMCH", "LAYCUR"]
}); // LayMatchCommand
+1
View File
@@ -379,6 +379,7 @@ inventory::submit!(crate::command::CommandRegistration {
"GROUP",
"LAYFRZ",
"LAYLCK",
"LAYCUR",
"LAYMCUR",
"LAYOFF",
"LAYULK",