Jump to content

Lee Chu Chu

Recommended Posts

Is there anyway to check to see if the user has inputted into the command line and using a lisp, to tell that as soon as the user has pressed esc to not only cancel the command but to also set quantities?

Link to comment
Share on other sites

put your look on vl-catch-all-apply, vl-catch-all-error-p, vl-catch-all-error-message functions. this functions help to avoid most of exceptions in your app. while *error* function is called then program is interrupted, vl-catch-all-apply can substitute try except finally construction used in other then autolisp languages

Link to comment
Share on other sites

I am using vl-catch-all-apply but it doesnt seem to be doing what I want it to do. I keep pressing esc to cancel the command but it doesnt cancel the lisp reactor thats supposed to be called up when I cancel a command.

Link to comment
Share on other sites

@Lee. I am trying to use a lisp reactor. So basically this lisp reactor lives in a lisp file with a lot of my general code. I want to call up this lisp reactor when a specific function is being used in the command line. So whilst this command is running, variables like layer and snap settings have been set but once the command is either cancelled or ended, I wanted to set it back to the original settings before I started the command. I only want this reactor to work once the command is being called up. This is the lisp reactor code I have been using. Acknowledgements to ronjonp for writing this code up on: http://www.theswamp.org/index.php?topic=16519.5;wap2

(if (not *rjp-lispReactors*)
 (setq	*rjp-lispReactors*
(vlr-lisp-reactor
  nil
  '((:vlr-lispWillStart . strtlsp)
    (:vlr-lispCancelled . cncllsp)
   )
)
 )
 (princ)
)
(defun strtlsp (calling-reactor strtlspInfo / stlisp)
 (setq	stlisp	    (strcase (nth 0 strtlspInfo) T)
rjp-varlist nil
rjp-varlist (mapcar '(lambda (x) (cons x (getvar x)))
   '("apbox"	     "aperture"
     "attdia"	     "attmode"
     "aunits"	     "autosnap"
     "blipmode"     "cecolor"
     "celtscale"    "clayer"
     "cmddia"	     "cmdecho"
     "dimassoc"     "dragmode"
     "edgemode"     "elevation"
     "expert"	     "fillmode"
     "gridmode"     "gripsize"
     "highlight"    "ltscale"
     "orthomode"    "osmode"
     "osnapcoord"   "plinewid"
     "snapang"	     "snapmode"
     "textsize"
    )
   )
 )
 (princ "LISP START")
)
(defun cncllsp (calling-reactor cncllspInfo /)
 (mapcar '(lambda (x)
    (vl-catch-all-apply
      'setvar
      (list (car x) (cdr x))
    )
  )
 rjp-varlist
 )
 (princ "\n <<Lisp cancelled...>>")
)

 

I see that the reactor does start since I see my printed message LISP START but whenever I press esc to cancel the function, the message lisp cancelled doesnt get printed out and the settings dont revert back to when it started. Anyway I can modify this code to specifically do that? I've also tried using command reactors but they are a bit dodgy to work with and it can only be used in the entirety of the lisp file since it is waiting for a command to be called up. So I have no idea what I should be doing, if I should even be using lisp-reactors or not.

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...