Satish Lele
satish.lele@gmail.com


Selection Sets
ssadd: Adds an object (entity) to a selection set, or creates a new selection set. (ssadd [ename [ss]]). If called with no arguments, ssadd constructs a new selection set with no members. If called with the single entity name argument ename, ssadd constructs a new selection set containing that single entity. If called with an entity name and the selection set ss, ssadd adds the named entity to the selection set. The ssadd function always returns the new or modified selection set. When adding an entity to a set, the new entity is added to the existing set, and the set passed as ss is returned as the result. Thus, if the set is assigned to other variables, they also reflect the addition. If the named entity is already in the set, the ssadd operation is ignored and no error is reported.
(setq e1 (entnext)) Sets e1 to name of first entity in drawing
(setq ss (ssadd)) Sets ss to a null selection set
(ssadd e1 ss) Returns ss with entity name e1 added
(setq e2 (entnext e1)) Gets entity following e1
(ssadd e2 ss) Returns ss with entity name e2 added

ssdel: Deletes an object (entity) from a selection set. (ssdel ename ss)
The ssdel function deletes the entity ename from selection set ss and returns the name of selection set ss. Note that the entity is actually deleted from the selection set as opposed to a new set being returned with the element deleted. If the entity is not in the set, nil is returned. For example, given that entity name e1 is a member of selection set ss1 and entity name e2 is not, then
(ssdel e1 ss1) Returns selection set ss with entity e1 removed
(ssdel e2 ss1) Returns nil (does not change ss1)

ssget: Prompts the user to select objects (entities), and returns a selection set
(ssget [mode] [pt1 [pt2]] [pt-list] [filter-list]).
mode argument is a string that specifies the object selection method. Valid modes are "W", "WP", "C", "CP", "L", "P", "I", and "F", corresponding to the Window, WPolygon, Crossing, CPolygon, Last, Previous, Implied, and Fence selection methods. Another optional mode value is "X", which selects the entire database. The pt1 and pt2 arguments specify points relevant to the selection.
Supplying a point with no mode argument is equivalent to object selection by picking a single point. The current setting of Object Snap mode is ignored by this function unless you specifically request it while you are in the function. The filter-list argument is an association list that specifies object properties. Objects that match the filter-list are added to the selection set. If all arguments are omitted, ssget prompts the user with the Select objects prompt, allowing interactive construction of the selection set. Selection sets can contain objects from both paper and model space, but when the selection set is used in an operation, objects from the space not currently in effect are filtered out. Selection sets returned by ssget contain main entities only (no attributes or polyline vertices).
(ssget) Asks the user for a general object selection and places those objects in a selection set
(ssget "P") Creates a selection set of the most recently selected objects
(ssget "L") Creates a selection set of the last visible object added to the database
(ssget "I") Creates a selection set of the objects in the implied selection set (those selected while PICKFIRST is in effect)
(ssget '(2 2)) Creates a selection set of the object passing through (2,2)
(ssget "W" '(0 0) '(5 5)) Creates a selection set of the objects inside the window from (0,0) to (5,5)
(ssget "C" '(0 0) '(1 1)) Creates a selection set of the objects crossing the box from (0,0) to (1,1)
(ssget "X") Creates a selection set of all objects in the database
(ssget "X" filter-list) Scans the database and creates a selection set of objects matching the filter-list
(ssget filter-list) Asks the user for a general object selection and places only those objects matching the filter-list in a selection set.

(ssget '((0 . "TEXT"))): Prompts for general object selection but adds only text objects to the selection set.
(ssget "X" '((0 . "CIRCLE"))): Creates a selection set of all objects in the database that are Circle objects.
(ssget "I" '((0 . "LINE") (62 . 5))): Creates a selection set of all blue Line objects that are part of the Implied selection set (those objects selected while PICKFIRST is in effect).
(ssget "P" filter-list) Creates a selection set of the most recently selected objects that match the filter-list
The following examples of ssget require that a list of points be passed to the function. The pt_list variable cannot contain points that define zero-length segments.
(setq pt_list '((1 1)(3 1)(5 2)(2 4)))
(ssget "WP" pt_list) Creates a selection set of all objects inside the polygon defined by pt_list
(ssget "CP" pt_list) Creates a selection set of all objects crossing and inside the polygon defined by pt_list
(ssget "F" pt_list) Creates a selection set of all objects intersecting the fence defined by pt_list
(ssget "WP" pt_list filter-list) Creates a selection set of all objects inside the polygon defined by pt_list that match the filter-list.

sslength: Returns an integer containing the number of objects (entities) in a selection set (sslength ss). The number is returned as a real if it is greater than 32,767. Selection sets never contain duplicate selections of the same entity.
(setq sset (ssget "L")) Places the last object in selection set sset, (sslength sset) returns 1.

ssmemb: Tests whether an object (entity) is a member of a selection set. (ssmemb ename ss). If it is, ssmemb returns the entity name (ename). If not, it returns nil. For example, given that entity name e1 is a member of selection set ss1 and entity name e2 is not, then
(ssmemb e1 ss1) returns entity name e1
(ssmemb e2 ss1) returns nil
backBack top