CAD二次开发。。。坐标标注
(defun C:zbbz( / zb gd cld osm )(setq osm (getvar"osmode"))
(setvar "osmode" 33)
(setq gd (getreal "指定标注文字高度:>"))
(if (= gd nil) (setq gd 0.5))
(while (setq zb (getpoint "指定坐标点:"))
(setq cld(getpoint zb "指定文字插入点:"))
(entmake (list
'(0 . "LINE")
'(67 . 0)
'(8 . "0")
(list 10 (car zb) (cadr zb) 0)
(list 11 (car cld) (cadr cld) 0)
'(210 0.0 0.0 1.0)
)
)
(entmake (list
'(0 . "text")
(list 10 (+ (car cld) gd)
(- (car(cdr cld)) (+ gd (/ gd 3)) )
)
(cons 40 gd)
(cons 1 (strcat "X="(rtos (car zb) 2 3)))
'(50 . 0)
)
)
(entmake (list
'(0 . "text")
(list 10 (+ (car cld) gd) (car(cdr cld)) )
(cons 40 gd)
(cons 1 ( strcat "Y=" (rtos (cadr zb) 2 3)))
'(50 . 0)
)
)
)
(setvar "osmode" osm)
(princ)
)
版主帮我看看这个程序要怎么改。。。。自定义UCS以后,标注出来的东西都弯了,不过坐标值是对的。。。请问要怎么改啊。。。版主和各位高手帮忙看看。。。。。
[ 本帖最后由 lalaalp 于 2009-5-27 12:15 编辑 ] 版主出来帮我看看这个程序呢。。。怎么搞的啊,哪里错了啊。。。。。
我知道肯定有问题的,可是我的水平还不够,需要帮助。。。
help!!! 顶支持哈哈8888 怎么没人帮我,我要顶一下。。。顶。。。。大家帮忙看看这个要怎么办啊。。。。 还是没人帮我。顶一下。。。 ;用用这个标注程序
;1.标注大地坐标.
(defun c:ZBB()
(setq pi 3.14159265359)
(setq TEXT_H (getvar "USERR1"))
(setq REPLY (strcat "\\nEnter text height <" (rtos TEXT_H 2 3) ">:"))
(setq T_H (getreal REPLY))
(if (/= T_H nil) (setvar "USERR1" T_H) (setq T_H TEXT_H))
(setvar "OSMODE" 32)
(setq p1 (getpoint "\\nint-point:" ))
(setvar "OSMODE" 0)
(setq n1 (nth 1 p1))
(setq e1 (nth 0 p1))
(setq nn (rtos n1 2 3))
(setq ee (rtos e1 2 3))
(setq nn (strcat "X_" nn))
(setq ee (STRCAT "Y_" ee))
(setq p2 (getpoint "\\nsecond point:" ))
(setq fw (angle p1 p2))
(setq fw1 (/ pi 2))
(setq fw2 (/ (* pi 3) 2))
(if (and (> fw fw1) (< fw fw2)) (progn
(setq pe (polar p2 (* pi -1) (* 7.5 T_H)))
(setq pt (polar pe 0 0)))
;else------------------------
(progn
(setq pe (polar p2 0 (* 7.5 T_H)))
(setq pt (polar p2 0 T_H)))
);end if----------------------------
(setq p3 (polar pt fw1 (* T_H 0.5)))
(COMMAND "text" p3 T_H "0" nn)
(setq p3 (polar pt fw2 (* T_H 1.5)))
(command "text" p3 T_H "0" ee)
(command "pline" p1 p2 pe "")
(setvar "osmode" 35)
)
;End of ZBB().
页:
[1]