有关Progn的更多信息,请参阅此处:
http://www.cadtutor.net/forum/showpost.php?p=173196&postcount=10 我明白了,您必须将所有“if”操作与(progn)分组。
这是最终的工作版本。
(defun c:bfix ( / bd)
(if (setq BD (ssget "X" '((2 . "AIA_D1-L000"))))
(progn
(command "._erase" bd "")
(command "._purge" "b" "" "n")
(command "._xref" "a" "X:\\path\\AIA_D1-L000.dwg" "0,0,0" "" "" "")
)
)
(princ)
)
谢谢大家的帮助。试图从书本和互联网上学习这一点几乎是不可能的。
我将努力永远使用我新发现的力量。 不错,丹,
请记住,progn将代码包装为一条语句,以便对其进行计算,因此如果您只有三条语句,即测试表达式、结果表达式和“else”表达式,则不需要progn。 啊,还有一件事我忘了提:
您也可以包装“else”表达式:
(if (this is true)
(progn
(do this)
(and this)
(and this)
)
(progn
(else do this)
(and this)
(and this)
)
)
页:
1
[2]