forked from 1b-agent/opencadstudio-upstream
Merge upstream main; codec patch on the palette branch merged with it
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
commit
0b179a862e
48 files changed
+5131
-50
No files matched your search
@@ -137,6 +137,8 @@ impl OpenCADStudio {
|
||||
return Some("Open a block in the Block Editor before placing a parameter.");
|
||||
};
|
||||
match kind.to_ascii_uppercase().as_str() {
|
||||
"BASEPOINT"|"BASE"|"B" => crate::scene::block_basepoint::placement_error(&tab.scene.document,session.br_handle),
|
||||
"LOOKUP"|"K" => crate::scene::block_lookup::placement_error(&tab.scene.document,session.br_handle),
|
||||
"POINT" | "P" | "" => crate::scene::block_point_parameter::placement_error(
|
||||
&tab.scene.document,
|
||||
session.br_handle,
|
||||
@@ -151,7 +153,7 @@ impl OpenCADStudio {
|
||||
"VISIBILITY" | "V" => {
|
||||
visibility::placement_error(&tab.scene.document, session.br_handle)
|
||||
}
|
||||
_ => Some("Supported parameter types: Point, Linear, Polar, XY, Rotation, Alignment, Flip, Visibility."),
|
||||
_ => Some("Supported parameter types: Point, Linear, Polar, XY, Rotation, Alignment, Flip, Visibility, Lookup, Basepoint."),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,11 +391,38 @@ impl OpenCADStudio {
|
||||
return Some(Task::none());
|
||||
}
|
||||
match cmd {
|
||||
cmd if cmd == "BACTION"
|
||||
|| cmd.starts_with("BACTION ")
|
||||
|| cmd == "BACTIONTOOL"
|
||||
|| cmd.starts_with("BACTIONTOOL ") =>
|
||||
{
|
||||
Some(
|
||||
self.start_block_action(
|
||||
cmd.split_once(' ').map_or("", |(_, args)| args.trim()),
|
||||
),
|
||||
)
|
||||
}
|
||||
cmd if cmd == "BLOOKUPTABLE" || cmd.starts_with("BLOOKUPTABLE ") => {
|
||||
Some(self.open_lookup_table(cmd.strip_prefix("BLOOKUPTABLE").unwrap().trim()))
|
||||
}
|
||||
cmd if cmd == "BPARAMETER" || cmd.starts_with("BPARAMETER ") => {
|
||||
let Some(block) = self.visibility_block(i, "BPARAMETER") else {
|
||||
return Some(Task::none());
|
||||
};
|
||||
let parameter_type = cmd.strip_prefix("BPARAMETER").unwrap().trim();
|
||||
if let Some(kind) =
|
||||
crate::modules::block_editor::single_parameter::Kind::parse(parameter_type)
|
||||
{
|
||||
let command =
|
||||
crate::modules::block_editor::single_parameter::SingleParameterCommand::new(
|
||||
self.tabs[i].id,
|
||||
block,
|
||||
kind,
|
||||
);
|
||||
self.command_line.push_info(&command.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(command));
|
||||
return Some(Task::none());
|
||||
}
|
||||
if let Some(kind) =
|
||||
crate::scene::block_orientation_parameter::Kind::parse(parameter_type)
|
||||
{
|
||||
@@ -428,7 +457,7 @@ impl OpenCADStudio {
|
||||
{
|
||||
self.command_line.push_error(
|
||||
crate::t!(
|
||||
"Supported parameter types: Point, Linear, Polar, XY, Rotation, Alignment, Flip, Visibility."
|
||||
"Supported parameter types: Point, Linear, Polar, XY, Rotation, Alignment, Flip, Visibility, Lookup, Basepoint."
|
||||
)
|
||||
.as_ref(),
|
||||
);
|
||||
|
||||
@@ -174,6 +174,22 @@ impl OpenCADStudio {
|
||||
};
|
||||
let resolved = self.resolve_alias(cmd);
|
||||
let cmd = resolved.as_deref().unwrap_or(cmd);
|
||||
if matches!(cmd.split(' ').next(), Some("BACTION" | "BACTIONTOOL")) {
|
||||
let args = cmd.split_once(' ').map_or("", |(_, a)| a.trim());
|
||||
if !args.is_empty() && crate::scene::block_actions::Kind::parse(args).is_none() {
|
||||
self.command_line.push_error(
|
||||
crate::t!(
|
||||
"Supported actions: Move, Scale. Other action types are not wired yet."
|
||||
)
|
||||
.as_ref(),
|
||||
);
|
||||
return Task::none();
|
||||
}
|
||||
if let Some(error) = self.action_error(crate::scene::block_actions::Kind::parse(args)) {
|
||||
self.command_line.push_error(crate::t!(error).as_ref());
|
||||
return Task::none();
|
||||
}
|
||||
}
|
||||
if cmd == "BPARAMETER" || cmd.starts_with("BPARAMETER ") {
|
||||
if let Some(error) =
|
||||
self.parameter_placement_error(cmd.strip_prefix("BPARAMETER").unwrap().trim())
|
||||
@@ -182,6 +198,12 @@ impl OpenCADStudio {
|
||||
return Task::none();
|
||||
}
|
||||
}
|
||||
if cmd == "BLOOKUPTABLE" || cmd.starts_with("BLOOKUPTABLE ") {
|
||||
if let Some(error) = self.lookup_table_error() {
|
||||
self.command_line.push_error(crate::t!(error).as_ref());
|
||||
return Task::none();
|
||||
}
|
||||
}
|
||||
if self.tabs[i].block_test.is_some() {
|
||||
let name = cmd.split([' ', ':']).next().unwrap_or(cmd);
|
||||
if matches!(
|
||||
|
||||
Reference in new issue
Block a user