forked from 1b-agent/opencadstudio-upstream
feat(alias): centralize command aliases in user-editable ocad.pgp (#286/#288)
Command aliases (L→LINE, CC→COPYCLIP) were scattered across dispatch match arms and CommandRegistration name arrays. Move them all into a single user-editable file: - assets/ocad.pgp: shipped default alias table (ALIAS,*COMMAND format), embedded and copied to config/ocad.pgp on first launch; only that user copy is read after. AA→AREA default closes #286. - resolve_alias() rewrites the leading command token at the top of dispatch_command_inner, so aliases resolve for every path (families, plugins, Repeat menu). Args after the first space are untouched. - Autocomplete hides alias keys and, when the whole input is an alias, surfaces its target command as the top (highlighted) suggestion so the highlight matches what Enter runs (AA→AREA, L→LINE). - ALIASEDIT opens a new editor modal (add/edit/delete rows) with an Apply button; Apply persists to ocad.pgp, closing discards unapplied edits. - Strip alias tokens from all 8 dispatch match-arm files and 71 module CommandRegistration arrays, keeping canonical/synonym/distinct-command names. ocad.pgp is now the sole source: deleting or remapping an alias there takes effect. CUI stays on the keyboard-shortcut panel. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
f5b8a7d993
commit
91ba9f7699
69 files changed
+767
-164
No files matched your search
@@ -53,7 +53,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"COPYCLIP" | "CC" => {
|
||||
"COPYCLIP" => {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
@@ -142,7 +142,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"CUTCLIP" | "CX" => {
|
||||
"CUTCLIP" => {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
@@ -179,7 +179,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"PASTECLIP" | "PC" => {
|
||||
"PASTECLIP" => {
|
||||
if self.clipboard.is_empty() {
|
||||
self.command_line.push_error("Clipboard is empty.");
|
||||
} else {
|
||||
@@ -386,7 +386,7 @@ impl OpenCADStudio {
|
||||
// ADCENTER / CONTENTBROWSER — report the drawing's named content
|
||||
// (blocks and layers) from the command line in place of the browser
|
||||
// panel.
|
||||
"ADCENTER" | "CONTENTBROWSER" | "ADC" => {
|
||||
"ADCENTER" | "CONTENTBROWSER" => {
|
||||
let blocks = self.tabs[i].scene.custom_block_names();
|
||||
let layers: Vec<String> = self.tabs[i]
|
||||
.scene
|
||||
@@ -476,7 +476,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"XATTACH" | "XA" => {
|
||||
"XATTACH" => {
|
||||
// Launch the file picker; XAttachPickResult will start the command.
|
||||
return Some(Task::done(Message::XAttachPick));
|
||||
}
|
||||
@@ -498,7 +498,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"XREF" | "XR" => {
|
||||
"XREF" => {
|
||||
// List all xref blocks in the current drawing.
|
||||
let xrefs: Vec<String> = self.tabs[i]
|
||||
.scene
|
||||
|
||||
+29
-29
@@ -3,42 +3,42 @@ use super::*;
|
||||
impl OpenCADStudio {
|
||||
pub(super) fn dispatch_dim(&mut self, cmd: &str, i: usize) -> Option<Task<Message>> {
|
||||
match cmd {
|
||||
"DIMALIGNED" | "DAL" => {
|
||||
"DIMALIGNED" => {
|
||||
use crate::modules::annotate::aligned_dim::AlignedDimensionCommand;
|
||||
let cmd = AlignedDimensionCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"DIMDIAMETER" | "DDI" => {
|
||||
"DIMDIAMETER" => {
|
||||
use crate::modules::annotate::diameter_dim::DiameterDimensionCommand;
|
||||
let cmd = DiameterDimensionCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"DIMLINEAR" | "DLI" => {
|
||||
"DIMLINEAR" => {
|
||||
use crate::modules::annotate::linear_dim::LinearDimensionCommand;
|
||||
let new_cmd = LinearDimensionCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"DIMRADIUS" | "DRA" => {
|
||||
"DIMRADIUS" => {
|
||||
use crate::modules::annotate::radius_dim::RadiusDimensionCommand;
|
||||
let new_cmd = RadiusDimensionCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"DIMANGULAR" | "DAN" => {
|
||||
"DIMANGULAR" => {
|
||||
use crate::modules::annotate::angular_dim::AngularDimensionCommand;
|
||||
let new_cmd = AngularDimensionCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"DIMORDINATE" | "DOR" => {
|
||||
"DIMORDINATE" => {
|
||||
use crate::modules::annotate::ordinate_dim::OrdinateDimCommand;
|
||||
let new_cmd = OrdinateDimCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
@@ -47,7 +47,7 @@ impl OpenCADStudio {
|
||||
|
||||
// LEADER draws a leader line with an annotation; QLEADER is the same
|
||||
// quick leader-plus-annotation operation.
|
||||
"LEADER" | "LE" | "QLEADER" | "QL" => {
|
||||
"LEADER" | "QLEADER" => {
|
||||
use crate::modules::annotate::leader_cmd::LeaderCommand;
|
||||
let new_cmd = LeaderCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
@@ -400,14 +400,14 @@ impl OpenCADStudio {
|
||||
));
|
||||
}
|
||||
|
||||
"MLEADER" | "MLD" => {
|
||||
"MLEADER" => {
|
||||
use crate::modules::annotate::mleader_cmd::MLeaderCommand;
|
||||
let new_cmd = MLeaderCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"TOLERANCE" | "TOL" => {
|
||||
"TOLERANCE" => {
|
||||
use crate::modules::annotate::tolerance_cmd::ToleranceCommand;
|
||||
let cmd = ToleranceCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
@@ -421,7 +421,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"DIMCONTINUE" | "DCO" => {
|
||||
"DIMCONTINUE" => {
|
||||
use crate::modules::annotate::dim_continue::DimContinueCommand;
|
||||
let cmd = if let Some((p1, p2, dp, rot, trot)) =
|
||||
find_last_linear_dim(&self.tabs[i].scene)
|
||||
@@ -434,7 +434,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"DIMBASELINE" | "DBA" => {
|
||||
"DIMBASELINE" => {
|
||||
use crate::modules::annotate::dim_baseline::DimBaselineCommand;
|
||||
let cmd = if let Some((p1, p2, dp, rot, trot)) =
|
||||
find_last_linear_dim(&self.tabs[i].scene)
|
||||
@@ -548,7 +548,7 @@ impl OpenCADStudio {
|
||||
return Some(Task::none());
|
||||
}
|
||||
|
||||
"DIMEDIT" | "DED" => {
|
||||
"DIMEDIT" => {
|
||||
use crate::modules::annotate::dimedit::DimEditCommand;
|
||||
let cmd = DimEditCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
@@ -562,7 +562,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"DIMBREAK" | "DBR" => {
|
||||
"DIMBREAK" => {
|
||||
use crate::modules::annotate::dimbreak::DimBreakCommand;
|
||||
let cmd = DimBreakCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
@@ -576,35 +576,35 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"DIMJOGLINE" | "DJL" => {
|
||||
"DIMJOGLINE" => {
|
||||
use crate::modules::annotate::dimjogline::DimJogLineCommand;
|
||||
let cmd = DimJogLineCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"MLEADERADD" | "MLA" => {
|
||||
"MLEADERADD" => {
|
||||
use crate::modules::annotate::mleader_edit::MLeaderAddCommand;
|
||||
let cmd = MLeaderAddCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"MLEADERREMOVE" | "MLR" => {
|
||||
"MLEADERREMOVE" => {
|
||||
use crate::modules::annotate::mleader_edit::MLeaderRemoveCommand;
|
||||
let cmd = MLeaderRemoveCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"MLEADERALIGN" | "MLAL" => {
|
||||
"MLEADERALIGN" => {
|
||||
use crate::modules::annotate::mleader_edit::MLeaderAlignCommand;
|
||||
let cmd = MLeaderAlignCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"MLEADERCOLLECT" | "MLC" => {
|
||||
"MLEADERCOLLECT" => {
|
||||
use crate::modules::annotate::mleader_edit::MLeaderCollectCommand;
|
||||
let cmd = MLeaderCollectCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
@@ -647,14 +647,14 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"PLOTWINDOW" | "PW" => {
|
||||
"PLOTWINDOW" => {
|
||||
use crate::modules::view::plot_window::PlotWindowCommand;
|
||||
let cmd = PlotWindowCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"QUICKPRINT" | "QP" => {
|
||||
"QUICKPRINT" => {
|
||||
use crate::modules::view::quick_print::QuickPrintCommand;
|
||||
let cmd = QuickPrintCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
@@ -671,7 +671,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"STRETCH" | "SS" => {
|
||||
"STRETCH" => {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
@@ -692,7 +692,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"FILLET" | "F" => {
|
||||
"FILLET" => {
|
||||
use crate::modules::draw::modify::fillet::FilletCommand;
|
||||
let entities: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
@@ -717,7 +717,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"ARRAY" | "AR" | "ARRAYRECT" => {
|
||||
"ARRAY" | "ARRAYRECT" => {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
@@ -809,7 +809,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"CHAMFER" | "CHA" => {
|
||||
"CHAMFER" => {
|
||||
use crate::modules::draw::modify::fillet::ChamferCommand;
|
||||
let entities: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
@@ -834,7 +834,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"EXPLODE" | "X" => {
|
||||
"EXPLODE" => {
|
||||
use crate::modules::draw::modify::explode::explode_entity;
|
||||
let entities: Vec<_> = self.tabs[i].scene.selected_entities().into_iter().collect();
|
||||
if entities.is_empty() {
|
||||
@@ -876,7 +876,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"OFFSET" | "O" => {
|
||||
"OFFSET" => {
|
||||
use crate::modules::draw::modify::offset::OffsetCommand;
|
||||
let all_entities: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
@@ -892,7 +892,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"TRIM" | "TR" => {
|
||||
"TRIM" => {
|
||||
use crate::modules::draw::modify::trim::TrimCommand;
|
||||
let entities: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
@@ -930,7 +930,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"EXTEND" | "EX" => {
|
||||
"EXTEND" => {
|
||||
use crate::modules::draw::modify::trim::ExtendCommand;
|
||||
let entities: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
@@ -955,7 +955,7 @@ impl OpenCADStudio {
|
||||
// DIMJOGGED <DJO> — create a jogged radius dimension on the selected
|
||||
// arc/circle: a standard radius dim carrying an OCS_JOGGED XData marker
|
||||
// that the geometry generator renders with a foreshortened zig-zag.
|
||||
"DIMJOGGED" | "DJO" | "DIMJOG" => {
|
||||
"DIMJOGGED" | "DIMJOG" => {
|
||||
use acadrust::entities::{Dimension, DimensionRadius};
|
||||
use acadrust::types::Vector3;
|
||||
use acadrust::xdata::{ExtendedDataRecord, XDataValue};
|
||||
|
||||
@@ -5,7 +5,7 @@ impl OpenCADStudio {
|
||||
match cmd {
|
||||
// Interactive pan: left-drag pans the view until Esc. The only pan
|
||||
// path when there is no middle mouse button (trackpad / web).
|
||||
"PAN" | "P" => {
|
||||
"PAN" => {
|
||||
self.tabs[i].pan_mode = true;
|
||||
self.command_line
|
||||
.push_output("PAN: drag with the left mouse button. Press Esc to exit.");
|
||||
@@ -126,7 +126,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
// ── PROPERTIES — toggle Properties panel visibility ──────────────────
|
||||
"PROPERTIES" | "PR" | "PROPS" => {
|
||||
"PROPERTIES" | "PROPS" => {
|
||||
return Some(Task::done(Message::ToggleProperties));
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ impl OpenCADStudio {
|
||||
return Some(Task::done(Message::ToggleSnapPopup));
|
||||
}
|
||||
// UNITS — open the drawing-units picker (linear / angular format).
|
||||
"UNITS" | "UN" | "DDUNITS" => {
|
||||
"UNITS" | "DDUNITS" => {
|
||||
return Some(Task::done(Message::ToggleUnitsPopup));
|
||||
}
|
||||
|
||||
@@ -174,13 +174,13 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
// ── TOOLPALETTES — not yet implemented ───────────────────────────────
|
||||
"TOOLPALETTES" | "TP" => {
|
||||
"TOOLPALETTES" => {
|
||||
self.command_line
|
||||
.push_info("TOOLPALETTES: Tool Palettes not yet implemented.");
|
||||
}
|
||||
|
||||
// ── SHEETSET — not yet implemented ───────────────────────────────────
|
||||
"SHEETSET" | "SSM" => {
|
||||
"SHEETSET" => {
|
||||
self.command_line
|
||||
.push_info("SHEETSET: Sheet Set Manager not yet implemented.");
|
||||
}
|
||||
@@ -292,7 +292,7 @@ impl OpenCADStudio {
|
||||
// PRESSPULL on a closed boundary creates a solid by extruding it to a
|
||||
// height — the same operation as EXTRUDE. THICKEN turns a closed planar
|
||||
// profile into a solid of the given thickness, which is also an extrude.
|
||||
"EXTRUDE" | "EXT" | "PRESSPULL" | "THICKEN" => {
|
||||
"EXTRUDE" | "PRESSPULL" | "THICKEN" => {
|
||||
use crate::modules::insert::solid3d_cmds::ExtrudeCommand;
|
||||
// If a single entity is already selected, skip the pick step.
|
||||
let selected: Vec<_> = self.tabs[i].scene.selected_entities().into_iter().collect();
|
||||
@@ -311,7 +311,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
// ── REVOLVE ────────────────────────────────────────────────────
|
||||
"REVOLVE" | "REV" => {
|
||||
"REVOLVE" => {
|
||||
use crate::modules::insert::solid3d_cmds::RevolveCommand;
|
||||
let color = self.tabs[i].scene.layer_color(&self.tabs[i].active_layer);
|
||||
let cmd = RevolveCommand::new(color);
|
||||
|
||||
+27
-27
@@ -4,14 +4,14 @@ impl OpenCADStudio {
|
||||
pub(super) fn dispatch_draw(&mut self, cmd: &str, i: usize) -> Option<Task<Message>> {
|
||||
match cmd {
|
||||
// ── Draw commands ──────────────────────────────────────────────
|
||||
"LINE" | "L" => {
|
||||
"LINE" => {
|
||||
use crate::modules::draw::draw::line::LineCommand;
|
||||
let new_cmd = LineCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"MLINE" | "ML" => {
|
||||
"MLINE" => {
|
||||
use crate::modules::draw::draw::mline::MlineCommand;
|
||||
let style = self.tabs[i].scene.document.header.multiline_style.clone();
|
||||
let cmd_obj = MlineCommand::with_style(style);
|
||||
@@ -184,14 +184,14 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"DONUT" | "DO" => {
|
||||
"DONUT" => {
|
||||
use crate::modules::draw::draw::donut::DonutCommand;
|
||||
let cmd = DonutCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"CIRCLE" | "C" => {
|
||||
"CIRCLE" => {
|
||||
use crate::modules::draw::draw::circle::CircleCommand;
|
||||
let new_cmd = CircleCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
@@ -232,7 +232,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"ARC" | "A" => {
|
||||
"ARC" => {
|
||||
use crate::modules::draw::draw::arc::ArcCommand;
|
||||
let new_cmd = ArcCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
@@ -318,7 +318,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"RECT" | "RECTANG" | "REC" => {
|
||||
"RECT" | "RECTANG" => {
|
||||
use crate::modules::draw::draw::shapes::RectCommand;
|
||||
let new_cmd = RectCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
@@ -348,7 +348,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
"POLY" | "POLYGON" | "POL" => {
|
||||
"POLY" | "POLYGON" => {
|
||||
use crate::modules::draw::draw::shapes::PolyCommand;
|
||||
let new_cmd = PolyCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
@@ -367,7 +367,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"PLINE" | "PL" => {
|
||||
"PLINE" => {
|
||||
use crate::modules::draw::draw::polyline::PlineCommand;
|
||||
let new_cmd = PlineCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
@@ -383,7 +383,7 @@ impl OpenCADStudio {
|
||||
|
||||
// 2D filled solid. Reached via SO / SOLID2D — the bare SOLID verb is
|
||||
// currently the shaded-display toggle (token collision tracked).
|
||||
"SO" | "SOLID" | "SOLID2D" => {
|
||||
"SOLID" | "SOLID2D" => {
|
||||
use crate::modules::draw::draw::solid2d::Solid2dCommand;
|
||||
let new_cmd = Solid2dCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
@@ -411,7 +411,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"DIMCENTER" | "DCE" | "CENTERMARK" => {
|
||||
"DIMCENTER" | "CENTERMARK" => {
|
||||
use crate::modules::draw::draw::dimcenter::DimCenterCommand;
|
||||
let new_cmd = DimCenterCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
@@ -432,7 +432,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"MEASUREGEOM" | "MEA" => {
|
||||
"MEASUREGEOM" => {
|
||||
use crate::modules::draw::inquiry::measuregeom::MeasureGeomCommand;
|
||||
let new_cmd = MeasureGeomCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
@@ -442,7 +442,7 @@ impl OpenCADStudio {
|
||||
// ── Modify commands ────────────────────────────────────────────
|
||||
// MOVE works from picked points, so it already relocates entities
|
||||
// in 3D; 3DMOVE is the same operation.
|
||||
"MOVE" | "M" | "3DMOVE" => {
|
||||
"MOVE" | "3DMOVE" => {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
@@ -463,7 +463,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"COPY" | "CO" => {
|
||||
"COPY" => {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
@@ -484,7 +484,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"ROTATE" | "RO" => {
|
||||
"ROTATE" => {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
@@ -539,7 +539,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"POINT" | "PO" => {
|
||||
"POINT" => {
|
||||
use crate::modules::draw::draw::point::PointCommand;
|
||||
let new_cmd = PointCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
@@ -553,14 +553,14 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"XLINE" | "XL" | "CONSTRUCTIONLINE" => {
|
||||
"XLINE" | "CONSTRUCTIONLINE" => {
|
||||
use crate::modules::draw::draw::ray::XLineCommand;
|
||||
let new_cmd = XLineCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"HATCH" | "H" => {
|
||||
"HATCH" => {
|
||||
use crate::modules::draw::draw::hatch::HatchCommand;
|
||||
let outlines = self.tabs[i].scene.closed_outlines();
|
||||
let new_cmd = HatchCommand::new(outlines);
|
||||
@@ -568,7 +568,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"HATCHEDIT" | "HE" => {
|
||||
"HATCHEDIT" => {
|
||||
use crate::modules::draw::draw::hatchedit::HatcheditCommand;
|
||||
// If a single hatch is already selected, skip the pick step.
|
||||
let sel = self.tabs[i].scene.selected_entities();
|
||||
@@ -610,7 +610,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"ELLIPSE" | "EL" => {
|
||||
"ELLIPSE" => {
|
||||
use crate::modules::draw::draw::ellipse::EllipseCommand;
|
||||
let new_cmd = EllipseCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
@@ -631,14 +631,14 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"SPLINE" | "SPL" => {
|
||||
"SPLINE" => {
|
||||
use crate::modules::draw::draw::spline::SplineCommand;
|
||||
let new_cmd = SplineCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"SCALE" | "SC" => {
|
||||
"SCALE" => {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
@@ -659,7 +659,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"MIRROR" | "MI" => {
|
||||
"MIRROR" => {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
@@ -682,7 +682,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"ERASE" | "E" => {
|
||||
"ERASE" => {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
@@ -727,7 +727,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
// INTERFERE — non-destructive intersect: solid from the overlap.
|
||||
"INTERFERE" | "INF" => {
|
||||
"INTERFERE" => {
|
||||
return Some(self.solid_interfere());
|
||||
}
|
||||
|
||||
@@ -963,14 +963,14 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
// ── Annotate commands ──────────────────────────────────────────
|
||||
"TEXT" | "T" | "DT" => {
|
||||
"TEXT" => {
|
||||
use crate::modules::annotate::text::TextCommand;
|
||||
let new_cmd = TextCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"DDEDIT" | "ED" => {
|
||||
"DDEDIT" => {
|
||||
use crate::modules::annotate::ddedit::DdeditCommand;
|
||||
// A single text entity already selected opens its in-place
|
||||
// editor directly; otherwise prompt for a pick.
|
||||
@@ -994,7 +994,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"MTEXT" | "MT" => {
|
||||
"MTEXT" => {
|
||||
use crate::modules::annotate::mtext::MTextCommand;
|
||||
let new_cmd = MTextCommand::new();
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
|
||||
@@ -70,7 +70,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
}
|
||||
"UNDO" | "U" => return Some(Task::done(Message::Undo)),
|
||||
"UNDO" => return Some(Task::done(Message::Undo)),
|
||||
"REDO" => return Some(Task::done(Message::Redo)),
|
||||
// OOPS — restore the objects removed by the most recent ERASE,
|
||||
// without undoing any work done since.
|
||||
@@ -92,7 +92,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
"CLEAR" | "CLR" => return Some(Task::done(Message::ClearScene)),
|
||||
"WIREFRAME" | "VW" => return Some(Task::done(Message::SetWireframe(true))),
|
||||
"WIREFRAME" => return Some(Task::done(Message::SetWireframe(true))),
|
||||
// Visual-style commands. OCS renders either a wireframe or a shaded
|
||||
// view; the named styles map onto the closest of the two and the
|
||||
// chosen style is reported so the mapping is explicit. (`SOLID` is
|
||||
@@ -309,7 +309,7 @@ impl OpenCADStudio {
|
||||
"ORTHO" => return Some(Task::done(Message::ToggleOrtho)),
|
||||
"PARALLEL" => return Some(Task::done(Message::SetProjection(true))),
|
||||
"PERSP" => return Some(Task::done(Message::SetProjection(false))),
|
||||
"LAYERS" | "LA" => return Some(Task::done(Message::ToggleLayers)),
|
||||
"LAYERS" => return Some(Task::done(Message::ToggleLayers)),
|
||||
|
||||
// SCRIPT <path> — run a command script: each non-blank, non-comment
|
||||
// line is fed through the same command path the `--script` startup
|
||||
|
||||
+16
-16
@@ -3,13 +3,13 @@ use super::*;
|
||||
impl OpenCADStudio {
|
||||
pub(super) fn dispatch_inquiry(&mut self, cmd: &str, i: usize) -> Option<Task<Message>> {
|
||||
match cmd {
|
||||
"3DORBIT" | "3O" => {
|
||||
"3DORBIT" => {
|
||||
self.command_line
|
||||
.push_info("3D Orbit: drag with right mouse button.");
|
||||
}
|
||||
|
||||
// ── Selection utilities ───────────────────────────────────────
|
||||
"SELECTALL" | "SA" => {
|
||||
"SELECTALL" => {
|
||||
use crate::scene::Scene;
|
||||
let handles: Vec<acadrust::Handle> = self.tabs[i]
|
||||
.scene
|
||||
@@ -28,7 +28,7 @@ impl OpenCADStudio {
|
||||
self.refresh_properties();
|
||||
}
|
||||
|
||||
"DESELECT" | "DE" | "DESELALL" => {
|
||||
"DESELECT" | "DESELALL" => {
|
||||
self.tabs[i].scene.deselect_all();
|
||||
self.command_line.push_output("Deselected.");
|
||||
self.refresh_properties();
|
||||
@@ -49,7 +49,7 @@ impl OpenCADStudio {
|
||||
|
||||
// QSELECT builds a selection set by object type / property; FILTER is
|
||||
// the same criteria-based selection.
|
||||
"QSELECT" | "QS" | "FILTER" | "FI" => {
|
||||
"QSELECT" | "FILTER" => {
|
||||
return Some(Task::done(Message::QSelectOpen));
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
// ── LIST — entity info ────────────────────────────────────────
|
||||
"LIST" | "LI" => {
|
||||
"LIST" => {
|
||||
let selected: Vec<_> = self.tabs[i].scene.selected_entities();
|
||||
if selected.is_empty() {
|
||||
self.command_line
|
||||
@@ -218,35 +218,35 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
// ── Break / Join ─────────────────────────────────────────────────
|
||||
"JOIN" | "J" => {
|
||||
"JOIN" => {
|
||||
use crate::modules::draw::modify::join::JoinCommand;
|
||||
let cmd = JoinCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"BREAK" | "BR" => {
|
||||
"BREAK" => {
|
||||
use crate::modules::draw::modify::break_cmd::BreakInteractiveCommand;
|
||||
let cmd = BreakInteractiveCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"BREAKATPOINT" | "BAP" => {
|
||||
"BREAKATPOINT" => {
|
||||
use crate::modules::draw::modify::break_cmd::BreakAtPointCommand;
|
||||
let cmd = BreakAtPointCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"PEDIT" | "PE" => {
|
||||
"PEDIT" => {
|
||||
use crate::modules::draw::modify::pedit::PeditCommand;
|
||||
let cmd_obj = PeditCommand::new();
|
||||
self.command_line.push_info(&cmd_obj.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd_obj));
|
||||
}
|
||||
|
||||
"SPLINEDIT" | "SPE" => {
|
||||
"SPLINEDIT" => {
|
||||
use crate::modules::draw::modify::splinedit::SplineditCommand;
|
||||
let cmd_obj = SplineditCommand::new();
|
||||
self.command_line.push_info(&cmd_obj.prompt());
|
||||
@@ -257,7 +257,7 @@ impl OpenCADStudio {
|
||||
// If a single block with attributes is already selected it opens on
|
||||
// that block; otherwise the pick command runs and the editor opens
|
||||
// once a block is chosen (see `command_driver`).
|
||||
"ATTEDIT" | "ATE" => {
|
||||
"ATTEDIT" => {
|
||||
let selected_attr_insert = {
|
||||
let sel = self.tabs[i].scene.selected_entities();
|
||||
if sel.len() == 1 {
|
||||
@@ -547,28 +547,28 @@ impl OpenCADStudio {
|
||||
.push_output("REFCLOSE: Changes discarded.");
|
||||
}
|
||||
|
||||
"ALIGN" | "AL" => {
|
||||
"ALIGN" => {
|
||||
use crate::modules::draw::modify::align::AlignCommand;
|
||||
let cmd = AlignCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"LENGTHEN" | "LEN" => {
|
||||
"LENGTHEN" => {
|
||||
use crate::modules::draw::modify::lengthen::LengthenCommand;
|
||||
let cmd = LengthenCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"DIVIDE" | "DIV" => {
|
||||
"DIVIDE" => {
|
||||
use crate::modules::draw::inquiry::divide::DivideCommand;
|
||||
let cmd = DivideCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"MEASURE" | "ME" => {
|
||||
"MEASURE" => {
|
||||
use crate::modules::draw::inquiry::divide::MeasureCommand;
|
||||
let cmd = MeasureCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
@@ -576,7 +576,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
// ── Inquiry ──────────────────────────────────────────────────────
|
||||
"DIST" | "DI" => {
|
||||
"DIST" => {
|
||||
use crate::modules::draw::inquiry::dist::DistCommand;
|
||||
let cmd = DistCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
|
||||
@@ -510,7 +510,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"MATCHPROP" | "MA" => {
|
||||
"MATCHPROP" => {
|
||||
use crate::modules::draw::properties::match_prop::MatchPropCommand;
|
||||
self.tabs[i].scene.deselect_all();
|
||||
let cmd = MatchPropCommand::new();
|
||||
@@ -518,7 +518,7 @@ impl OpenCADStudio {
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"GROUP" | "G" => {
|
||||
"GROUP" => {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
@@ -540,7 +540,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"UNGROUP" | "UG" => {
|
||||
"UNGROUP" => {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
|
||||
@@ -59,6 +59,12 @@ impl OpenCADStudio {
|
||||
|
||||
fn dispatch_command_inner(&mut self, cmd: &str, allow_suggest: bool) -> Task<Message> {
|
||||
let i = self.active_tab;
|
||||
// Expand a command alias ("L" → "LINE") on the leading token before any
|
||||
// routing, so every path below (Start-tab gate, plugins, all dispatch
|
||||
// families, the Repeat menu) sees the canonical command. Arguments after
|
||||
// the first space are left untouched. A non-alias passes through as-is.
|
||||
let resolved = self.resolve_alias(cmd);
|
||||
let cmd = resolved.as_deref().unwrap_or(cmd);
|
||||
// Starting a command closes any open ribbon dropdown (e.g. a style
|
||||
// combo left open) so it does not stay stuck behind the new tool.
|
||||
self.ribbon.close_dropdown();
|
||||
@@ -151,6 +157,7 @@ impl OpenCADStudio {
|
||||
if let Some(top) = crate::ui::command_line::ranked_matches(
|
||||
cmd,
|
||||
&self.command_line.dynamic_commands,
|
||||
&self.command_line.command_aliases,
|
||||
)
|
||||
.into_iter()
|
||||
.next()
|
||||
|
||||
@@ -208,10 +208,15 @@ impl OpenCADStudio {
|
||||
self.command_line.push_info("Opening release notes...");
|
||||
}
|
||||
|
||||
// ── CUI / ALIASEDIT — customization entry points ───────────────
|
||||
// Command-alias and key-binding editing lives in the keyboard
|
||||
// shortcuts panel, so route the customization verbs there.
|
||||
"CUI" | "ALIASEDIT" => {
|
||||
// ── ALIASEDIT — command-alias editor ───────────────────────────
|
||||
// Opens the command-alias table editor (ocad.pgp). Keyboard
|
||||
// key-bindings are edited separately via CUI (below).
|
||||
"ALIASEDIT" => {
|
||||
return Some(Task::done(Message::AliasEditorOpen));
|
||||
}
|
||||
|
||||
// ── CUI — keyboard shortcut / key-binding editor ───────────────
|
||||
"CUI" => {
|
||||
return Some(Task::done(Message::ShortcutsPanelOpen));
|
||||
}
|
||||
|
||||
@@ -380,7 +385,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
// ── Layout / viewport ──────────────────────────────────────────
|
||||
"MVIEW" | "MV" => {
|
||||
"MVIEW" => {
|
||||
if self.tabs[i].scene.current_layout == "Model" {
|
||||
self.command_line
|
||||
.push_error("MVIEW: switch to a paper space layout first.");
|
||||
@@ -393,7 +398,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
// ── MSPACE / PSPACE ───────────────────────────────────────────
|
||||
"MS" | "MSPACE" => {
|
||||
"MSPACE" => {
|
||||
return Some(Task::done(Message::MspaceCommand));
|
||||
}
|
||||
"PSPACE" => {
|
||||
@@ -970,7 +975,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
// HIDE — hidden-line view of the active viewport.
|
||||
"HIDE" | "HI" => {
|
||||
"HIDE" => {
|
||||
return Some(Task::done(Message::SetRenderMode(
|
||||
acadrust::entities::ViewportRenderMode::HiddenLine,
|
||||
)));
|
||||
|
||||
Reference in new issue
Block a user