Friday, October 24, 2014

Selection Set Functions

Selection Set Functions


You can work with selection sets. A selection set can be used to perform a command like MOVE. Entities are put in a selection set.


These are the selection sets:


Selection
Set
Use




SSGET
Creating a selection set
SSLENGTH
Number of entities in a selection set
SSNAME
Name of an entity of a selection set
SSADD
Adding an entity to a selection set
SSDEL
Deleting an entity from a selection set
SSMEMB
Checking if an entity is in a selection set


SSGET


This is the syntax of the fucntion:


(ssget [<mode>] [<point1> [<point2>]])


Let's talk about the modes of the SSGET function. There are seven modes. Here is how the modes are used.


For the selection of selection sets temporary files of AutoCAD are used. That is why no more than six selection sets can be open.


Mode
Description




(ssget)
The user is asked to make selection. This is the prompt that shows up:


Select entities:
(ssget “p”)
The previous selection set is selected.
(ssget “l”)
The last entity is selected.
(ssget <point>)
The enity going through the point is selected.
(ssget “w”
<point1> <point2>)
The entities in the window from point1 and point2 are selected.
(ssget “c”
<point1> <point2>)
The entities in the crossing point1 and point2 and the ones touching the crossing are selected.
(ssget “x”
<filter-list>
)
The entities in confirmation with the filter list are selected.


Let's talk about a filter list. In the filter list you can specify which entities are to be selected and put into the selection set.


Here is how the qualities of entities can be selected.


Number
Description




0
Entity type
2
Block name
6
Line type name
7
Text style name
8
Layer name
38
Elevation
39
Thickness
62
Color number
66
Attributes number
210
3D extrusion


Here is an example of how a filter list could be used. Suppoase you want to select all lines on the layer FLOOR and having the color yellow.


(ssget “x” (list (cons 0 “line”) (cons 8 “floor”) (cons 62 “2)


SSLENGTH


After you have created a selection set, then this has been created:


<Selection set: 58697680>


It doesn't tell you how many entities are in the selection set and it doesn’t tell you what entities are in the selection set.


You can find out how many entities there are in the selection set. To do so, use the SSLENGTH function. Used it like this:


(sslength ss)


The variable of the selection set is SS.


SSNAME


But now you want to know the names of the entities that are in the selection set. You can do so by using the SSNAME fucntion.


But take care. First find out the length of the selection set with the SSLENGTH function. And then you can find the names of the entities.


But take care. The index of the first entity is 0. So if the length of the selection set is five, then the indexes are 0, 1, 2, 3, and 4.


Suppose we hhave a selection set and we want to know the nakme oif the first entity. This is how we find it:


(ssname ss 0)


The name of the entity is given back. The name may look like:


<Entity name: 19ef010>


If you want to know more about the entity, use the ENTGET function. The ENTGET function gives back the entity list.


SSADD


You have created a selection set. And now you want to add an entity to the selection set. This is how it is done.


(ssadd et ss)


ET is the variable of the entity that is to be added and SS is the variable that has the selection set.


SSDEL


Now you have a selection set. But you want to remove one entity from the selection set. Do it like this:


(ssdel et ss)


SSMEMB


You wat to be sure that certain entity is a member of the selection set. Use the SSMEMBER function for finding out. Like this:


(ssmemb et ss)


In the example ET is the entity that is to be checked for being in the selection set. The selection set is SS.


If ET is not in the selection set, then NIL is given back. Otherwise the name of the entity is given back.












No comments:

Post a Comment