ssget

The following is a detailed reference for the AutoLISP ssget function, including information on undocumented mode strings and selection behaviour. The reference consists of information which has been collected from various sources & compiled by numerous contributors.

Function Format

(ssget [mode-string] [pt1 [pt2]] [pt-list] [filter-list])

Selection Mode Strings

_
(underscore)

Non-localised mode string prefix

Ensures the English version of the mode string is used in non-English versions of AutoCAD.

Not strictly necessary for all mode strings (since some mode strings are the same in all language versions), but safer to include than exclude.

+.

Point Selection Mode [user selection] [undocumented]

Forces ssget to remain in 'point' mode, similar to setting PICKAUTO to 0. May be combined with the ":S" single-selection mode and ":E" mode to emulate an entsel selection by avoiding implied selection windows.

Example:
(ssget "_+.:E:S")

Will emulate an entsel selection behaviour.

This mode string must be combined with other mode strings and will return a too few arguments error if used on its own.

A

All [automated] [undocumented]

Similar to the "X" mode string but excludes objects on frozen layers. Selects all objects on thawed layers.

Example:
(ssget "_A" '((0 . "LINE")))

Selects all lines residing on thawed layers in the drawing.

This mode string cannot be combined with graphical selection mode strings.

B

Box [automated] [undocumented]

Selects all objects inside or crossing a rectangle specified by two points. If the points are specified from right to left, Box is equivalent to Crossing. Otherwise, Box is equivalent to Window.

C

Crossing [automated] [documented]

Selects objects residing within and/or crossing a rectangular area defined by two points. The supplied points should be expressed relative to the UCS, however, the crossing window will always be orthogonal to the WCS axes.

Example:
(ssget "_C" '(0 0) '(2 1) '((0 . "CIRCLE")))

Selects all circles residing inside or crossing the rectangle with vertices at (0,0), (2,0), (2,1) and (0,1)

Caution: Only objects visible in the drawing area at the time of selection will be selected by this method. Consider temporarily zooming to the selection window before performing the selection, and then zoom previous to restore the original screen position.

CP

Crossing Polygon [automated] [documented]

Selects objects residing within and/or crossing a polygon defined by a list of UCS points. The polygon can be any shape but cannot cross or touch itself. AutoCAD will construct the last segment of the polygon to ensure it is closed at all times.

The CP mode string is not affected by the PICKADD System Variable.

Example:
(ssget "_CP" '((1 1) (3 1) (5 2) (2 4)))

Selects all objects residing inside or crossing a polygon with vertices at (1,1), (3,1), (5,2) and (2,4)

Caution: only objects visible in the drawing area at the time of selection will be selected by this method. Consider temporarily zooming to the selection area before performing the selection, and then zoom previous to restore the original screen position.

:D

Allow Duplicates [user selection] [undocumented]

Includes duplicate selected entities in the selection, else duplicates are ignored.

:E

Everything within Aperture [user selection] [documented]

Allows selection of everything within the cursor's object selection pickbox. This mode may be used in conjunction with the "+." and ":S" mode strings to emulate entsel selection behaviour.

F

Fence [automated] [documented]

Selects all objects crossing a selection fence. The Fence method is similar to CP (Crossing Polygon) except that AutoCAD does not close the fence, and a fence can cross itself.

Example:
(ssget "_F" '((0 0) (1 1)) '((0 . "LINE")))

Selects all lines crossing the fence line running from (0,0) to (1,1).

Fence is not affected by the PICKADD System Variable.

Caution: Only objects visible in the drawing area at the time of selection will be selected by this method. Consider temporarily zooming to the selection window before performing the selection, and then zoom previous to restore the original screen position.

G

Groups [automated] [undocumented]

Selects all objects within a specified group.

Although a valid ssget mode string, there is no provision for passing group names as arguments to the ssget function and hence this option is only of use at the command-line during the Select objects prompt.

I

Implied [automated] [documented]

Implied selection (objects selected while PICKFIRST is in effect).

L

Last [automated] [documented]

Selects the last visible object added to the drawing database.

Caution: when using the "L" selection method in an MDI environment, you cannot always count on the last object drawn to remain visible. For example, if your application draws a line, and the user subsequently minimizes or cascades the AutoCAD drawing window, the line may no longer be visible. If this occurs, ssget with the "L" option will return nil.

:L

Exclude Locked Layers [user selection] [undocumented]

Rejects selection of objects residing on locked layers.

M

Multiple [automated] [undocumented]

Specifies multiple points without highlighting the objects, thus speeding up the selection process for complex objects. The Multiple method also selects two intersecting objects if the intersection point is specified twice.

:N

Nested [user selection] [documented]

Call ssnamex for additional information on container blocks and transformation matrices for any entities selected during the ssget operation. This additional information is available only for entities selected via graphical selection methods such as Window, Crossing, and point picks.

Unlike the other object selection methods, :N may return multiple entities with the same entity name in the selection set. For example, if the user selects a subentity of a complex entity such as a BlockReference, PolygonMesh, or old style polyline, ssget looks at the subentity that is selected when determining if it has already been selected. However, ssget actually adds the main entity (BlockReference, PolygonMesh, etc.) to the selection set. The result could be multiple entries with the same entity name in the selection set (each will have different subentity information for ssnamex to report).

This ssget mode string is known to perform erratically.

P

Previous [automated] [documented]

Selects the most recent selection set.

The Previous selection set is cleared by operations that delete objects from the drawing. AutoCAD keeps track of whether each selection set was specified in model space or paper space. The Previous selection set is ignored if you switch spaces.

:P

Reject Viewports [user selection] [undocumented]

Rejects selection of Viewport objects.

Equivalent to:
(ssget '((0 . "~VIEWPORT")))

:R

Permit Long Transaction [user selection] [documented]

Allows entities in a long transaction to be selected.

:S

Single Selection [user selection] [documented]

The user is permitted a single attempt to make a selection of objects using any available selection method. When combined with either "+." or ":E", only a single object may be selected, emulating an entsel selection.

:U

Enable Subentity Selection - 2006+ [user selection] [documented]

Cannot be combined with the duplicate (":D") or nested (":N") selection modes.

In this mode, top-level entities are selected by default, but the user can attempt to select subentities by pressing the CTRL key while making the selection. This option is supported only with interactive selections, such as window, crossing, and polygon. It is not supported for all, filtered, or group selections.

:V

Force Subentity Selection - 2006+ [user selection] [documented]

Treats all interactive, graphic selections performed by the user as subentity selections.

The returned selection set contains subentities only. This option cannot be combined with the duplicate (":D") or nested (":N") selection modes. This option is supported only with interactive selections, such as window and crossing. It is not supported for all, filtered, or group selections.

W

Window [automated] [documented]

Selects all objects residing completely inside a rectangle defined by two UCS points.

Example:
(ssget "_W" '(3 2) '(5 4) '((0 . "TEXT")))

Selects all text objects residing entirely inside the rectangle with vertices at (3,2), (5,2), (5,4) and (3,4)

Caution: only objects visible in the drawing area at the time of selection will be selected by this method. Consider temporarily zooming to the selection window before performing the selection, and then zoom previous to restore the original screen position.

WP

Window Polygon [automated] [documented]

Selects objects completely inside a polygon defined by a list of points. The polygon can be any shape but cannot cross or touch itself. AutoCAD will construct the last segment of the polygon to ensure it is closed at all times. WPolygon is not affected by the PICKADD System Variable.

Example:
(ssget "_WP" '((0 1) (4 2) (6 4)) '((0 . "ARC") (40 . 1.0)))

Selects all arcs with radius 1.0 residing entirely within a polygon with vertices at (0,1), (4,2) and (6,4)

Caution: only objects visible in the drawing area at the time of selection will be selected by this method. Consider temporarily zooming to the selection area before performing the selection, and then zoom previous to restore the original screen position.

X

Extended search (Entire Drawing Database) [automated] [documented]

Iterates over the entire drawing database selection all entities matching the criteria given by the supplied filter list (if present); includes entities on layers that are off, frozen & locked, and entities outside of the visible drawing area.

Example:
(ssget "_X" '((0 . "CIRCLE")))

Selects all circles in every drawing layout.

Filter List Operators

Relational Operators

Notes:

  • The following relational operators are only valid for use with groups containing integer or real values; the bitwise operators are limited to integer values only. Use wildcard patterns for testing strings.
  • For point groups, the X, Y, and Z tests can be combined into a single string, with each operator separated by commas (for example, ">,>,*"). If an operator is omitted from the string (for example, "=,<>" leaves out the Z test), then the 'anything goes' operator, "*", is assumed.
  • Direction vectors (DXF Group code 210) can be compared only with the operators "*", "=", and "!=" (or one of the equivalent 'not equal' strings).
*

Anything goes (always true)

Example:
(ssget '((0 . "LINE") (-4 . "=,*,=") (10 1.0 0.0 1.0)))

Select lines with start point passing through (1.0,*,1.0) i.e. with any Y-coordinate.

=

Equal

Example:
(ssget '((0 . "CIRCLE") (-4 . "*,*,=") (10 0.0 0.0 4.0)))

Select circles with a center at an elevation of 4.0 units

!=
/=
<>

Not Equal

All three listed operators are equivalent.

Example:
(ssget '((0 . "CIRCLE") (-4 . "<>") (40 . 5.0)))

Select circles with a radius not equal to 5.0

<

Less Than

Example:
(ssget '((0 . "ARC") (-4 . "<") (40 . 2.0)))

Select arcs with a radius less than 2.0

<=

Less Than or Equal to

Example:
(ssget '((0 . "TEXT") (-4 . "*,<=") (11 0.0 10.0 0.0)))

Select text with alignment point with Y-coordinate less than or equal to 10.0 units, with any X & Z coordinate value.

>

Greater Than

Example:
(ssget '((0 . "LINE") (-4 . ">,>") (11 3.0 3.0 0.0)))

Select lines with end point passing through a point with X & Y coordinate greater than (3.0,3.0), with any Z-coordinate value.

>=

Greater Than or Equal to

Example:
(ssget '((0 . "POINT") (-4 . "<,>=,=") (10 5.0 7.0 0.0)))

Select points with X-coordinate less than 5.0, Y-coordinate greater than or equal to 7.0, and with Z-coordinate equal to 0.0

&

Bitwise AND (integer groups only)

Equivalent to: (/= 0 (logand bit filter))

Example:
(ssget '((0 . "POLYLINE") (-4 . "&") (70 . 6)))

Select Polylines with either curve-fit (2) or spline-fit (4) vertices added.

&=

Bitwise Masked Equals (integer groups only)

Equivalent to: (= filter (logand bit filter))

Example:
(ssget '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1)))

Select closed LWPolylines.

Logical Operators

<AND...AND>

Logical And

Matches all enclosed expressions.

Since the ssget filter list has an implied AND operator (matching all supplied items), this operator is mostly used in conjunction with other logical operators to form compound filters.

Example:
(ssget
   '(
        (-4 . "<OR")
            (-4 . "<AND") (0 . "ARC")    (40 . 1.5) (-4 . "AND>")
            (-4 . "<AND") (0 . "CIRCLE") (40 . 2.0) (-4 . "AND>")
        (-4 . "OR>")
    )
)

Selects arcs with radius 1.5 or circles with radius 2.0.

<OR...OR>

Logical Inclusive Or

Matches one or more enclosed expressions.

Example:
(ssget '((0 . "TEXT") (-4 . "<OR") (40 . 1.0) (8 . "0") (62 . 3) (-4 . "OR>")))

Selects text objects with text height of 1.0 or layer "0", or with colour set to 3 (green), or a combination of all of these properties.

<XOR...XOR>

Logical Exclusive Or

Matches one of two enclosed expressions.

Example:
(ssget '((0 . "TEXT") (-4 . "<XOR") (40 . 1.0) (62 . 3) (-4 . "XOR>")))

Selects text with text height of 1.0 or with colour set to 3, but not both.

<NOT...NOT>

Logical Not

Rejects objects matching the single enclosed expression.

Example:
(ssget '((0 . "LINE") (-4 . "<NOT") (62 . 256) (-4 . "NOT>")))

Selects lines with colour not set to 256 (ByLayer).

System Variables

PICKADD

Controls whether subsequent selections replace the current selection set or add to it.

0

Turns off PICKADD.

The objects and subobjects most recently selected become the selection set. Previously selected objects and subobjects are removed from the selection set. Add more objects or subobjects to the selection set by pressing SHIFT while selecting.

1

Turns on PICKADD.

Each object and subobject selected, either individually or by windowing, is added to the current selection set. To remove objects or subobjects from the set, press SHIFT while selecting.

2

Turns on PICKADD.

Same as PICKADD=1, but keeps objects selected after the SELECT command ends.

PICKAUTO

Controls automatic windowing at the Select Objects prompt.

0

Turns off PICKAUTO.

Forces 'point' selection: clicking in empty drawing space will not open a selection window.

1

Turns on PICKAUTO.

Draws a selection window (for either a window or a crossing selection) automatically at the Select Objects prompt when the user clicks in an empty drawing area.

PICKDRAG

Controls the method of drawing a selection window.

0

Draws the selection window using two points.

Click the pointing device at one corner, and then click to select another corner.

1

Draws the selection window using dragging.

Click one corner and drag the pointing device, release the button at the other corner.

PICKFIRST

Controls whether you select objects before (noun-verb selection) or after you issue a command.

0

Turns off PICKFIRST, you select objects after you issue a command

1

Turns on PICKFIRST, you select objects before you issue a command

PICKSTYLE

Controls the use of group selection and associative hatch selection.

0

No group selection or associative hatch selection

1

Group selection

2

Associative hatch selection

3

Group selection and associative hatch selection

Existing Documentation

Below you will find various links to existing documentation referencing the ssget function.

Standard ssget Function Reference

Selecting Objects and Selection Sets

Selection Set Filter Lists

Wildcard Patterns in Filter Lists

Filtering for Extended Data

Relational Tests

Logical Grouping of Filter Tests

Selection Set Manipulation Functions Reference

textsize

increase · reset · decrease

Designed & Created by Lee Mac © 2010