- (defun c:cc()
- (setvar "cmdecho" 0)
- (if (= ccvar nil)(setq ccvar (list 2.5 3 1 1 "N" "")))
- (setq r(getreal (strcat "\n圆圈半径<" (rtos (car ccvar)) ">:")))
- (setq h(getreal (strcat "\n输入字高<" (rtos (cadr ccvar)) ">:")))
- (setq n(getint (strcat "\n起始序号<" (itoa (caddr ccvar)) ">:")))
- (setq b(getint (strcat "\n序号位数[前面补0]<" (itoa (cadddr ccvar)) ">:")))
- (initget 0 "Y N")
- (setq k (getkword (strcat "\n是否设置前缀(Y)/(N)<" (nth 4 ccvar)">:")))
- (if (= k nil)(setq k (nth 4 ccvar)))
- (setq s "" marks (nth 5 ccvar))
- (if (= k "Y") (progn
- (setq s (getstring (strcat "\n设置前缀<" marks ">:")))
- (if (= s "")(setq s marks)(setq marks s))
- ))
- (if (= r nil)(setq r (car ccvar)))
- (if (= h nil)(setq h (cadr ccvar)))
- (if (= n nil)(setq n (caddr ccvar)))
- (if (= b nil)(setq b (cadddr ccvar)))
- (setq ss "" bb (itoa n))
- (while (setq pt (getpoint "\n指定起点:"))
- (setq ceo nil)
- (repeat (- b (strlen bb)) (setq ss (strcat ss "0")))
- (if (> r 0) (progn (command "circle" pt r) (setq ceo (entget (entlast)))))
- (command "text" "J" "mc" pt h "" (strcat s ss bb))
- (setq teo (entget (entlast)))
- (command "leader" pt (polar pt (/ pi 4) r) "" "" "n")
- (setq leo (entget (entlast)))
- (setq p1 (cdr (assoc 10 leo)) k 1)
- (while (/= k 3)
- (setq p (grread T))
- (setq k (car p) p (cadr p))
- (if (> r 0) (progn
- (setq ceo (subst (cons 10 p) (assoc 10 ceo) ceo))
- (entmod ceo)
- ))
- (setq teo (subst (cons 11 p) (assoc 11 teo) teo))
- (entmod teo)
- (setq p (polar p (angle p p1) r))
- (setq leo (subst (cons 10 p) (assoc 10 (reverse leo)) leo))
- (if (> (distance p p1) 0.0) (entmod leo))
- )
- (setq n (1+ n) ss "" bb (itoa n))
- )
- (setq ccvar (list r h n b k marks))
- (setvar "cmdecho" 1)
- (princ)
- )
- (princ "\n命令:CC")
- (prin1)
;;此程序有2个BUG:
;;1、选用的字体样式的字高必须设置为0,否则标注错误,望高手修复!
;;2、引线的箭头始终显示为1:1的绘图比例,比如字高和圆圈半径放大了100倍,引线箭头不会放大100倍。
|