Filters & Selection
Build selection filters and query the AutoCAD objects that match them.
Autocad And Filter
AutoCAD › Filter · Introduced v1.0.17
Combines two filters using a logical AND operation, so only objects that satisfy both filters are selected. Use it to narrow a search by stacking conditions together, for example to find objects that are both on a given layer and of a given type. Chain several of these together to build up more demanding selection criteria.
Inputs
Filter AAutoCAD FilterThe first filter in the logical AND operation.
Filter BAutoCAD FilterThe second filter in the logical AND operation.
Outputs
FilterAutoCAD FilterThe combined filter using logical AND.
Exceptions
| Level | Message | Cause & fix |
|---|---|---|
| Error | Filter A is required. | No filter was supplied to the first input. Connect a filter to Filter A. |
| Error | Filter B is required. | No filter was supplied to the second input. Connect a filter to Filter B. |
See also
Autocad Or Filter, Create Custom Filter, Autocad Layer Filter, Get AutoCAD Objects By Filter
Autocad Layer Filter
AutoCAD › Filter · Introduced v1.0.17
Creates a filter that selects every object on a specific layer. You can identify the layer either by its name as text or by passing in a layer object. Feed the resulting filter into the Get AutoCAD Objects By Filter node, or combine it with other filters using the And/Or filters.
Inputs
LayerGenericThe layer name (string) or layer object to filter by.
Outputs
FilterAutoCAD FilterA filter that selects objects on the specified layer.
Exceptions
| Level | Message | Cause & fix |
|---|---|---|
| Error | Layer input is required. | Nothing was connected to the Layer input. Provide a layer name or layer object. |
| Error | Invalid layer input. Provide a layer name (string) or a layer object. | The supplied value was not a recognised layer or a non-empty layer name. Connect a valid layer object or a text layer name. |
See also
Autocad And Filter, Autocad Or Filter, Create Custom Filter, Get AutoCAD Objects By Filter
Autocad Or Filter
AutoCAD › Filter · Introduced v1.0.17
Combines two filters using a logical OR operation, so objects that satisfy either filter are selected. Use it to broaden a search, for example to gather objects on layer A together with objects on layer B in a single query. Chain several together to assemble larger sets of matching criteria.
Inputs
Filter AAutoCAD FilterThe first filter in the logical OR operation.
Filter BAutoCAD FilterThe second filter in the logical OR operation.
Outputs
FilterAutoCAD FilterThe combined filter using logical OR.
Exceptions
| Level | Message | Cause & fix |
|---|---|---|
| Error | Filter A is required. | No filter was supplied to the first input. Connect a filter to Filter A. |
| Error | Filter B is required. | No filter was supplied to the second input. Connect a filter to Filter B. |
See also
Autocad And Filter, Create Custom Filter, Autocad Layer Filter, Get AutoCAD Objects By Filter
Create Custom Filter
AutoCAD › Filter · Introduced v1.0.17
Builds a custom selection filter from a list of filter rules. Each rule is created with the Create Filter Rules node, and together they define exactly which objects the filter should match. Feed the resulting filter into the Get AutoCAD Objects By Filter node, or combine it with other filters using the And/Or filters.
Inputs
FilterRulesAutoCAD TypedValueThe filter criteria as FilterRules (Autocad TypedValues)
Outputs
FilterAutoCAD FilterThe created custom filter
Exceptions
| Level | Message | Cause & fix |
|---|---|---|
| Error | No valid FilterRules (Autocad TypedValues) provided. | The rule list was empty or held no usable values. Connect at least one filter rule from Create Filter Rules. |
See also
Create Filter Rules, Autocad And Filter, Autocad Or Filter, Get AutoCAD Objects By Filter
Create Filter Rules
AutoCAD › Filter · Introduced v1.0.17
Creates a single filter rule from a DxfCode and a value, which can then be combined into a custom filter. The DxfCode identifies which property to match (for example a layer name or colour); use the DxfCode value list to look up the right code. Collect several rules together and pass them into the Create Custom Filter node to build a complete selection filter.
Inputs
DxfCodeIntegerThe integer which represents the DxfCode, use the DxfCodeValueList for help
ValueGenericThe value for the FilterRules
Outputs
FilterRulesAutoCAD TypedValueThe created FilterRules (Autocad TypedValues)
Exceptions
| Level | Message | Cause & fix |
|---|---|---|
| Error | Value cannot be null. | A DxfCode was supplied but the Value input was empty. Provide a value to match against. |
See also
Create Custom Filter, DxfCode, Get AutoCAD Objects By Filter
Get AutoCAD Objects By Filter
AutoCAD › Filter · Introduced v1.0.9, updated v1.2.24
Returns the AutoCAD objects in a drawing that match a selection filter, along with a count of how many were found. Build the filter with the layer, custom, And, or Or filter nodes and connect it here. By default the node returns at most 100 objects; set Limit to 0 to return everything, or to another number to cap the results. If no document is supplied it queries the active drawing.
Menu & behaviour
- This node carries an on-canvas Query button (drawn just below the component) that runs the search on demand. The button is shown only while Auto Update is turned off; clicking it manually refreshes the results.
- Right-click Auto Update toggles automatic refreshing. When enabled, the node recomputes by itself whenever relevant objects are added, modified, or erased in the AutoCAD document, and the Query button is hidden. When disabled, the node stays put until you press Query. The Auto Update setting is remembered when the Grasshopper file is saved and reopened.
- When Auto Update is off, the node holds no result until Query is pressed; changing an input clears the output rather than recomputing automatically.
- Recomputes automatically when relevant objects are added, modified, or erased in the AutoCAD/Civil document (only while Auto Update is enabled).
Inputs
An AutoCAD Document. If not provided, the active document will be used.
FilterAutoCAD FilterThe selection filter to use for querying elements.
LimitIntegeroptionalMaximum number of objects to return. Use 0 for unlimited. The default is 100.
Outputs
ObjectsGenericThe AutoCAD objects matching the filter
CountIntegerThe number of objects found
Exceptions
| Level | Message | Cause & fix |
|---|---|---|
| Error | No active AutoCAD document available | No document was supplied and there is no active drawing. Open a drawing or connect a document. |
| Error | A valid filter is required | Nothing usable was connected to the Filter input. Connect a filter built with one of the filter nodes. |
See also
Create Custom Filter, Autocad Layer Filter, Autocad And Filter, Autocad Or Filter, AutoCAD Geometry Filter Type