- UID
- 425048
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2006-4-18
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
(defun c:yx()
(setvar "CMDECHO" 0)
(command "ucs" "w")
(setq os (getvar "osmode"))
(setq pt (getpoint "\n请点取欲标注X,Y世界坐标的点(本程序的X,Y互换):"))
(command "osnap" "non")
(command "pline"
pt
""
)
(setq x (strcat "X=" (rtos (cadr pt) (getvar "lunits") (getvar "luprec"))))
(setq y (strcat "Y=" (rtos (car pt) (getvar "lunits") (getvar "luprec"))))
(command "osnap" "off")
(command "ucs" "v")
(setq p1 (getpoint (trans pt 0 1) "\n请点取标注线起点:"))
(setq p2 (getpoint p1 "\n请确定标注线终点的方向:"))
(setq h (getstring "\n请输入高程(回车则取消):"))
(setq h (strcat "H=" h))
(setq x1 (car p1))
(setq y1 (car (cdr p1)))
(setq x2 (car p2))
(setq sh (cdr (assoc 40 (tblsearch "style" (getvar "textstyle")))))
(setq w (cdr (assoc 41 (tblsearch "style" (getvar "textstyle")))))
(setq ts (if (> sh 0) sh (getvar "TEXTSIZE")))
(setq l (* (max (strlen y) (strlen x)) ts 0.9 w))
(setq tyu (+ y1 (* ts 0.5)))
(setq tyd (- y1 (* ts 1.5)))
(if (> x1 x2) (setq x2 (- x1 l)) (setq x2 (+ x1 l)))
(command "Pline"
"@0,0,0"
"W"
0
0
p1
(list x2 y1)
""
)
(if (> x1 x2) (setq a x2) (setq a x1))
(if (> x1 x2) (setq b x1) (setq b x2))
(if (> sh 0)
(progn
(command "text"
(list a tyd)
0
y
)
(command "text"
(list a tyu)
0
x
)
)
(progn
(command "text"
(list a tyd)
ts
0
y
)
(command "text"
(list a tyu)
ts
0
x
)
)
)
(if (/= "H=" h)
(progn
(if (> x2 x1)
(setq ph (list (+ x2 (/ (* ts w) 2)) (- y1 (/ ts 2))))
(setq ph (list (- x2 (* (strlen h) ts w)) (- y1 (/ ts 2))))
)
(if (> sh 0)
(command "text"
ph
0
h
)
(command "text"
ph
ts
0
h
)
)
)
)
(setvar "osmode" os)
(command "ucs" "w")
) |
|