以下未经测试,但应按要求执行:
- (defun c:listdupepoints ( / d f i l s )
- (if (setq s (ssget '((0 . "POINT"))))
- (progn
- (repeat (setq i (sslength s))
- (setq p (cdr (assoc 10 (entget (ssname s (setq i (1- i)))))))
- (if (vl-some (function (lambda ( x ) (equal p x 1e-3))) l)
- (setq d (cons p d))
- (setq l (cons p l))
- )
- )
- (cond
- ( (not d)
- (princ "\nNo duplicate points found.")
- )
- ( (not (setq f (getfiled "" "" "csv" 1)))
- (princ "\n*Cancel*")
- )
- ( (setq f (open f "w"))
- (foreach p d
- (write-line
- (apply 'strcat
- (mapcar '(lambda ( x y ) (strcat (rtos x) y)) p '("," "," ""))
- )
- f
- )
- )
- (close f)
- )
- ( (princ "\nUnable to open file for writing."))
- )
- )
- )
- (princ)
- )
|