本帖最后由 xyp1964 于 2019-1-26 17:05 编辑
- ;; xyp-Ssdel 选择集中删除特定类实体 (xyp-Ssdel sss "1")
- ;|
- 实例:
- 删除特定图层实体:
- (setq ss (xyp-Ssdel (ssget) 8 "1"))
- (setq ss (xyp-Ssdel (ssget) 8 '("1" "2")))
- 删除特定实体:
- (setq ss (xyp-Ssdel (ssget) 0 "circle"))
- (setq ss (xyp-Ssdel (ssget) 0 '("Line" "arc")))
- 删除特定文本:
- (setq ss (xyp-Ssdel (ssget) 1 "test"))
- (setq ss (xyp-Ssdel (ssget) 1 '("test" "测试")))
- |;
- (defun xyp-Ssdel (sss code lst / ss i s1)
- (if (= (type sss) 'PICKSET)
- (progn
- (cond ((= (type lst) 'STR)
- (setq ss (ssadd)
- i -1
- )
- (while (setq s1 (ssname sss (setq i (1+ i))))
- (if (/= (strcase (cdr (assoc code (entget s1)))) (strcase lst))
- (setq ss (ssadd s1 ss))
- )
- )
- )
- ((= (type lst) 'LIST)
- (foreach x lst
- (setq ss (xyp-Ssdel sss x)
- sss ss
- )
- )
- )
- )
- ss
- )
- )
- )
|