Commands › › Filter Selection
Filter Selection
Coming soon
Before you run this
Elements must be selected in Revit. Use SelectByCategoryCommand or SelectByFamilyNameCommand first.
After it runs
Revit selection is narrowed to only elements passing the filter. Returns JSON with originalCount, filteredCount, removed count, and breakdown.
When to use this
- User selected all lights, now wants to keep only emergency lights (keepParameter="emergency").
- User selected all electrical fixtures, now wants to remove exit signs (removeFamily="exit").
- User wants to narrow selection by type name (keepType="Type A").
Don't use this when
Initial element selection (use SelectByCategoryCommand, SelectByFamilyNameCommand first). Selecting by parameter search from scratch (use SelectByParameterCommand).
Inputs
| Name | Kind | Type | Required | Default | Description |
|---|---|---|---|---|---|
keepCategory |
config | string |
no | — | Keep only elements of this category |
keepFamily |
config | string |
no | — | Keep only elements whose family name contains this |
keepType |
config | string |
no | — | Keep only elements whose type name contains this |
keepParameter |
config | string |
no | — | Keep elements where ANY parameter contains this text (deep search) |
removeFamily |
config | string |
no | — | Remove elements whose family name contains this |
removeCategory |
config | string |
no | — | Remove elements of this category |
invert |
config | bool |
no | false | Invert the filter result |
Returns
| Name | Type | Description |
|---|---|---|
Selection | ElementId[] | Filtered element IDs |
Summary | JSON | Before/after counts and breakdown |
Decision flow
check: currentSelection.count == 0 → error with suggestion apply: keepCategory, keepFamily, keepType, keepParameter → AND logic (all must pass) apply: removeFamily, removeCategory → exclude matching check: invert == "true" → swap kept/removed
What you'll see in the chat
on start
Filtering your current selection...
Narrowing down the selected elements...
Narrowing down the selected elements...
thinking
Reading current selection...
Applying keep filters...
Applying remove filters...
Updating Revit selection...
Applying keep filters...
Applying remove filters...
Updating Revit selection...
on success
Filtered selection: {filteredCount} of {originalCount} elements kept.
on failure
Filter failed: {error}
REST API
Not yet exposed
This command does not carry a [RestApi] attribute today. Once tagged, this section will auto-populate with:
POST /api/v1/commands/filter_selection- Request body schema (from
[RestApiParam]) - Response schema (from
[RestApiResponse]) - curl / JS / Python code examples
Keywords & intent patterns
filter selection · narrow selection · refine selection · keep only · remove from selection · filter by
Patterns: filter * selection · keep only * · remove * from selection · narrow * selection
Related
| Related commands | SelectByCategoryCommand · SelectByFamilyNameCommand · SelectByParameterCommand · TagAllCommand |
|---|---|
| Pillar |