从选定对象创建选择集
支持的平台:视窗和 Mac OS
签名
(ssget [sel-method] [pt1 [pt2]] [pt-list] [filter-list])
-
塞尔法
-
类型:字符串
对象选择方法。
有效的选择方法是
一个
|
所有对象均被选中。
|
C
|
交叉选择;所有对象都与指定矩形交叉并在指定矩形内。
|
正中电
|
交叉多边形选择;所有与指定多边形交叉且位于指定多边形内的对象。
|
F
|
围栏选择。
|
我
|
隐含选择;在 AutoCAD PICKFIRST 系统变量生效时选定的对象。
注意:该函数返回有效的选择集或。如果在调用函数时选择了对象,则返回有效的选择集。ssgetnil
|
L
|
添加到数据库的最后一个可见对象。
|
P
|
将选择上一个选择集。
|
W
|
窗口选择(指定矩形内的所有对象)。
|
可湿性粉剂
|
窗口多边形(指定多边形内的所有对象)。
|
X
|
整个数据库。如果指定选择方法且未提供筛选器列表,则选择数据库中的所有实体,包括图层上关闭、冻结和不在可见屏幕的实体。Xssget
|
:D
|
允许选择重复的对象。
|
:E
|
光标的对象选择选择框中的所有内容都将被选中并添加到选择集中。
|
:L
|
仅允许选择未锁定的图层。
|
:N
|
调用有关在操作期间选择的任何实体的容器块和转换矩阵的其他信息。此附加信息仅适用于通过图形选择方法(如“窗口”、“交叉”和“点拾取”)选取的图元。ssnamexssget
与其他对象选择方法不同,:N可能会在选择集中返回具有相同实体名称的多个实体。例如,如果用户选择复杂实体(如 BlockReference、PolygonMesh 或旧样式折线)的子实体,则在确定是否已选择该子实体时,会查看该子实体。但是,实际上将主实体(块引用、多边形网格等)添加到选择集中。结果可能是选择集中具有相同实体名称的多个条目(每个条目都有不同的子实体信息)。ssgetssgetssnamex
|
_:R
|
允许选择长事务中的实体。
|
:S
|
仅允许单个选择,可以选择一个或多个对象。
注意:使用“+.”和“:S”强制选择单个对象。
|
_: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.
|
#
|
Controls which object selection modes are allowed.
In combination with "+" and "-", use the following keywords to control the corresponding selection modes:
- A - All
- B - Box and AUto
- C - Crossing and CPolygon
- F - Fence
- G - Group
- L - Last
- M - Multiple
- P - Previous
- W - Window and WPolygon
;; Allow for a single selection
(ssget "_:S")
Select objects: ?
*Invalid selection*
Expects a point or Window/Last/Crossing/BOX/ALL/Fence/WPolygon/CPolygon/Group/Previous/AUto
;; Allow the user to only pick a single object
(ssget "_:S+.")
Select objects: ?
*Invalid selection*
Expects a single object.
;; Allow the user to only pick a single object or
;; use the Last or Previous selection modes
(ssget "_:S+L+P")
Select objects: ?
*Invalid selection*
Valid keywords: Last/Previous
;; Remove the Multiple and All selection modes
(ssget "-M-A")
Select objects: ?
*Invalid selection*
Expects a point or Window/Last/Crossing/BOX/Fence/WPolygon/CPolygon/Group/Add/Remove/Previous/Undo/AUto/SIngle
|
-
pt1
-
Type: List
A point relative to the selection.
-
pt2
-
Type: List
A point relative to the selection.
-
pt-list
-
Type: List
A list of points.
-
filter-list
-
Type: List
An association list that specifies object properties. Objects that match the
filter-list are added to the selection set.
Return Values
Type: Pickset (selection set) or nil
The name of the created selection set if successful; otherwise
if no objects were selected.
nil
Remarks
Selection sets can contain objects from both paper and model space, but when the selection set is used in an operation,
filters out objects from the space not currently in effect. Selection sets returned by
contain main entities only (no attributes or polyline vertices).
ssgetssget
If you omit all arguments,
prompts the user with the Select Objects prompt, allowing interactive construction of a selection set.
ssget
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.
- When using the
selection method, if the user selects a subentity of a complex entity such as a BlockReference, PolygonMesh, or old style polyline,
looks at the subentity that is selected when determining if it has already been selected. However,
actually adds the main entity (BlockReference, PolygonMesh, etc.) to the selection set. It is therefore possible to have multiple entries with the same entity name in the selection set (each will have different subentity information for
to report). Because the
method does not guarantee that each entry will be unique, code that relies on uniqueness should not use selection sets created using this option.
:Nssgetssgetssnamex:N
- When using the
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,
with the
option will return
.
Lssget"L"nil
Examples
Prompt the user to select the objects to be placed in a selection set:
(ssget)
<Selection set: 2>
Create a selection set of the object passing through (2,2):
(ssget '(2 2))
nil
Create a selection set of the most recently selected objects:
(ssget "_P")
<Selection set: 4>
Create a selection set of the objects crossing the box from (0,0) to (1,1):
(ssget "_C" '(0 0) '(1 1))
<Selection set: b>
从 (0,0) 创建窗口内对象的选择集:
(ssget "_W" '(0 0) '(5 5))
<Selection set: d>
通过指定滤镜,可以获得一个选择集,其中包含给定类型、给定图层上或给定颜色的所有对象。下面的示例返回一个选择集,该选择集仅由蓝线组成,蓝线是隐含选择集的一部分(在 AutoCAD PICKFIRST 系统变量生效时选定的对象):
(ssget "_I" '((0 . "LINE") (62 . 5)))
<Selection set: 4>
以下示例要求将点列表传递给函数。变量不能包含定义零长度线段的点。ssgetpt_list
创建点列表:
(setq pt_list '((1 1)(3 1)(5 2)(2 4)))
((1 1) (3 1) (5 2) (2 4))
创建一个选择集,其中包含与pt_list定义的多边形交叉和内部的所有对象:
(ssget "_CP" pt_list)
<Selection set: 13>
在由pt_list定义的面内创建所有蓝线的选择集:
(ssget "_WP" pt_list '((0 . "LINE") (62 . 5)))
<Selection set: 8>
仅当使用时不带参数时,所选对象才会突出显示。选择集使用 AutoCAD 临时文件槽,因此不允许 AutoLISP 一次打开超过 128 个文件槽。如果达到此限制,AutoCAD 将无法再创建任何选择集并返回到所有调用。要关闭不必要的选择集变量,请将其设置为 。ssgetnilssgetnil
可以将选择集变量传递给 AutoCAD,以响应任何“选择对象”提示,此时“最后一个”的选择有效。然后,AutoCAD 将选择选择集变量中的所有对象。
对象捕捉模式的当前设置将被忽略,除非您在函数中特别请求它。ssget
|