本帖最后由 fan_zh 于 2014-12-9 13:28 编辑
- ;;;统计相同矩形边长的数量.
- ;;;编写日期2013-07-05
- ;;;编写: CADMAN
- ;;;子函数 (求矩形边长)
- ;(defun qbc (pts / b h)
- ;(setq b (distance (car pts) (cadddr pts)))
- ;(setq h (distance (car pts) (cadr pts)))
- ;(cons (max b h) (min b h))
- ;);结束qbc
- (defun c:tg ( / bclst pts ss el bc_new i p2 p3 m x1 x2)
- (princ "\n请框选:")
- (setq ss (ssget '((0 . "circle"))))
- (setq i 0 bclst nil pts nil)
- (repeat (sslength ss)
- (setq el (entget (ssname ss i)))
- (setq pts nil)
- (foreach pt el (if (= (car pt) 40) (setq pts (cons (cdr pt) pts))))
- (setq bclst (cons pts bclst))
- (setq i (1+ i))
- );repeat
- (setq bc_new nil)
- (while bclst
- (setq m (car bclst) x1 (length bclst))
- (setq bclst (vl-remove m bclst))
- (setq x2 (length bclst))
- (setq n (- x1 x2))
- (setq bc_new (cons (list m n) bc_new))
- )
- (setq p2 (getpoint "\起始位置"))
- (setq p3 (polar p2 0 3000))
- (command "_.TEXT" "c" (polar p2 (* pi 0.5) 800) "300" "0" "半径");指定书写标题的位置
- (command "_.TEXT" "c" (polar p3 (* pi 0.5) 800) "300" "0" "数量")
- (foreach bg bc_new ;设定重复次数为新表的长度
- (command "_.TEXT" "c" p2 "300" "0" (strcat (rtos (car (car bg)) 2)))
- (command "_.TEXT" "c" p3 "300" "0" (cadr bg))
- (setq p2 (polar p2 (* pi 1.5) 800))
- (setq p3 (polar p2 0 3000))
- )
- (princ)
- )
|