几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   数据库ObjectDBX (http://www.dimcax.com/hust/forumdisplay.php?f=177)
-   -   【转帖】求教修改cad坐标标注代码 (http://www.dimcax.com/hust/showthread.php?t=13757)

yang686526 2009-04-28 03:10 PM

【转帖】求教修改cad坐标标注代码
 
求教修改cad坐标标注代码
www.dimcax.com
求教修改cad坐标标注代码
;;选择点位注记坐标
(defun c:zbzj (/ pt1 pt2 pt3 txt1 txt2 txt3 txp1 txp2 txtp3 os txth)
(setq pt1 (getpoint "\n请选择注记点位:"))
(if pt1
(progn
(setq txt2 (rtos (car pt1) 2 3)
txt1 (rtos (cadr pt1) 2 3)
txt3 (rtos (caddr pt1) 2 3)
)
(setq txt1 (strcat "x=" (txtws txt1 3))
txt2 (strcat "y=" (txtws txt2 3))
txt3 (strcat "h=" (txtws txt3 3))
)
(setq pt2 (getpoint pt1 "\n书写位置:"))
(setq txth (getvar "textsize"))
(if pt2
(progn
(if (< (car pt1) (car pt2))
(progn (setq pt3 (polar pt2 0 (* (/ txth 2) 20)))
(setq txtp1 (polar pt2 1.57079632679 (* txth 1.5)))
(setq txtp2 (polar pt2 1.57079632679 (* txth 0.25)))
(setq txtp3 (polar pt2 4.71238898029 (* txth 1.25)))
)
(progn (setq pt3 (polar pt2 3.1415926535 (* (/ txth 2) 20)))
(setq txtp1 (polar pt3 1.57079632679 (* txth 1.5)))
(setq txtp2 (polar pt3 1.57079632679 (* txth 0.25)))
(setq txtp3 (polar pt3 4.71238898029 (* txth 1.25)))
)
)
(setq os (getvar "osmode"))
(setvar "osmode" 0)
(command "pline" pt1 pt2 pt3 "")
(command "text" txtp1 "" "0" txt1)
(command "text" txtp2 "" "0" txt2)
(command "text" txtp3 "" "0" txt3)
(setvar "osmode" os)
(strcat "注记坐标为: " txt1 "(北) " txt2 "(东) " txt3
"(高程)")
)
)
)
(progn (setq
txth (getreal
(strcat "字体大小<" (rtos (getvar "textsize") 2 4) ">")
)
)
(if txth
(setvar "textsize" txth)
)
)
)
)
(defun txtws (txt i / num dotnum ls ls1str bz)
(if txt
(progn
(setq txt (rtos (atof txt) 2 i))
(setq num (strlen txt)
dotnum 0
str ""
bz 0
)
(repeat num
(setq dotnum (1+ dotnum)
ls (substr txt dotnum 1)
)
(if (= ls ".")
(setq bz (- num dotnum))
)
)
(setq ls1 (cond ((> bz 2) txt)
((= bz 1) (strcat txt "00"))
((= bz 2) (strcat txt "0"))
((= bz 0) (strcat txt ".000"))
)
)
ls1
)
nil
)
)
展点出来格式是这样的
x=****
y=****
————
h=****
把它变成南方 cass一样的怎么变啊
x=****
————
y=****

图片:

图片:

图片见附件www.dimcax.com下载次数


(command "text" txtp1 "" "0" txt1)
(command "text" txtp2 "" "0" txt2)
(command "text" txtp3 "" "0" txt3)
改为
(command "text" txtp2 "" "0" txt1)
(command "text" txtp3 "" "0" txt2)
即可,
progress every day!!!

不错,好用

看看。。。。。。。。。。。


所有的时间均为北京时间。 现在的时间是 01:54 PM.