- 积分
- 276
- 明经币
- 个
- 注册时间
- 2014-7-19
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
以下程序又KK大神提供,源码中不含字宽设置选项,工作原因,所有文字字宽0.7,不知有没有高手帮忙改进。
(defun zcx()
(setvar "osmode" 0)
;(setq p2 (getpoint P1 "\n-->请指定文字位置:")
(setq p2 (polar p1 0 10)
a1 (car p1 )
c1 (car p2)
vx (* (- (strlen TXT) 0.2) (* ht 0.75))
le vx
)
(if (< c1 a1)
(setq pp (polar p2 pi le)
p3 (polar pp (/ pi 2) zj)
)
(setq pp (polar p2 0 le)
p3 (polar p2 (/ pi 2) zj)
))
(command "line" p1 p2 "")
(setq en1 (entlast))
(command "line" p2 pp "")
(setq en2 (entlast))
(command "text" P3 ht 0 TXT)
(setq en3 (entlast))
(setq ent1 (entget en1)
ent2 (entget en2)
ent3 (entget en3))
(setq le1 (caadr (textbox ent3)))
(setq le (* 1.2 le1)
jl (* 0.1 le1))
(while (= (car (setq mouse (grread t 0 0))) 5)
(setq pt (cadr mouse))
(if (>= (car pt)(car p1))
(progn
;以下句子可自行简写
(setq ent1 (subst (cons 11 pt)(assoc 11 ent1) ent1))
(entmod ent1)
(setq ent2 (subst (cons 10 pt)(assoc 10 ent2) ent2))
(entmod ent2)
(setq ent2 (subst (cons 11 (polar pt 0 le))(assoc 11 ent2) ent2))
(entmod ent2)
(setq ent3 (subst '(72 . 0) (assoc 72 ent3) ent3))
(setq ent3 (subst (cons 10 (list (+ (car pt) jl) (+ (cadr pt) zj)))(assoc 10 ent3) ent3))
(entmod ent3)
)
(progn
(setq ent1 (subst (cons 11 pt)(assoc 11 ent1) ent1))
(entmod ent1)
(setq ent2 (subst (cons 10 pt)(assoc 10 ent2) ent2))
(entmod ent2)
(setq ent2 (subst (cons 11 (polar pt pi le))(assoc 11 ent2) ent2))
(entmod ent2)
(setq ent3 (subst '(72 . 2) (assoc 72 ent3) ent3))
(setq ent3 (subst (cons 10 (list (- (car pt) jl) (+ (cadr pt) zj)))(assoc 10 ent3) ent3))
(setq ent3 (subst (cons 11 (list (- (car pt) jl) (+ (cadr pt) zj)))(assoc 11 ent3) ent3))
(entmod ent3)
)
)
);while
(princ)
)
(defun c:KK()
(setq AA (getvar "clayer"))
(setq layer "文字 text")(if (not (tblsearch "layer" layer ))
(progn (command "layer" "new" "文字 text" "s" "文字 text" "C" 212 "" "L" "Continuous" "" "LW" 0.2 "" "")
))
(COMMAND "CLAYER" layer)
(setvar "texteval" 1)
(setvar "cmdecho" 0)
(setq vv (getvar "osmode"))
(setq ht (getreal "\n-->标注字高默认:2.5)"))
(if (= ht nil) (setq ht 2.5))
(setq zj (/ ht 3))
(setq n 0)
(while (= n 0)
(setq TXT (getstring "\n-->请输入文字:"))
(setvar "osmode" 33)
(if (/= txt "")
(setq p1 (getpoint "\n-->请指定点坐标:")
)
)
(if (= txt "") (setq n 1)(zcx))
)
(setvar "osmode" vv)
(princ)
)
|
|