李在这个论坛的有用链接部分收集了大量的链接
http://www.cadtutor.net/forum/showthread.php?t=49515
我建议看一下条件解释下的链接(CAB/Lee Mac)
PROGN允许对多行代码进行评估,以响应IF测试后的肯定或否定评估。
-
- ;Without PROGN AutoCAD aould evaluate the function as follows
- (if
-
- ;Test
- (setq pickSelection (entsel))
- ;Positive result
- (setq sourceEname (car pickSelection))
- ;Negative result
- (setq ptCATCH nil)
- ;Unexpected additional arguments suplied. Error will be created here
- (while...
这仅仅是为了给IF statemet带来负面结果。这是没有必要的。
可能更恰当地使用princ是在未选择对象时提示用户
- (defun c:TEST ( / ptCATCH )
- (if
- ;Test
- (setq pickSelection (entsel))
- ;Positive result
- (progn
-
- (setq sourceEname ...)
- )
- ;Negative result
- (princ "\nNo Object selected)
- )
- )
如果我没有很好地解释这些项目,请道歉 |