Creates a selection set from the selected object
(ssget [sel-method] [pt1 [pt2]] [pt-list] [filter-list])
ssget filters out objects from the space not currently in effect. Selection sets returned by ssget contain main entities only (no attributes or polyline vertices).Selection sets can contain objects from both paper and model space, but when the selection set is used in an operation,
A string that specifies the object selection method. Valid selection methods are
CPâ€ƒCpolygon selection (all objects crossing and inside of the specified polygon).
Iâ€ƒImplied selection (objects selected while PICKFIRST is in effect).
Lâ€ƒLast visible object added to the database.
Pâ€ƒLast selection set created.
WPâ€ƒWPolygon (all objects within the specified polygon).
X selection method and do not provide a filter-list, ssget selects all entities in the database, including entities on layers that are off, frozen, and out of the visible screen.Xâ€ƒEntire database. If you specify the
:Eâ€ƒEverything within the cursor's object selection pickbox.
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.:Nâ€ƒCall
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, and so on) 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).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,
:Sâ€ƒ Allow single selection only.
:Uâ€ƒ Enables subentity selection. 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â€ƒ Forces subentity selection. 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.
A point relative to the selection.
A point relative to the selection.
A list of points.
An association list that specifies object properties. Objects that match the filter-list are added to the selection set.
ssget prompts the user with the Select Objects prompt, allowing interactive construction of a selection set.If you omit all arguments,
If you supply a point but do not specify an object selection method, AutoCAD assumes the user is selecting an object by picking a single point.
nil if no objects were selected.The name of the created selection set if successful; otherwise
Notes on the Object Selection Methods
Prompt the user to select the objects to be placed in a selection set:
<Selection set: 2>
Create a selection set of the object passing through (2,2):
Command: (ssget '(2 2))
Create a selection set of the most recently selected objects:
Command: (ssget "_P")
<Selection set: 4>
Create a selection set of the objects crossing the box from (0,0) to (1,1):
Command: (ssget "_C" '(0 0) '(1 1))
<Selection set: b>
Create a selection set of the objects inside the window from (0,0):
Command: (ssget "_W" '(0 0) '(5 5))
<Selection set: d>
By specifying filters, you can obtain a selection set that includes all objects of a given type, on a given layer, or of a given color. The following example returns a selection set that consists only of blue lines that are part of the implied selection set (those objects selected while PICKFIRST is in effect):
Command: (ssget "_I" '((0 . "LINE") (62 . 5)))
<Selection set: 4>
ssget require that a list of points be passed to the function. The pt_list variable cannot contain points that define zero-length segments.The following examples of
Create a list of points:
Command: (setq pt_list '((1 1)(3 1)(5 2)(2 4)))
((1 1) (3 1) (5 2) (2 4))
Create a selection set of all objects crossing and inside the polygon defined by pt_list:
Command: (ssget "_CP" pt_list)
<Selection set: 13>
Create a selection set of all blue lines inside the polygon defined by pt_list:
Command: (ssget "_WP" pt_list '((0 . "LINE") (62 . 5)))
<Selection set: 8>
ssget is used with no arguments. Selection sets consume AutoCAD temporary file slots, so AutoLISP is not permitted to have more than 128 open at one time. If this limit is reached, AutoCAD cannot create any more selection sets and returns nil to all ssget calls. To close an unnecessary selection set variable, set it to nil.The selected objects are highlighted only when
A selection set variable can be passed to AutoCAD in response to any Select objects prompt at which selection by Last is valid. AutoCAD then selects all the objects in the selection set variable.
ssget unless you specifically request it while you are in the function.The current setting of Object Snap mode is ignored by
and in the AutoLISP Developer's Guide .