立面标高的程序
这是一个标立面标高的程序,每次执行都要输入一次基点标高值,我的想法是,第一次执行程序,输入了基点标高值,在没有移动图形的情况下,再执行这个程序时,就不需要在输入基点标高值了,直接选标注点标标高值,这个怎么改(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 "" pt2pause )
(setvar "orthomode" 0);_关
)
(princ)
)
您可参考调用了 Ureal 函式的老帖 Andyhon 发表于 2018-6-10 12:00
您可参考调用了 Ureal 函式的老帖
找了一下,没有查到Ureal 函式能给个链接吗 http://bbs.mjtd.com/forum.php?mod=viewthread&tid=108502
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=95673
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=92870
Andyhon 发表于 2018-6-10 13:54
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=108502
http://bbs.mjtd.com/forum.php?mod=viewthrea ...
谢谢,我看了一下,没有明白ureal函数的作用,可以简单说说吗 (defun ureal (bit kwd msg def / inp)
(ureal 1 "" "\n增减值(正为增,负为减)" NBTV_TXT_CopyADD)
NBTV_TXT_CopyADD 即为默认值 非常不错的代码,谢谢楼主分享啊。
页:
[1]