forked from 1b-agent/opencadstudio-upstream
feat(count): prompt COUNT for the tally mode
Bare COUNT now offers [All (by type) / By layer] as buttons instead of immediately dumping the by-type tally. "All" dispatches COUNT TYPE, whose output is identical to the old bare COUNT; "By layer" dispatches COUNT LAYER. Counting a specific layer (COUNT <layer>) stays typeable. Finishes bucket B.
This commit is contained in:
1 parent
7195e1e8fb
commit
cf5362aeab
1 file changed
+11
-1
@@ -875,7 +875,17 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
// ── COUNT — entity statistics ─────────────────────────────────────
|
||||
cmd if cmd == "COUNT" || cmd.starts_with("COUNT ") => {
|
||||
"COUNT" => {
|
||||
use crate::command::KeywordCommand;
|
||||
let c = KeywordCommand::new(
|
||||
"COUNT",
|
||||
"COUNT tally [All (by type) / by Layer]:",
|
||||
vec![("All", "TYPE", None), ("By layer", "LAYER", None)],
|
||||
);
|
||||
self.command_line.push_info(&c.prompt());
|
||||
self.tabs[self.active_tab].active_cmd = Some(Box::new(c));
|
||||
}
|
||||
cmd if cmd.starts_with("COUNT ") => {
|
||||
let filter = cmd.split_once(' ').map(|(_, r)| r.trim().to_uppercase());
|
||||
let mut counts: std::collections::BTreeMap<String, usize> = Default::default();
|
||||
for e in self.tabs[i].scene.document.entities() {
|
||||
|
||||
Reference in new issue
Block a user