Jump to content

Undo if the user cancels while drawing temporary objects


3dwannab

Recommended Posts

I've looked up many threads on this but I was wondering if this is a good approach?

 

I have an error handler like this:

(defun *error* (errmsg)
  (and acDoc (vla-EndUndoMark acDoc))
  (and errmsg
    (not (wcmatch (strcase errmsg) "*CANCEL*,*EXIT*"))
    (princ (strcat "\n<< Error: " errmsg " >>\n"))
    )

  (if undoTempObjsBool
    (command-s "._undo" "" "")
    )

  )

 

Then in the code that I want to check if there's an undo while I draw some temp objects so that if the undoTempObjs variable is T then the undo action will work.

 

This works but I was wondering if there was a better way of handling this or am I on the right track?

 

(progn


  (setq undoTempObjsBool T)

  ;; Do some stuff here and afterwards set the undoTempObjsBool to nil

  (setq undoTempObjsBool nil)


  )

 

Edited by 3dwannab
Link to comment
Share on other sites

  • 3dwannab changed the title to Undo if the user cancels while drawing temporary objects

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