au-s Posted February 18, 2009 Posted February 18, 2009 Hello, I do not know exactly how to do this. Anyways if I want a lispcommand "test" (defun c:test () to be executed I type test. If I type test but then hit ESC I want lisp not to do anything. The escape is (command) ?? Here is an example: (defun C:test (/ cDim oldlay) (setq oldlay (getvar "clayer")) (vl-load-com) (if (not (tblsearch "LAYER" "A-------D2-------A")) (command "-layer" "M" "A-------D2-------A" "C" "cyan" "A-------D2-------A" "") (setvar "clayer" "A-------D2-------A") ) ; end if (load "K:\\CAD\\Dimvariables.lsp") (Dim_Variabler) (LinjerDim) (setvar "dimscale" 1) (setq p1 (getpoint "\nFirst point: ")) (setq p2 (getpoint p1 "\nSecond point: ")) (setq p3 (getpoint p2 "\nPosition: ")) (princ) (and(vl-cmdf "_.dimlinear" p1 p2 p3) (setq cDim(vlax-ename->vla-object(entlast))) (vla-get-Measurement cDim)) (DESCRIBE) (setvar "clayer" oldlay))(command)) (princ) ); end So here I want if I type test the dimension starts. And layer creation starts. Allthough after typing the command I choose to hit ESC I want the lisp to completely exit and undoing what its had done... Can it be done like: (if (test) (progn ...here comes all the code (undo "BE") );end Quote
uddfl Posted February 18, 2009 Posted February 18, 2009 You would need to add an error trapping function. http://www.afralisp.net/lispa/lisp6.htm Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.