将以下内容存为*.lsp,用命令APPLOAD加载,后用命令:er,可以删除选择范围内所有重复的圆(留下一个)。
fuzz后面的数字是半径精度
- (defun c:er( / fuzz ss ss2 i ent ent2 lst pt_old r_old r)
- (setq fuzz 0.0001)
- (setq ss (ssget '((0 . "circle"))))
- (setq i 0)
- (while (< i (sslength ss))
- (setq ent (ssname ss i))
- (setq pt (assoc 10 (entget ent)))
- (setq r (cdr (assoc 40 (entget ent))))
- (setq ss2 (ssget "x" (list '(0 . "circle") '(-4 . "=") pt)))
- (ssdel ent ss2)
- (setq j 0)
- (repeat (sslength ss2)
- (setq ent2 (ssname ss2 j))
- (if (equal (cdr (assoc 40 (entget ent2))) r fuzz)
- (progn
- (entdel ent2)
- (ssdel ent2 ss)
- )
- )
-
- (setq j (1+ j))
- )
- (setq i (1+ i))
- )
- (princ)
- )
|