- (defun c:tt ()
- (if (and (setq p1 (getpoint "\n基点<退出>: "))
- (setq ss (ssget '((0 . "*LINE,ARC,CIRCLE,ELLIPSE"))))
- )
- (progn
- (setq i -1
- lst '()
- )
- (while (setq s1 (ssname ss (setq i (1+ i))))
- (setq p2 (vlax-curve-getClosestPointTo s1 p1)
- dist (distance p1 p2)
- lst (cons (list dist s1) lst)
- )
- )
- (if lst
- (progn
- (setq lst (vl-sort lst '(lambda (a b) (< (car a) (car b))))
- lst (mapcar 'cadr lst)
- )
- (princ "\n!lst = ")
- (princ lst)
- )
- )
- )
- )
- (princ)
- )
|