Filters & Selection

Build selection filters and query the AutoCAD objects that match them.


AC-AndFilterFilter

Autocad And Filter

Autocad And Filter icon

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

The first filter in the logical AND operation.

The second filter in the logical AND operation.

Outputs

The combined filter using logical AND.

Exceptions

LevelMessageCause & fix
ErrorFilter A is required.No filter was supplied to the first input. Connect a filter to Filter A.
ErrorFilter 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



AC-LayerFilterFilter

Autocad Layer Filter

Autocad Layer Filter icon

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

LayerGeneric

The layer name (string) or layer object to filter by.

Outputs

A filter that selects objects on the specified layer.

Exceptions

LevelMessageCause & fix
ErrorLayer input is required.Nothing was connected to the Layer input. Provide a layer name or layer object.
ErrorInvalid 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



AC-OrFilterFilter

Autocad Or Filter

Autocad Or Filter icon

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

The first filter in the logical OR operation.

The second filter in the logical OR operation.

Outputs

The combined filter using logical OR.

Exceptions

LevelMessageCause & fix
ErrorFilter A is required.No filter was supplied to the first input. Connect a filter to Filter A.
ErrorFilter 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



AC-CustomFilterFilter

Create Custom Filter

Create Custom Filter icon

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 TypedValue

The filter criteria as FilterRules (Autocad TypedValues)

Outputs

The created custom filter

Exceptions

LevelMessageCause & fix
ErrorNo 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



AC-FilterRulesFilter

Create Filter Rules

Create Filter Rules icon

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

DxfCodeInteger

The integer which represents the DxfCode, use the DxfCodeValueList for help

ValueGeneric

The value for the FilterRules

Outputs

FilterRulesAutoCAD TypedValue

The created FilterRules (Autocad TypedValues)

Exceptions

LevelMessageCause & fix
ErrorValue 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



AC-GetByFilterFilter

Get AutoCAD Objects By Filter

Get AutoCAD Objects By Filter icon

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

DocumentAutoCAD Documentoptional

An AutoCAD Document. If not provided, the active document will be used.

The selection filter to use for querying elements.

LimitIntegeroptional

Maximum number of objects to return. Use 0 for unlimited. The default is 100.

Outputs

ObjectsGeneric

The AutoCAD objects matching the filter

CountInteger

The number of objects found

Exceptions

LevelMessageCause & fix
ErrorNo active AutoCAD document availableNo document was supplied and there is no active drawing. Open a drawing or connect a document.
ErrorA valid filter is requiredNothing 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