我认为:
- (defun c:npts(/ ptSet tPt ptLst outLst)
- (if
- (and
- (setq ptSet(ssget "_X" '((0 . "POINT"))))
- (<= 3(sslength ptSet))
- (setq tPt(getpoint "\nSpecify testing point: "))
- ); end and
- (progn
- (setq ptLst(vl-sort
- (mapcar '(lambda(x)(cons(distance x tPt)x))
- (mapcar 'cdr
- (mapcar '(lambda(x)(assoc 10 x))
- (mapcar 'entget(vl-remove-if 'listp
- (mapcar 'cadr(ssnamex ptSet)))))))
- '(lambda(a b)(<(car a)(car b)))))
- (setq outLst(mapcar 'cdr
- (list(car ptLst)(cadr ptLst)(nth 2 ptLst))))
- ); end progn
- ); end if
- ); end of c:npts
并在功能中使用它:
[code](defun Get\u Nearest\u Points(ptSet/ptSet-tPt-ptst-outLst)(princ“\n>”)(if(和ptSet( |