Commands  ›   ›  Filter Selection

Filter Selection

writes to model Public API · not yet exposed

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

Don't use this when

Initial element selection (use SelectByCategoryCommand, SelectByFamilyNameCommand first). Selecting by parameter search from scratch (use SelectByParameterCommand).

Inputs

NameKindTypeRequiredDefaultDescription
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

NameTypeDescription
SelectionElementId[]Filtered element IDs
SummaryJSONBefore/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...
thinking
Reading current 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 commandsSelectByCategoryCommand · SelectByFamilyNameCommand · SelectByParameterCommand · TagAllCommand
Pillar