-Brandon
... rest of lisp
(command "undo" "end");close this groups
);end defun
also search google for using similar in error handler in case of esc during
running lisp
I received this from Jon Fleming back a couple of years ago, and although I
haven't checked it for consistency across the various versions of AutoCAD, I
have not had any problems with it. I've used it in R14, R2000, and ADT 3.3.
You should follow this method:
(defun yourroutine ( exprs / GEH_OldUndoCtl)
(GEH_UndoBegin)
(your functions)
(GEH_UndoEnd)
(princ)
)
And then at the end of your function paste this in:
;;; Start an UNDO GROUP. Originally from Tony Tanzillo, through
;;; Tim Morse, modified by Jon Fleming
;;; No useful return value.
;;; GEH_OldUndoCtl should be defined as a local variable in
;;; the calling function.
(defun GEH_UndoBegin (/)
;; If UNDO is not disabled ...
(if (not (= 0 (setq GEH_OldUndoCtl (getvar "UNDOCTL"))))
(progn
;; If it's set to only undo one command ...
(if (= 1 (boole 1 2 GEH_OldUndoCtl))
;; Change it
(command "._undo" "_control" "_all")
) ;_ end if
;; If auto-group for menu items is enabled ...
(if (= 1 (boole 1 4 GEH_OldUndoCtl))
(command "._undo" "_auto" "_off")
;; Change it
) ;_ end if
;; If a group is active ...
(if (= 1 (boole 1 8 GEH_OldUndoCtl))
;; End it
(command "._undo" "_end")
) ;_ end if
;; Start our group
(command "._undo" "_group")
) ;_ end progn
;; UNDO is disabled, OK, we won't do anything.
) ;_ end if
) ;_ end defun
;;; End an UNDO GROUP. Originally from Tony Tanzillo, through
;;; Tim Morse, modified by Jon Fleming
;;; No useful return value.
;;; GEH_OldUndoCtl should be defined as a local variable in the
;;; calling function.
(defun GEH_UndoEnd (/)
;; If UNDO is not disabled ...
(if (not (= 0 GEH_OldUndoCtl))
(progn
;; End our UNDO group
(command "._UNDO" "_END")
;; If we were set to undo only one command ...
(if (= 1 (boole 1 2 GEH_OldUndoCtl))
;; Restore that
(command "._undo" "_control" "_one")
) ;_ end if
;; If auto-group for menu items was enabled ...
(if (= 1 (boole 1 4 GEH_OldUndoCtl))
;; Enable it
(command "._UNDO" "_CONTROL" "_AUTO")
) ;_ end if
) ;_ end progn
;; UNDO is disabled, do nothing.
) ;_ end if
) ;_ end defun
--
Joshua Tapp
Intern in waiting
Dillman-Luvaas Architects
www.dillman-luvaas.com
"Mark Propst" <Mark@atrengDOTcom> wrote in message
news:81B5F25B42D48930...@in.WebX.maYIadrTaRb...
(vla-StartUndoMark
(vlax-get-property
(vlax-get-acad-object)
"ActiveDocument"
)
)
.
.
.
(vla-EndUndoMark
(vlax-get-property
(vlax-get-acad-object)
"ActiveDocument"
)
)
jrf
Member of the Autodesk Discussion Forum Moderator Program
Please do not email questions unless you wish to hire my services
In article <53170AA3BDE6D537...@in.WebX.maYIadrTaRb>, Joshua Tapp
wrote:
Why do you prefer VLAX over VLA?
(vlax-get-property
(vlax-get-acad-object)
"ActiveDocument"
)
vs.:
(vla-getActiveDocument (vlax-get-acad-object))
--
Regards,
Eric S.
A2k/W2k
jrf
Member of the Autodesk Discussion Forum Moderator Program
Please do not email questions unless you wish to hire my services
In article <AF4C4946B64C7230...@in.WebX.maYIadrTaRb>, Eric