马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- (defun c:bb()(vl-load-com)(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)") zk (getreal "\n-->标注字宽默认:0.7)"))
- (if (= ht nil) (setq ht 2.5))(if (= zk nil) (setq zk 0.7))(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))
- (defun zcx()(setvar "osmode" 0)
- (setq p2 (polar p1 0 10) a1 (car p1 ) c1 (car p2) vx (* (- (strlen TXT) 0.2) (* ht 0.75))
- le vx bb_sp(vla-get-Modelspace (vla-get-activeDocument (vlax-get-acad-object))))
- (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)))
- (vla-addline bb_sp (vlax-3d-point p1) (vlax-3d-point p2))
- (setq en1 (entlast))(vla-addline bb_sp (vlax-3d-point p2) (vlax-3d-point pp))
- (setq en2 (entlast))(vla-addtext bb_sp TXT (vlax-3d-point p3) ht)
- (entmod (subst (cons 41 zk) (assoc 41 (entget (entlast)))(entget (entlast))))
- (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))))(princ))
|