本帖最后由 ymcui 于 2016-8-4 16:35 编辑
- (defun c:ttt ()
- (setq os (getvar "osmode"))
- (setvar "osmode" 0)
- (princ "\n请选择要进行统计的圆")
- (setq ss (ssget (list (cons 0 "CIRCLE")))
- #FF (getpoint "\n 指定放置列表基点:")
- si 0 tx 65 px (car #FF) py (cadr #FF) li '() lii 0)
- (repeat (sslength ss)
- (setq cs (ssname ss si) ce (entget cs)
- cp (cdr (assoc 10 ce))
- cr (cdr (assoc 40 ce)))
- (if (setq lst (assoc cr li))
- (setq ct (nth 1 lst) li (subst (list cr ct (1+ (nth 2 lst))) lst li))
- (setq ct tx tx (1+ tx) li (cons (list cr ct 1) li))
- )
- (command "_.text" (polar cp (/ pi 4) (+ cr 1)) 3 0 (chr ct) "_.chprop" "l" "" "p" "c" 2 "")
- (setq si (1+ si))
- )
- (foreach l li
- (setq cr (nth 0 l) ct (nth 1 l) cn (nth 2 l)
- cpW (list (+ px 16) (+ py (* lii 6)))
- cp1W (list (+ px -5) (+ py (* lii 6)))
- cp2W (list (+ px 39.2) (+ py (* lii 6)))
- cp3W (list (+ px -13.6) (+ py (* lii 6)))
- cp (polar cpW (* pi 1.5) -1)
- cp1 (polar cp1W (* pi 1.5) -1)
- cp2 (polar cp2W (* pi 1.5) -1)
- cp3 (polar cp3W (* pi 1.5) -1)
- cp4 (polar cp2W (* pi 1.5) -8)
- ct1 (- ct 64))
- (command "_.text" "j" "C" cp3 4 "" (rtos ct1 5)
- "_.text" "j" "C" cp1 4 0 (strcat (chr ct))
- "_.chprop" "l" "" "p" "c" 2 ""
- "_.text" "j" "C" cp 4 0 (strcat "%%C" (rtos (* cr 2) 2 2))
- "_.chprop" "l" "" "p" "c" 2 ""
- "_.text" "j" "C" cp2 4 0 (strcat (itoa cn))
- "_.chprop" "l" "" "p" "c" 2 "")
- (setq lii (1+ lii))
- )
- (command "_.text" "j" "C" cp4 4 0 (strcat "总数=" (itoa (sslength ss)) "个"))
- (foreach l li
- (setq #FF (polar #FF (* pi 0.5) (* 6 1)))
- (command "_.line"
- (polar #FF pi (* 4 4.5))
- (polar #FF 0 (* 4 12))
- ""
- )
- (command "_.chprop" "l" "" "p" "c" 1 ""
- "_.ARRAY" (entlast) "" "R" (+ (length R1_LIST) 2) "" (* -2 3)
- "_.line" (polar #FF pi (* 4 4.5)) (cdr (assoc 10 (entget (entlast)))) ""
- "_.chprop" "l" "" "p" "c" 1 "")
- (setq LL (entlast))
- (command "_.COPY" LL "" #FF (polar #FF 0 (* 4 4.3))
- "_.COPY" LL "" #FF (polar #FF 0 (* 4 12.5))
- "_.COPY" LL "" #FF (polar #FF 0 (* 4 16.5))
- "_.COPY" LL "" #FF (polar #FF 0 (* 4 2.2)))
- (setq lii (1+ lii))
- )
- (setvar "osmode" os)
- (PRINC)
- )
|