|
;;除去坐标相同的点,传入参数 cxb 为xy坐标表
(defun C-check(cxb / n xxx)
(setq n 0 m 0 xxx '())
(setq cxb (vl_sort cxb
(function (lambda (e1 e2)
(< (car e1) (car e2)) ) ) ))
(while (< n (length cxb))
(setq cx1 (nth n cxb)
xxx (cons (nth n cxb) xxx)
n (1+ n)
cx2 (nth n cxb)
)(while (= (car cx1)(car cx2))
(setq n (+ 1 n) m (1+ m)
cx2 (nth n cxb))
))(if (> m 0)
(princ (strcat " 共有坐标的点 " (itoa m) " 个")))
(reverse xxx)
)
(defun vl_sort (lst fun / k nlst lst2)
(foreach n lst
(setq k T
lst2 (apply 'append (mapcar '(lambda (x)
(if (and K ((eval fun) n x)) (progn (setq k nil) (list n x)) (list x))
) nlst))
nlst (if K (append lst2 (list n)) lst2)
)
)
)