forked from 1b-agent/opencadstudio-upstream
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:
1 parent
686fb71780
commit
2414721c14
4 files changed
+40
-1
No files matched your search
@@ -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]
|
||||
|
||||
@@ -384,6 +384,7 @@ fn command_selection_policy(name: &str) -> &'static str {
|
||||
"GROUP",
|
||||
"LAYFRZ",
|
||||
"LAYLCK",
|
||||
"LAYCUR",
|
||||
"LAYMCUR",
|
||||
"LAYOFF",
|
||||
"LAYULK",
|
||||
|
||||
@@ -82,5 +82,5 @@ impl CadCommand for LayMatchCommand {
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration {
|
||||
names: &["LAYMATCH", "LAYMCH"]
|
||||
names: &["LAYMATCH", "LAYMCH", "LAYCUR"]
|
||||
}); // LayMatchCommand
|
||||
@@ -379,6 +379,7 @@ inventory::submit!(crate::command::CommandRegistration {
|
||||
"GROUP",
|
||||
"LAYFRZ",
|
||||
"LAYLCK",
|
||||
"LAYCUR",
|
||||
"LAYMCUR",
|
||||
"LAYOFF",
|
||||
"LAYULK",
|
||||
|
||||
Reference in new issue
Block a user