经反复测试,发现你的图并没有重合点,即使是视觉上的重合都没有。
测试程序如下,你可以自己画几个点试一下,可以Z值不同,再把两个挪得很近,只要大于你定的0.001,就完全可以。。。
- (defun c:chpoint (/ ss len1 i ii si se xx yy ss1 len2 j ent ents xx1 yy1)
- (setvar "cmdecho" 0)
- (setvar "pickbox" 0)
- (command "_.undo" "be")
- (command "pdmode" "0" "zoom" "e" "regen")
- (setq ss (ssget "x" '((0 . "point") (8 . "58"))))
- (setq len1 (sslength ss))
- (setq i 0
- ii 0
- )
- (while (< i len1)
- (setq si (ssname ss i))
- (setq se (entget si))
- (setq xx (cadr (assoc 10 se)))
- (setq yy (caddr (assoc 10 se)))
- (setq ss1 (ssget "c"
- (list (- xx 0.001) (- yy 0.001))
- (list (+ xx 0.001) (+ yy 0.001))
- (list (cons 0 "point") (cons 8 "58"))
- )
- )
- (if ss1
- (progn
- (ssdel si ss1)
- (setq len2 (sslength ss1))
- )
- (setq len2 0)
- )
- (if (> len2 0)
- (progn
- (setq j 0)
- (repeat len2
- (setq ent (ssname ss1 j))
- (setq ents (entget ent))
- (setq xx1 (cadr (assoc 10 ents)))
- (setq yy1 (caddr (assoc 10 ents)))
- (if (and (equal xx xx1 0.001) (equal yy yy1 0.001))
- (progn
- (entdel ent)
- (ssdel ent ss)
- (setq len1 (1- len1))
- (setq ii (+ ii 1))
- )
- )
- (setq j (1+ j))
- )
-
- )
- )
- (setq i (+ i 1))
- (grtext -2
- (strcat "共有" (itoa len1) ",已处理" (itoa i) "个大量点!")
- )
- )
- (command "_.undo" "e")
- (setvar "cmdecho" 1)
- (prompt "检查完毕,共有")
- (princ ii)
- (prompt "个重合点!")
- (princ)
- )
|