- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey everybody!
I am new to Lisp so I might write or show some things that look wrong or convoluted.
I have written a Lisp that deletes everything i a drawing except for certain things. It deletes the layouts and detaches the xrefs, to then purge everything. Then it Dxfouts that which has been left.
Now I want to simply undo. I want to undo basically everything i just listed, with exception -of course- of the Dxfout.
I tried using this:
(vl-load-com)
(vla-StartUndoMark (setq *DOC* (vla-get-ActiveDocument (vlax-get-acad-object))))
...
(vla-EndUndoMark *DOC*)
I tried using the (command "_.undo" "be") and then (command "_undo" "end"); I tried using the _undo group and using the _undo mark.
It doesn't work.
Here is the code:
(defun c:purge ()
(command "Layer" "s" 0 "")
(command "model")
(command "save" "")
(command "-xref" "D" "*")
(vl-load-com)
(vlax-for layout (vla-get-layouts
(vla-get-ActiveDocument (vlax-get-acad-object))
)
(if (/= (vla-get-name layout) "Model")
(vla-delete layout)
)
)
(setq sel1 (ssget "x" (list (cons 8 "~lotsoflayernames"))))
(command "_.erase" sel1 "")
(command "_.purge" "_all" "*" "_no")
(command "_.dxfout" "" "V" "R12" "")
)
Now where do I place any of these undo-thingies? Am I missing something obvious?
Help and input is greatly appreciated.
Solved! Go to Solution.