这是一个标立面标高的程序,每次执行都要输入一次基点标高值,我的想法是,第一次执行程序,输入了基点标高值,在没有移动图形的情况下,再执行这个程序时,就不需要在输入基点标高值了,直接选标注点标标高值,这个怎么改
- (defun c:bg1 (/ pt1 pt2 old_cmd cl ortho ww hh1 ang pt3 hh hh2 str bg)
- (setvar "clayer" "标高")
- (setq pt1 (getpoint "\n标高基准点:"))
- (if (not (setq hh1 (getreal "\n请输入基准点标高±0.000:")))
- (setq hh1 0.000)
- )
- (setq hh1 (if (/= hh1 0)
- (rtos hh1 2 3)
- "%%P0.000"
- )
- )
- (while(setq pt2 (getpoint "\n定位点:")); 此点相对基准往左、右对应相应的标高符号
- (setq ang (angle pt1 pt2))
- (setq pt3 (polar pt2 0 100))
- (setq hh (szx_h pt1 pt2)
- hh2 (/ hh 1000)
- )
- (if (/= (type hh1) 'str)(setq hh1(vl-princ-to-string hh1)));判断是否是字符串并转换
- (setq hh1 (atof hh1)) ;字符串转换成实型数
- (if (and (> ang 0)(< ang 3.141))
- (setq str (+ hh1 hh2))
- (setq str (- hh1 hh2))
- )
- (setq str (if (/= str 0)
- (rtos str 2 3)
- "%%P0.000"
- )
- )
- (if (and (> ang 1.570)(< ang 4.712))
- (command "._insert" "bgz.dwg" "non" pt2 "" "" str)
- (command "._insert" "bgy.dwg" "non" pt2 "" "" str)
- )
- (setq bg (entlast))
- (initget "Yes No")
- (if (= "Yes"
- (getkword "\n是否镜像?[是(Y)/否(N)] <N>:")
- )
- (command "mirror" bg "" "non" pt2 "non" pt3 "y")
- )
- (setvar "orthomode" 1);_开
- (prompt "\n左右移动定位: ")
- (command "_move" bg "" pt2 pause )
- (setvar "orthomode" 0);_关
- )
- (princ)
- )
|