求助LISP高手,坐标标注程序改进方案
我绘制道路横断图时想标注距中桩的偏距和高程,此程序的相对坐标标注可满足要求,唯一不足的地方是我想把引线修改为竖直方向,X,Y分别在引线两端,如图所示:高手请帮帮小弟,不胜感激!!!!!!! (defun c:bzzb()(setq oldzin (getvar "DIMZIN"))
(setvar "DIMZIN" 0)
(if (= hzt nil) (setq hzt 1))
(setq thzt hzt)
(setq thzt (getdist (strcat "\n 文字高度<" (rtos thzt) ">:")))
(if thzt (setq hzt thzt))
(command "style" "standard" "黑体" hzt 1 "" "" "")
(initget 1 "A B")
(setq gclx (getkword "\n 绝对坐标(A) / 相对于某点的坐标(B) <A>:"))
(if (= gclx "B")
(setq pt0 (getpoint "\n 点取基准坐标点位置: "))
(setq pt0 (list 0 0))
)
(setq os (getvar "osmode"))
(while (and (setq pt (getpoint "\n点取标注点位置: "))
(setq pt1 (getpoint pt "\n文字点: ")))
(setq p1 (polar pt1 0 hzt))
(setq p2 (polar pt1 pi hzt))
(command "point" pt)
(setvar "osmode" 0)
(setq pt1 (mapcar '- pt pt0))
(setq xpt (rtos (cadr pt1) 2 3) ypt (rtos (car pt1) 2 3))
(setq l (* hzt (max (strlen xpt) (strlen ypt))))
(setq pt2 (polar pt1 (/ pi 2) l))
(command "_.PLINE" pt pt1 pt2 "")
(command "_.TEXT" "ML" p2 90 (strcat "x=" xpt))
(command "_.TEXT" "ML" p1 90 (strcat "y=" ypt))
(setvar "osmode" os)
)
(setvar "DIMZIN" oldzin)
);defun
程序达到了我想要的结果,谢谢超级版主,请问x,y坐标还能不能改成任意角度标注(只要保证标注点和XY坐标在一条直引线上就好),麻烦版主再费点力,小弟再次感谢!!! ;坐标标注 ZZXXQQ 2013.5.12 2013.5.15改
(defun c:bzzb()
(setq oldzin (getvar "DIMZIN"))
(setvar "DIMZIN" 0)
(if (= hzt nil) (setq hzt 1))
(setq thzt hzt)
(setq thzt (getdist (strcat "\n 文字高度<" (rtos thzt) ">:")))
(if thzt (setq hzt thzt))
(command "style" "standard" "黑体" hzt 1 "" "" "")
(initget 1 "A B")
(setq gclx (getkword "\n 绝对坐标(A) / 相对于某点的坐标(B) <A>:"))
(if (= gclx "B")
(setq pt0 (getpoint "\n 点取基准坐标点位置: "))
(setq pt0 (list 0 0))
)
(setq os (getvar "osmode"))
(while (and (setq pt (getpoint "\n点取标注点位置: "))
(setq pt1 (getpoint pt "\n文字点: ")))
(setq ang (angle pt pt1))
(setq p1 (polar pt1 (+ (/ pi -2) ang) hzt))
(setq p2 (polar pt1 (+ (/ pi 2) ang) hzt))
(command "point" pt)
(setvar "osmode" 0)
(setq pt1 (mapcar '- pt pt0))
(setq xpt (rtos (cadr pt1) 2 3) ypt (rtos (car pt1) 2 3))
(setq l (* hzt (max (strlen xpt) (strlen ypt))))
(setq pt2 (polar pt1 ang l))
(setq an (/ (* ang 180) pi))
(command "_.PLINE" pt pt1 pt2 "")
(command "_.TEXT" "ML" p2 an (strcat "x=" xpt))
(command "_.TEXT" "ML" p1 an (strcat "y=" ypt))
(setvar "osmode" os)
)
(setvar "DIMZIN" oldzin)
);defun
版主 强大啊 收藏了 顶起 ○Only°尐影 发表于 2013-5-13 19:31 static/image/common/back.gif
程序达到了我想要的结果,谢谢超级版主,请问x,y坐标还能不能改成任意角度标注(只要保证标注点和XY坐标在一 ...
你好,改完后的能给我发一个吗? 厉害,版主,学习了
页:
[1]