Merge pull request #1793 from ramox81/codex/block-definition-command-line

Block Definition: command-line forms, block record data and dialog defaults

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-15 00:14:21 +03:00
commit 838e397a6c
23 files changed
+1860 -435

No files matched your search

+11 -3
View File
@@ -764,16 +764,21 @@ impl OpenCADStudio {
mut options: Box<crate::scene::CreateBlockOptions>,
) -> Option<Task<Message>> {
let i = self.active_tab;
// No objects at all defines an empty block; objects that were all on
// locked layers define nothing.
let picked = options.handles.len();
options
.handles
.retain(|handle| !self.tabs[i].scene.is_layer_locked(*handle));
if options.handles.is_empty() {
if picked > 0 && options.handles.is_empty() {
self.command_line
.push_info(crate::t!("No editable objects selected.").as_ref());
return Some(Task::none());
}
self.push_undo_snapshot(i, "BLOCK");
let name = options.name.clone();
let redefined = options.redefine
&& self.tabs[i].scene.document.block_records.get(&name).is_some();
match self.tabs[i].scene.create_block_with_options(*options) {
Ok(insert_handle) => {
self.tabs[i].dirty = true;
@@ -784,8 +789,11 @@ impl OpenCADStudio {
self.tabs[i].scene.clear_preview_wire();
self.tabs[i].active_cmd = None;
self.tabs[i].snap_result = None;
self.command_line
.push_output(crate::tf!("Block \"{name}\" created.").as_ref());
// A new definition is not reported; a redefinition is.
if redefined {
self.command_line
.push_output(&format!("Block \"{name}\" redefined"));
}
self.refresh_properties();
self.note_recent_block(&name);
self.refresh_block_palette();