作业帮 > 综合 > 作业

autolisp编程求助

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/17 12:08:05
autolisp编程求助
这是一个大虾编的CAD坐标提取程序,但是我觉得这个程序我运用起来不是很顺手,帮我把程序改一下,
主要加入这样一个环节即可,可以不用输入命令重复提取坐标,输入点号1,查询完之后可以直接查找下一点坐标,并且点号为2,以此类推
(defun c:tiqu(/ a b c)
(setq c(getstring"输入点号:"))
(setq a(getpoint"\n选取点:"))
(setq b(open "C:\\Documents and Settings\\Administrator\\桌面\\坐标.txt" "a"))
(print (list c a) b)
(close b)
(princ)
)
一楼您的答案我尝试了,可以连续点,但是还差一点就是序号的自动增加啊,能否再麻烦你一下你
autolisp编程求助
(defun c:tiqu(/ a b c)
(setq c(getstring"输入点号:"))
(setq a(getpoint"\n选取点:"))
(terpri)(terpri)
(setq b(open "C:\\Documents and Settings\\Administrator\\桌面\\坐标.txt" "a"))
(print (list c a) b)
(close b)
(princ)
(c:tiqu)
)
好,我就再帮你一次吧,看看是不是这个效果?
(defun c:tiqu(/ a b i)
(setq i (uint 1 "" "\n起始编号:" 1))
(while
(setq a(getpoint"\n选取点:"))
(terpri)
(setq b(open "C:\\Documents and Settings\\Administrator\\桌面\\坐标.txt" "a"))
(print (list i a) b)
(close b)
(setq i (+ 1 i))
(princ)))
(defun ureal (bit kwd msg def / inp)
(if def
(setq msg (strcat "\n" msg ":")
bit (* 2 (fix (/ bit 2))) )
(setq msg (strcat "\n" msg ":")) )
(initget bit kwd)
(setq inp (getreal msg))
(if inp
inp
def ) )
(defun uint (bit kwd msg def / inp)
(if def
(setq msg (strcat "\n" msg ":")
bit (* 2 (fix (/ bit 2))) )
(setq msg (strcat "\n" msg ":")) )
(initget bit kwd)
(setq inp (getint msg))
(if inp
inp
def ))