- 积分
- 106
- 明经币
- 个
- 注册时间
- 2011-5-16
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
(defun c:fw(/ blip cmd ade dec prec nits bzx inipoint endpoint p1
p2 cs_from cs_to ini end p1_ucs p2_ucs xini xend
yini yend xp1_ucs yp1_ucs xp2_ucs yp2_ucs tt jdh1
jdd1 fwj os_mode bz_point mn node zdfwj)
(setq blip (getvar "blipmode"))
(setq cmd (getvar "cmdecho"))
(setq ade (getvar "dimadec"))
(setq dec (getvar "dimdec"))
(setq prec (getvar "auprec"))
(setq nits (getvar "aunits"))
(setvar "blipmode" 0)
(setvar "cmdecho" 1)
(setvar "dimadec" 5)
(setvar "dimdec" 3)
(setvar "auprec" 5)
(setvar "aunits" 3)
(prompt "\n请选要标注方位角的直线,它不能是多义线")
(setq bzx (entsel))
(setq bzx (entget (car bzx)))
(setq inipoint (cdr (assoc 10 bzx)))
(setq endpoint (cdr (assoc 11 bzx)))
(prompt "\n请按起点至终点的顺序选直线上的两个点,以便定方位")
(prompt "\n请输入起点")
(setq p1 (getpoint))
(prompt "\n请输入终点")
(setq p2 (getpoint))
(setq cs_from 0)
(setq cs_to 1)
(setq ini (trans inipoint cs_from cs_to))
(setq end (trans endpoint cs_from cs_to))
(setq p1_ucs (trans p1 cs_from cs_to))
(setq p2_ucs (trans p2 cs_from cs_to))
(setq xini (car ini))
(setq yini (cadr ini))
(setq xend (car end))
(setq yend (cadr end))
(setq xp1_ucs (car p1_ucs))
(setq yp1_ucs (cadr p1_ucs))
(setq xp2_ucs (car p2_ucs))
(setq yp2_ucs (cadr p2_ucs))
(setq tt 0)
(if (> (abs (- xini xend)) 0.000001)
(progn
(if (>= (/ (- yini yend) (- xini xend)) -0.00001)
(progn
(if (< xp1_ucs xp2_ucs)
(progn
(setq TT 1)
)
)
(if (> xp1_ucs xp2_ucs)
(progn
(setq TT 3)
)
)
)
)
(if (< (/ (- yini yend) (- xini xend)) -0.00001)
(progn
(if (< yp1_ucs yp2_ucs)
(progn
(setq TT 2)
)
)
(if (> yp1_ucs yp2_ucs)
(progn
(setq TT 4)
)
)
)
)
)
)
(if (< (abs (- xini xend)) 0.00001)
(progn
(if (< yp1_ucs yp2_ucs)
(progn
(setq tt 5)
)
)
(if (> yp1_ucs yp2_ucs)
(progn
(setq tt 6)
)
)
)
)
(if (< tt 5)
(progn
(setq JDh1 (atan (abs (- yini yend)) (abs (- xini xend))))
(setq JDD1 (angtos JDh1 1 5)) ;小于二分之一PI的弧度转化为角度,且为字符串
(if (= tt 1)
(progn
(setq JDh2 (- (* 0.5 PI) JDh1))
(setq JDD1 (angtos JDh2 1 5))
(setq fwj (strcat "NE" JDD1))
)
)
(if (= tt 2)
(progn
(setq JDh2 (+ JDh1 (* 1.5 PI)))
(setq JDD1 (angtos JDh2 1 5))
(setq fwj (strcat "NW" JDD1))
)
)
(if (= tt 3)
(progn
(setq JDh3 (- (* 1.5 PI) JDh1 ))
(setq JDD1 (angtos JDh3 1 5))
(setq fwj (strcat "SW" JDD1))
)
)
(if (= tt 4)
(progn
(setq JDh3 (+ JDh1 (* 0.5 PI)))
(setq JDD1 (angtos JDh3 1 5))
(setq fwj (strcat "SE" JDD1))
)
)
)
)
(setq tr1 (angtos 0 1 4))
(setq tr2 (angtos PI 1 4))
(if (= tt 5) (setq fwj (strcat "NE" tr1)))
(if (= tt 6) (setq fwj (strcat "SW" tr2)))
(setq mn (strlen fwj))
(setq node 1)
(setq zdfwj fwj)
(repeat mn
(if (= (substr fwj node 1) "d")
(progn
(if (= (substr fwj (- node 1)) "%")
(progn
(setq zdfwj fwj)
)
)
(if (/= (substr fwj (- node 1)) "%")
(progn
(setq zdfwj (strcat (substr fwj 1 (- node 1)) "%%d"
(substr fwj (+ node 1) (- mn node))))
)
)
)
)
(setq node (+ node 1))
)
(setq fwj zdfwj)
(prompt "\n请选标注文字的位置")
(setq os_mode (getvar "osmode"))
(setvar "osmode" 0)
(setq bz_point (getpoint))
(command "text" bz_point 3.0 0 fwj "")
(setvar "osmode" os_mode)
(setvar "blipmode" blip)
(setvar "cmdecho" cmd)
(setvar "dimadec" ade)
(setvar "dimdec" dec)
(setvar "auprec" prec)
(setvar "aunits" nits)
(prompt "\n......指令fw.....")
(prompt "\n如果当前字体字高在STYLE中定义为不等于0")
(prompt ",")
(prompt "则程序将出错")
(prompt "\n请选一种没有定义字高的字体做为标注字体")
(prin1)
)
|
评分
-
查看全部评分
|