发布于:2013-11-16 16:57:16
来自:建筑设计/CAD下载及教程
[复制转发]
(defun c:zb();;defun为标准函数用来定义新函数
(setvar "cmdecho" 0);;关闭命令回显
(setq os (getvar "osmode"));;保存对象捕捉系统变量
(setvar "osmode" 33)
(setvar "dimtxt" (getvar "TEXTSIZE"))
(setq dtxt
(getdist
(strcat "\n请输入标注文字的高度<"(rtos (getvar "dimtxt"))">: " )
)
);;;本行和下行主要是确定标注文字的高度。
(if (null dtxt) (setq dtxt (getvar "dimtxt")))
(WHILE (/= pt "")
(setvar "osmode" 33)
(setq
pt (getpoint "\n标注点:")
tx (strcat "X=" (rtos (car pt) 2)) ;;赋值,并设置数字保留小数位数(rtos 实数 单位模式 数字精度)
ty (strcat "Y=" (rtos (cadr pt) 2)) ;;赋值,并设置数字保留小数位数
)
(setq pt1 (getpoint pt "\n注释点:"))
(setq x1 (car pt1))
(setq y1 (cadr pt1))
(setq y2 y1)
(setq x2 (+ x1 dtxt))
(setvar "osmode" 0)
(setq pt2 (list x2 y2))
(command "line" pt pt1 pt2 "")
(command "style" "sf" "dim.shx,gbcbig.shx" 0 0.65 0 "n" "n" "n")
(command "text" (list (+ x1 (/ dtxt 3)) (+ y1 (/ dtxt 9.5))) dtxt 0 tx ^c)
(command "text" (list (+ x1 (/ dtxt 3)) (- y1 dtxt (/ dtxt 9.5))) dtxt 0 ty ^c)
(princ)
)
(setvar "osmode" os)
(setvar "cmdecho" 1);;打开命令回显
(prompt "\n中华人民共和国");;静默退出
(princ);;抑制nil的产生
)
(prompt "\n键入zb唤起命令:")
全部回复(3 )
只看楼主 我来说两句回复 举报
回复 举报