Jump to content

error


au-s

Recommended Posts

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...