ssget用法大全(基本上把能想到都覆盖了)
(setq ss (ssget ":S" '((0 . "LINE")))) ;只选取一次直线(省约回车)(setq ss (ssget "X" '((0 . "LINE")))) ;自动选取直线,包含冻结的直线
(setq ss (ssget "A" '((0 . "LINE")))) ;自动选取直线,不包含冻结的直线
(setq ss (ssget '((1 . "**")))) ;只选取含数字的文本
(setq ss (ssget '((1 . "*#*")))) ;只选取含数字的文本
(setq ss (ssget '((0 . "TEXT") (1 . "~*[~`--9]*")))) ;只选取数字文本
(ssget '((0 . "TEXT")(-4 . "<NOT")(1 . "**")(-4 . "NOT>")));只选择不是数字的文字
(ssget '((0 . "TEXT")(1 . "~*#*")));只选择不是数字的文字
(setq ss (ssget '((0 . "TEXT")(1 . "#,1#,2#,3#,4#,50"))));选取1—50的数字文本
(SETQ SS (SSGET '((0 . "*text")(1 . "*(*,*)*,*(*,**)**"))));选取含括号的文本
(setq ss (ssget '((1 . "**"))));只选取字母
(setq ss (ssget '((0 . "~insert")))) ;选取不含块的对象
(SETQ ss (ssget (list '(0 . "CIRCLE")(cons 40 RR))));按半径的大小选取圆
(setq ss (ssget ":E:S" '((0 . "line"))));选取拾取框内的直线,选取不到就结束
(setq ss (ssget ":E" '((0 . "LINE"))));选取拾取框内的直线,选取不到就不结束,直到按右键
(setq ss (ssget ":N" '((0 . "LINE"))));只有通过窗口、窗交点拾取
(setq ss (ssget ":D" '((0 . "LINE"))));会累加选取的直线,同一条直线,选取两次个数就会乘以2,3次则3.....
(setq ss (ssget ":L" '((0 . "LINE"))));提示有几个在锁定图上,选取没有的锁定的直线
(setq ss (ssget "P" '((0 . "LINE"))));上次的选择集
(setq ss (ssget '((0 . "line")(8 . "~0"))));选取0层以外的线
(setq ss (ssget '((0 . "line")(8 . "~**"))));选取图层名不含字母以外的线
(setq ss (ssget '((0."CIRCLE") (-3 ("APPNAME")))));选取带扩展数据的实体(圆)
;得到矩形p1 p2点框内的文字,包含在框内的被选取 相交的不选取,屏幕外的选取不到,WP点集
(setq ss(ssget "w" pt1 pt3 '((0 . "*text"))))
;得到矩形p1 p2点框内的文字,包含在框内的及和框相交的被选取,屏幕外的选取不到,CP点集
(setq ss(ssget "c" pt1 pt3 '((0 . "*text"))))
;线相交的线删除(屏幕外的选取不到郁闷所以要用zoom "ob")
(defun c:XX( / pt ptl ss)
(setq ptl nil)
(while (setq pt (getpoint))
(setq ptl (cons pt ptl))
)
(setq ss (ssget "f" ptl '((0 . "line"))))
(KX-E SS)
)
;选取图层表("CENTER" "DIM" "COOL" "CORE" -------N个图层)内的线
(setq la '("CENTER" "DIM" "COOL" "CORE")
ss (ssget (list '(0 . "LINE") (cons 8 (apply 'strcat (mapcar '(lambda (x) (strcat x ",")) la)))))
)
;选取经过某点的实体
(setq pt (getpoint))
(setq ss (ssget "C" pt pt))
;选取不含数字的文本
(setq ss (ssget '
((-4 . "<AND")
(0 . "*TEXT")
(-4 . "<NOT")
(1 . "**")
(-4 . "NOT>")
(-4 . "AND>")
)
)
)
;只选取不含字母的文本
(setq ss (ssget '
((-4 . "<AND")
(0 . "*TEXT")
(-4 . "<NOT")
(1 . "**")
(-4 . "NOT>")
(-4 . "AND>")
)
)
)
;------------------------------------------------------------------------------------------------------------
;"图层1" "图层2""图层n中的文本,图层1为层名
(SETQ SS (ssget "x"
(list
'(0 . "TEXT")
(cons 8 "图层")
)
)
)
;------------------------------------------------------------------------------------------------------------
;选取0层以外的线
(setq ss
(ssget '
((-4 . "<AND")
(0 . "line")
(-4 . "<NOT")
(8 . "0")
(-4 . "NOT>")
(-4 . "AND>")
)
)
)
;------------------------------------------------------------------------------------------------------------
;按颜色号选取对象
(setq col (KX-Int 7 "" "颜色号" col 1))
(setq SS (ssget
(list
'(-4 . "<OR")
(cons 62 COL)
'(-4 . "OR>")
)
)
)
;-----------------------------------------------------------------------------------------------------------
;选取含KX的文本
(setq XT (strcat "*" "KX" "*"));KX为文字内容
(ssget (list
'(0 . "text")
(cons 1 XT)
)
)
;-----------------------------------------------------------------------------------------------------------
;判断选取某个区域有没有直线
(setq SS (ssget "c"
(polar '(0 0) (* 0.25 pi) 0.5);坐标点
(polar '(0 0) (* 1.25 pi) 0.5);坐标点
'((0 . "LINE"))
)
)
;-----------------------------------------------------------------------------------------------------------
;选取颜色不是随层的圆、直线
(setq SS (ssget "X"
'((0 . "CIRCLE,LINE")
(-4 . "/=")(62 . 256);-462"面不可以加AND OR
)
)
)
;------------------------------------------------------------------------------------------------------------
;选取颜色1和2的对象(OR)的用法
(setq ss (ssget '((-4 . "<or")
(62 . 2)
(62 . 1)
(-4 . "or>")
)
)
)
;--------------------------------------------------------------------------------------------------------------
;选取半径大于20小于100的圆
(setq ss (ssget '
((-4 . "<and")
(0 . "circle")
(-4 . ">")(40 . 20);大于20
(-4 . "<")(40 . 100);小于100
(-4 . "and>")
)
)
)
;--------------------------------------------------------------------------------------------------------------
;只选取"文字(包括多行文字)、尺寸、带属性的块
(setq ss (SSGET '
((-4 . "<OR")
(0 . "*TEXT,DIMENSION")
(-4 . "<AND")
(0 . "INSERT")
(66 . 1)
(-4 . "AND>")
(-4 . "OR>")
)
)
)
;--------------------------------------------------------------------------------------------------------------
;屏幕外的窗口模式选取
(setq rec_p1 '(0 0)) ;窗口左下角点
(setq rec_p2 '(1000 1000)) ;窗口右上角点
(setq filter_list
(list
'(0. "insert")
'(-4 . "<and")
'(-4 . ">,>,*") (cons 10 rec_p1)
'(-4 . "<,<,*") (cons 10 rec_p2)
'(-4 . "and>")
)
)
(ssget "x" filter_list)
;--------------------------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------------------------
;一次产生n个不同选取集
(if (setq ss (ssget)) (setq ss1 (ssget "_p" '((0 . "*TEXT")))));从选择集中分解出文字
;空回车得出不同结果的选取集
(if (setq ss (ssget))
(setq ss (ssget "_p" flt))
(setq ss (ssget "_x" flt))
)
;--------------------------------------------------------------------------------------------------------------
;;;坐标范围选择,有点类似(ssget "c" p1 p2 filter),但本函数在屏幕外的也可选择
;;;测试 (tt (getpoint) (getpoint) '((0 . "insert")))
(defun tt (p1 p2 filter / minX minY maxX maxY)
(setq minX (min (car p1) (car p2))
minY (min (cadr p1) (cadr p2))
maxX (max (car p1) (car p2))
maxY (max (cadr p1) (cadr p2))
)
(if filter
(ssget "x"
(append (list '(-4 . "<and")
'(-4 . ">=,>=,*")
(list 10 minX minY 0)
'(-4 . "<=,<=,*")
(list 10 maxX maxY 0)
)
(append filter '((-4 . "and>")))
)
)
(ssget "X"
(list '(-4 . "<and")
'(-4 . ">=,>=,*")
(list 10 minX minY 0)
'(-4 . "<=,<=,*")
(list 10 maxX maxY 0)
'(-4 . "and>")
)
)
)
)
(setq ss (ssget "" '((0 . "LINE"))));会累加选取的直线,同一条直线,选取两次个数就会乘以2,3次则3.....
(setq ss (ssget "" '((0 . "LINE"))));提示有几个在锁定图上,选取没有的锁定的直线
(setq ss (ssget "" '((0 . "LINE"))));上次的选择集
这三个是什么 本帖最后由 1291500406 于 2019-4-7 13:52 编辑
894560869 发表于 2019-4-6 11:21
(setq ss1 (ssget "P" '((0 . "line.LWPOLYLINE"))))(command"Explode" ss1)
(setq ss(ssget "P" '((0 ...
(defun c:bb()(setvar "cmdecho" 0)(command "undo" "be")(setq bb1(ssget '((0 . "line,LWPOLYLINE"))))
(setvar "qaflags" 1)(command "explode" bb1 "")(setvar "qaflags" 0)(setq bb2 (ssget "p"))
(if bb2 (progn(command ".select" bb1 bb2 "")(setq bb3 (ssget "p")))(setq bb3 bb1))
(sssetfirst nil bb3)(zg_makeblock bb3)(command "undo" "e")(setvar "cmdecho" 1)(princ))
(setq ss (ssget ":D" '((0 . "LINE"))));会累加选取的直线,同一条直线,选取两次个数就会乘以2,3次则3.....
(setq ss (ssget ":L" '((0 . "LINE"))));提示有几个在锁定图上,选取没有的锁定的直线
(setq ss (ssget "P" '((0 . "LINE"))));上次的选择集
张大锤 发表于 2018-7-2 08:35
(setq ss (ssget "" '((0 . "LINE"))));会累加选取的直线,同一条直线,选取两次个数就会乘以2,3次则3..... ... 整理的很好,方便用了,楼主辛苦了 楼主辛苦了 谢谢分享。。。。 谢谢分享。。。。 留个脚印!谢谢整理分享 很详细!非常给力! 谢谢分享经验。。。。。学习一下。 好样的!!!!!!!!!!!支持一下 楼主辛苦了