|
- ;;参数 pt 位置点坐标
- ;; jd 查找半径
- (defun gxl-sel-SSgetByPoint (pt jd / px py px0 px1 py0 py1 ss pz rtn e)
- (setq px (car pt)
- px0 (- px jd)
- px1 (+ px jd)
- py (cadr pt)
- py0 (- py jd)
- py1 (+ py jd)
- pz 1e99
- )
- (setq ss
- (ssget "x"
- (list '(0 . "point")
- '(-4 . "<and")
- '(-4 . ">=,>=,<>")
- (list 10 px0 py0 pz)
- '(-4 . "<=,<=,<>")
- (list 10 px1 py1 pz)
- '(-4 . "and>")
- )
- )
- )
- (if ss
- (progn
- (repeat (setq n (sslength ss))
- (if (<= (distance (list (car pt) (cadr pt)) (cdr (assoc 10 (entget (setq e (ssname ss (setq n (1- n)))))))) jd)
- (setq rtn (cons e rtn))
- )
- )
- )
- )
- ;;颜色变红提示
- (foreach e rtn (entmod (append (entget e) '((62 . 1)))))
- ;;返回选中点图元名列表
- rtn
- )
- ;;测试
- (defun c:tt (/ pt jd)
- (setq rtn (gxl-sel-SSgetByPoint (setq pt (getpoint "\n位置点:")) (setq jd (getdist pt "\n半径:"))))
- (command "circle" "采用non" pt jd)
- (princ (strcat "\n选中" (itoa (length rtn)) "个点."))
- (princ)
- )
复制代码 |
|