- ;;选取当前显示的图元
- (defun SEL (/ CTR SIZE SCREEN SCALE SIZE XSIZE RT LB SS)
- (command "_.UCS" "V")
- (setq CTR (getvar "VIEWCTR"))
- (setq SIZE (getvar "VIEWSIZE"))
- (setq SCREEN (getvar "SCREENSIZE"))
- (setq SCALE (/ (car SCREEN) (cadr SCREEN)))
- (setq XSIZE (* SCALE SIZE))
- (setq RT (list (+ (car CTR) (/ XSIZE 2)) (+ (cadr CTR) (/ SIZE 2))))
- (setq LB (list (- (car CTR) (/ XSIZE 2)) (- (cadr CTR) (/ SIZE 2))))
- (setq SS (ssget "c" RT LB))
- (command "_.UCS" "P")
- SS
- );;遍歷选集
- (defun C:TT (/ SS N)
- (if (setq N 0
- SS (SEL)
- )
- (repeat (sslength SS)
- (print (ssname SS N))
- (setq N (1+ N))
- )
- )
- (princ)
- )
|