# FilteringExtension
The default filtering functionality is exposed as an extension. The current filtering implementation works by providing an updated FilteringState after each call to its functions. You can use this filtering state to keep track of filtering state.
# Accessors
filteringState |
---|
# Methods
hideObjects | isolateObjects | removeColorFilter | removeUserObjectColors |
---|---|---|---|
resetFilters | setColorFilter | setUserObjectColors | showObjects |
unIsolateObjects |
# Typedefs
FilteringState | PropertyInfo |
---|
# Accessors
# filteringState
get filteringState(): FilteringState
Returns the current FilteringState.
Returns: FilteringState
# Methods
# hideObjects
hideObjects(
objectIds: string[],
stateKey: string = null,
includeDescendants = false,
ghost = false
): FilteringState
2
3
4
5
6
Hides the specified object ids.
Parameters
- objectIds: The ids of the objects to hide
- optional stateKey: A way of splitting up commands coming from different controls (model explorer, filters, selection) so the viewer filtering api can know whether to reset its internal state or not
- optional includeDescendants: Whether to include the descendants of the provided object ids
- optional ghost Whether to ghost the rest of the objects
Returns: FilteringState
# isolateObjects
isolateObjects(
objectIds: string[],
stateKey: string = null,
includeDescendants = true,
ghost = true
): FilteringState
2
3
4
5
6
Hides the specified object ids.
Parameters
- objectIds: The ids of the objects to hide
- optional stateKey: A way of splitting up commands coming from different controls (model explorer, filters, selection) so the viewer filtering api can know whether to reset its internal state or not
- optional includeDescendants: Whether to include the descendants of the provided object ids
- optional ghost Whether to ghost the rest of the objects
Returns: FilteringState
# isolateObjects
removeColorFilter(): FilteringState
Removes any current color filters.
Returns: FilteringState
# removeUserObjectColors
removeUserObjectColors(): FilteringState
Removes any current user color filters.
Returns: FilteringState
# resetFilters
resetFilters(): FilteringState
Removes al the current filters.
Returns: FilteringState
# setColorFilter
setColorFilter(prop: PropertyInfo, ghost = true): FilteringState
Applies a color filter.
Parameters
- prop: PropertyInfo
- optional ghost" Whether to ghost the rest of the objects
Returns: FilteringState
# setUserObjectColors
setUserObjectColors(
groups: { objectIds: string[]; color: string }[]
): FilteringState
2
3
Applies a user color filter.
TIP
If used appropriately user color filters can typically be much more performant than applying multiple materials per color.
Parameters
- groups: Groups of objects organized by color
Returns: FilteringState
# showObjects
showObjects(
objectIds: string[],
stateKey: string = null,
includeDescendants = false
): FilteringState
2
3
4
5
Shows the specified object ids.
Parameters
- objectIds: The ids of the objects to hide
- optional stateKey: A way of splitting up commands coming from different controls (model explorer, filters, selection) so the viewer filtering api can know whether to reset its internal state or not
- optional includeDescendants: Whether to include the descendants of the provided object ids
Returns: FilteringState
# unIsolateObjects
unIsolateObjects(
objectIds: string[],
stateKey: string = null,
includeDescendants = true,
ghost = true
): FilteringState
2
3
4
5
6
Shows the specified object ids.
Parameters
- objectIds: The ids of the objects to hide
- optional stateKey: A way of splitting up commands coming from different controls (model explorer, filters, selection) so the viewer filtering api can know whether to reset its internal state or not
- optional includeDescendants: Whether to include the descendants of the provided object ids
- optional ghost Whether to ghost the rest of the objects
Returns: FilteringState
# Typedefs
# FilteringState
type FilteringState = {
selectedObjects?: string[];
hiddenObjects?: string[];
isolatedObjects?: string[];
colorGroups?: Record<string, string>[];
userColorGroups?: { ids: string[]; color: string }[];
activePropFilterKey?: string;
passMin?: number | null;
passMax?: number | null;
};
2
3
4
5
6
7
8
9
10
- selectedObjects: The current selected object ids
- hidenObjects: The current hidden object ids
- isolatedObjects: The current isolated object ids
- colorGroups: The current color groups
- userColorGroups: The current user color groups
- activePropFilterKey: The active property filtering key
- passMin: The minimal value of the property filtering value if numeric
- passMax: The maximum value of the property filtering value if numeric
# PropertyInfo
interface PropertyInfo {
key: string;
objectCount: number;
type: "number" | "string";
}
2
3
4
5
Outline of a filterable property.
- key: The property key
- objectCount: The object count where the key is present
- type: Property type