feat(select): Select Similar + Quick Select panel (#28)
Two ways to extend the current selection by entity type + layer: * `Select Similar` (right-click → Select Similar, or `SELECTSIMILAR` / `SELSIM`): for every (type, layer) pair in the current selection, add every entity in the active layout that matches the pair. The seed selection stays selected; matches already selected are not double-counted. * `Quick Select` (right-click → Quick Select…, or `QSELECT` / `QS`): opens a centred floating panel with Object-type and Layer pick_lists (populated only with values that actually exist in the active layout) and an "Append to current selection" checkbox. `(Any)` in either slot skips that filter. Apply replaces the selection (or extends it with Append on) and reports the match count on the command line. Cancel, Esc, and outside-click all dismiss without applying. When opened with a selection present, the panel pre-fills both filters from the first selected entity so QSelect doubles as an editable Select Similar. Scoped to entities owned by the active layout's block-record so a paper layout's QSELECT never reaches into model-space entities (and vice versa). Entity-type names live in a single `entity_type_name` helper in `entities::traits` to keep the UI strings and the filter keys aligned. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
cf925be861
commit
9db206f310
6 changed files with 436 additions and 0 deletions
|
|
@ -92,6 +92,56 @@ pub trait TextContent {
|
|||
fn replace_text(&mut self, search: &str, rep: &str);
|
||||
}
|
||||
|
||||
/// Human-readable variant name used by Quick Select / Select Similar
|
||||
/// filtering. Stable across releases — the strings here are the canonical
|
||||
/// type identifiers throughout the UI.
|
||||
pub fn entity_type_name(et: &EntityType) -> &'static str {
|
||||
match et {
|
||||
EntityType::Point(_) => "Point",
|
||||
EntityType::Line(_) => "Line",
|
||||
EntityType::Circle(_) => "Circle",
|
||||
EntityType::Arc(_) => "Arc",
|
||||
EntityType::Ellipse(_) => "Ellipse",
|
||||
EntityType::Polyline(_) => "Polyline",
|
||||
EntityType::Polyline2D(_) => "Polyline2D",
|
||||
EntityType::Polyline3D(_) => "Polyline3D",
|
||||
EntityType::LwPolyline(_) => "LwPolyline",
|
||||
EntityType::Text(_) => "Text",
|
||||
EntityType::MText(_) => "MText",
|
||||
EntityType::Spline(_) => "Spline",
|
||||
EntityType::Dimension(_) => "Dimension",
|
||||
EntityType::Hatch(_) => "Hatch",
|
||||
EntityType::Solid(_) => "Solid",
|
||||
EntityType::Face3D(_) => "3DFace",
|
||||
EntityType::Insert(_) => "Insert",
|
||||
EntityType::Block(_) => "Block",
|
||||
EntityType::BlockEnd(_) => "BlockEnd",
|
||||
EntityType::Ray(_) => "Ray",
|
||||
EntityType::XLine(_) => "XLine",
|
||||
EntityType::Viewport(_) => "Viewport",
|
||||
EntityType::AttributeDefinition(_) => "AttributeDefinition",
|
||||
EntityType::AttributeEntity(_) => "Attribute",
|
||||
EntityType::Leader(_) => "Leader",
|
||||
EntityType::MultiLeader(_) => "MultiLeader",
|
||||
EntityType::MLine(_) => "MLine",
|
||||
EntityType::Mesh(_) => "Mesh",
|
||||
EntityType::RasterImage(_) => "RasterImage",
|
||||
EntityType::Solid3D(_) => "Solid3D",
|
||||
EntityType::Region(_) => "Region",
|
||||
EntityType::Body(_) => "Body",
|
||||
EntityType::Table(_) => "Table",
|
||||
EntityType::Tolerance(_) => "Tolerance",
|
||||
EntityType::PolyfaceMesh(_) => "PolyfaceMesh",
|
||||
EntityType::Wipeout(_) => "Wipeout",
|
||||
EntityType::Shape(_) => "Shape",
|
||||
EntityType::Underlay(_) => "Underlay",
|
||||
EntityType::Seqend(_) => "Seqend",
|
||||
EntityType::Ole2Frame(_) => "Ole2Frame",
|
||||
EntityType::PolygonMesh(_) => "PolygonMesh",
|
||||
EntityType::Unknown(_) => "Unknown",
|
||||
}
|
||||
}
|
||||
|
||||
pub trait EntityTypeOps {
|
||||
fn to_truck_entity(&self, document: &CadDocument) -> Option<TruckEntity>;
|
||||
fn grips(&self) -> Vec<GripDef>;
|
||||
|
|
|
|||
Loading…
Reference in a new issue