<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856042#M154618</link>
    <description>Don't use Marks.&lt;BR /&gt;
&lt;BR /&gt;
Search this ng for the reasons.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
R. Robert Bell, MCSE&lt;BR /&gt;
www.AcadX.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Andrey Marinov" &lt;ANDREY&gt; wrote in message&lt;BR /&gt;
news:8563DCEAA24952EA14B1915CE8D3E651@in.WebX.maYIadrTaRb...&lt;BR /&gt;
| If I need to have actions undone inside the command body depending on user&lt;BR /&gt;
| input or because of a pre-designed sequence of actions (e.g. to insert&lt;BR /&gt;
| temporarily some file for preview &amp;amp; then to remove it when the user is&lt;BR /&gt;
ready&lt;BR /&gt;
| to continue), I enclose that part of the code in a (command "_.UNDO" "_M")&lt;BR /&gt;
| ... (command "_.UNDO" "_B").&lt;BR /&gt;
|&lt;BR /&gt;
| If the user hits &lt;ESC&gt; or cancels a dialog, or there is an (exit)&lt;BR /&gt;
statement&lt;BR /&gt;
| in the code whatsoever, a single "U" is enough to restore AutoCAD to its&lt;BR /&gt;
| state before the command was invoked. And this is true also if the break&lt;BR /&gt;
| appeared in-between (command "_.UNDO" "_M") ... (command "_.UNDO" "_B").&lt;BR /&gt;
|&lt;/ESC&gt;&lt;/ANDREY&gt;</description>
    <pubDate>Thu, 21 Aug 2003 07:20:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2003-08-21T07:20:04Z</dc:date>
    <item>
      <title>Undo Begin and End.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856036#M154612</link>
      <description>I am writting a large application in Vlisp.&lt;BR /&gt;
I am using "undo" "mark" "back" extensively for my &lt;BR /&gt;
"Cancel" buttons.  If the user "Cancels" then the undo features of my app undoes what the application did to&lt;BR /&gt;
the drawing in the mean time.&lt;BR /&gt;
However, I would like to use "Begin and "End"&lt;BR /&gt;
I understand that this makes a "U" undo all the actions&lt;BR /&gt;
that were done between the "Begin" and the "End" switches&lt;BR /&gt;
undo as if they were done by a single opperation.&lt;BR /&gt;
Trouble is I cannot seem to get it to do this.&lt;BR /&gt;
I want to allow the user, once he closes my application&lt;BR /&gt;
to do "U" to simple undo all the actions that were done&lt;BR /&gt;
the last time the application was running.&lt;BR /&gt;
Thoughts?</description>
      <pubDate>Thu, 17 Jul 2003 19:13:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856036#M154612</guid>
      <dc:creator>mdhutchinson</dc:creator>
      <dc:date>2003-07-17T19:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: Undo Begin and End.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856037#M154613</link>
      <description>&lt;DIV&gt;Use:&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;(defun c:test ( / )&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;(command "UNDO" "BEGIN")&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;lt;&amp;lt;your lisp goes here&amp;gt;&amp;gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;(command "UNDO" "END")&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;) ; end defun&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;The command undo will undo the application above, or use (command "UNDO" &lt;BR /&gt;
1)&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;Works for me.&lt;BR /&gt;-- &lt;BR /&gt;Jeroen Berkers&lt;BR /&gt;A2k - W98SE&lt;/DIV&gt;&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;BR /&gt;
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"&amp;gt;&lt;BR /&gt;
  &lt;DIV&gt;"hutch" &amp;lt;&lt;A&gt;&lt;BR /&gt;
  href="mailto:mhutchinso@aol.com"&amp;gt;mhutchinso@aol.com&lt;/A&gt;&amp;gt; wrote in message &lt;BR /&gt;
  &lt;A&gt;&lt;BR /&gt;
  href="news:f178bc0.-1@WebX.maYIadrTaRb"&amp;gt;news:f178bc0.-1@WebX.maYIadrTaRb&lt;/A&gt;...&lt;/DIV&gt;I &lt;BR /&gt;
  am writting a large application in Vlisp. &lt;BR /&gt;I am using "undo" "mark" "back" &lt;BR /&gt;
  extensively for my &lt;BR /&gt;"Cancel" buttons. If the user "Cancels" then the undo &lt;BR /&gt;
  features of my app undoes what the application did to &lt;BR /&gt;the drawing in the &lt;BR /&gt;
  mean time. &lt;BR /&gt;However, I would like to use "Begin and "End" &lt;BR /&gt;I understand &lt;BR /&gt;
  that this makes a "U" undo all the actions &lt;BR /&gt;that were done between the &lt;BR /&gt;
  "Begin" and the "End" switches &lt;BR /&gt;undo as if they were done by a single &lt;BR /&gt;
  opperation. &lt;BR /&gt;Trouble is I cannot seem to get it to do this. &lt;BR /&gt;I want to &lt;BR /&gt;
  allow the user, once he closes my application &lt;BR /&gt;to do "U" to simple undo all &lt;BR /&gt;
  the actions that were done &lt;BR /&gt;the last time the application was running. &lt;BR /&gt;
  &lt;BR /&gt;Thoughts?&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 17 Jul 2003 22:20:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856037#M154613</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-07-17T22:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: Undo Begin and End.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856038#M154614</link>
      <description>hutch,&lt;BR /&gt;
&lt;BR /&gt;
You might want try these.&lt;BR /&gt;
&lt;BR /&gt;
;by John Uhden&lt;BR /&gt;
(setq *acad* (vlax-get-acad-object))&lt;BR /&gt;
(defun UndoBegin ()&lt;BR /&gt;
   (vla-StartUndoMark (vla-get-activedocument *acad*))&lt;BR /&gt;
)&lt;BR /&gt;
(defun UndoEnd ()&lt;BR /&gt;
   (vla-EndUndoMark (vla-get-activedocument *acad*))&lt;BR /&gt;
)&lt;BR /&gt;
&lt;BR /&gt;
They avoid an annoying problem with command versions. If objects are&lt;BR /&gt;
selected before the program runs, (command "undo" "begin") will deselect.&lt;BR /&gt;
&lt;BR /&gt;
Joe Burke&lt;BR /&gt;
&lt;BR /&gt;
---------------------------------------------------------------&lt;BR /&gt;
"hutch" &lt;MHUTCHINSO&gt; wrote in message&lt;BR /&gt;
news:f178bc0.-1@WebX.maYIadrTaRb...&lt;BR /&gt;
I am writting a large application in Vlisp.&lt;BR /&gt;
I am using "undo" "mark" "back" extensively for my&lt;BR /&gt;
"Cancel" buttons. If the user "Cancels" then the undo features of my app&lt;BR /&gt;
undoes what the application did to&lt;BR /&gt;
the drawing in the mean time.&lt;BR /&gt;
However, I would like to use "Begin and "End"&lt;BR /&gt;
I understand that this makes a "U" undo all the actions&lt;BR /&gt;
that were done between the "Begin" and the "End" switches&lt;BR /&gt;
undo as if they were done by a single opperation.&lt;BR /&gt;
Trouble is I cannot seem to get it to do this.&lt;BR /&gt;
I want to allow the user, once he closes my application&lt;BR /&gt;
to do "U" to simple undo all the actions that were done&lt;BR /&gt;
the last time the application was running.&lt;BR /&gt;
Thoughts?&lt;/MHUTCHINSO&gt;</description>
      <pubDate>Fri, 18 Jul 2003 00:18:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856038#M154614</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-07-18T00:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Undo Begin and End.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856039#M154615</link>
      <description>I know I'm belated (been on vacation), but as nice as Joe is to offer a little&lt;BR /&gt;
ActiveX answer, there is a documented limitation...&lt;BR /&gt;
You can't use Undo/Marks/Backs in the middle of an Undo/Begin/End sequence,&lt;BR /&gt;
ActiveX or otherwise.  They're just plain ignored.  For that VEDIT thingy I&lt;BR /&gt;
offered in the LDT NG, I actually had to store each edit in memory to be able to&lt;BR /&gt;
provide both incremental and global Undos.  Yes... a very large PITA.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
John Uhden, Cadlantic/formerly CADvantage&lt;BR /&gt;
http://www.cadlantic.com&lt;BR /&gt;
Sea Girt, NJ&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"hutch" &lt;MHUTCHINSO&gt; wrote in message&lt;BR /&gt;
news:f178bc0.-1@WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I am writting a large application in Vlisp.&lt;BR /&gt;
&amp;gt; I am using "undo" "mark" "back" extensively for my&lt;BR /&gt;
&amp;gt; "Cancel" buttons. If the user "Cancels" then the undo features of my app&lt;BR /&gt;
undoes what the application did to&lt;BR /&gt;
&amp;gt; the drawing in the mean time.&lt;BR /&gt;
&amp;gt; However, I would like to use "Begin and "End"&lt;BR /&gt;
&amp;gt; I understand that this makes a "U" undo all the actions&lt;BR /&gt;
&amp;gt; that were done between the "Begin" and the "End" switches&lt;BR /&gt;
&amp;gt; undo as if they were done by a single opperation.&lt;BR /&gt;
&amp;gt; Trouble is I cannot seem to get it to do this.&lt;BR /&gt;
&amp;gt; I want to allow the user, once he closes my application&lt;BR /&gt;
&amp;gt; to do "U" to simple undo all the actions that were done&lt;BR /&gt;
&amp;gt; the last time the application was running.&lt;BR /&gt;
&amp;gt; Thoughts?&lt;/MHUTCHINSO&gt;</description>
      <pubDate>Mon, 28 Jul 2003 18:59:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856039#M154615</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-07-28T18:59:50Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856040#M154616</link>
      <description>Hi John,&lt;BR /&gt;
&lt;BR /&gt;
That's interesting and good to know. But I think the question was how to use&lt;BR /&gt;
Undo/Begin/End in lieu of Undo/Marks/Backs. Or maybe I'm misreading it.&lt;BR /&gt;
&lt;BR /&gt;
Joe Burke&lt;BR /&gt;
&lt;BR /&gt;
"John Uhden" &lt;JUHDEN&gt; wrote in message&lt;BR /&gt;
news:F739C0B419E7D6FC8A7948030B318587@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I know I'm belated (been on vacation), but as nice as Joe is to offer a&lt;BR /&gt;
little&lt;BR /&gt;
&amp;gt; ActiveX answer, there is a documented limitation...&lt;BR /&gt;
&amp;gt; You can't use Undo/Marks/Backs in the middle of an Undo/Begin/End&lt;BR /&gt;
sequence,&lt;BR /&gt;
&amp;gt; ActiveX or otherwise.  They're just plain ignored.  For that VEDIT thingy&lt;BR /&gt;
I&lt;BR /&gt;
&amp;gt; offered in the LDT NG, I actually had to store each edit in memory to be&lt;BR /&gt;
able to&lt;BR /&gt;
&amp;gt; provide both incremental and global Undos.  Yes... a very large PITA.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; -- &lt;BR /&gt;
&amp;gt; John Uhden, Cadlantic/formerly CADvantage&lt;BR /&gt;
&amp;gt; http://www.cadlantic.com&lt;BR /&gt;
&amp;gt; Sea Girt, NJ&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; "hutch" &lt;MHUTCHINSO&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:f178bc0.-1@WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; I am writting a large application in Vlisp.&lt;BR /&gt;
&amp;gt; &amp;gt; I am using "undo" "mark" "back" extensively for my&lt;BR /&gt;
&amp;gt; &amp;gt; "Cancel" buttons. If the user "Cancels" then the undo features of my app&lt;BR /&gt;
&amp;gt; undoes what the application did to&lt;BR /&gt;
&amp;gt; &amp;gt; the drawing in the mean time.&lt;BR /&gt;
&amp;gt; &amp;gt; However, I would like to use "Begin and "End"&lt;BR /&gt;
&amp;gt; &amp;gt; I understand that this makes a "U" undo all the actions&lt;BR /&gt;
&amp;gt; &amp;gt; that were done between the "Begin" and the "End" switches&lt;BR /&gt;
&amp;gt; &amp;gt; undo as if they were done by a single opperation.&lt;BR /&gt;
&amp;gt; &amp;gt; Trouble is I cannot seem to get it to do this.&lt;BR /&gt;
&amp;gt; &amp;gt; I want to allow the user, once he closes my application&lt;BR /&gt;
&amp;gt; &amp;gt; to do "U" to simple undo all the actions that were done&lt;BR /&gt;
&amp;gt; &amp;gt; the last time the application was running.&lt;BR /&gt;
&amp;gt; &amp;gt; Thoughts?&lt;BR /&gt;
&amp;gt;&lt;/MHUTCHINSO&gt;&lt;/JUHDEN&gt;</description>
      <pubDate>Fri, 01 Aug 2003 02:51:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856040#M154616</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-08-01T02:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: Undo Begin and End.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856041#M154617</link>
      <description>Autodesk's undo- &amp;amp; error-handlers provided with ACAD.MNL do a very good job&lt;BR /&gt;
for me (I only needed to add (command "_.UNDO" "_E") in the body of&lt;BR /&gt;
*MERRMSG*). I have a renamed copy of it, which loads together with my&lt;BR /&gt;
CUSTOM.MNS &amp;amp; I have it working.&lt;BR /&gt;
&lt;BR /&gt;
My commands now look like this:&lt;BR /&gt;
&lt;BR /&gt;
(defun C:SAMPLE (/ ...)&lt;BR /&gt;
  (setq M:ERR *ERROR* *ERROR* *MERRMSG*)&lt;BR /&gt;
  (ai_undo_push)&lt;BR /&gt;
  ...&lt;BR /&gt;
  (ai_sysvar '(... ... ...))&lt;BR /&gt;
...&lt;BR /&gt;
all my stuff goes here&lt;BR /&gt;
...&lt;BR /&gt;
  (ai_sysvar nil)&lt;BR /&gt;
  (ai_undo_pop)&lt;BR /&gt;
  (setq *ERROR* M:ERR M:ERR nil)&lt;BR /&gt;
  (princ)&lt;BR /&gt;
)&lt;BR /&gt;
&lt;BR /&gt;
If I need to have actions undone inside the command body depending on user&lt;BR /&gt;
input or because of a pre-designed sequence of actions (e.g. to insert&lt;BR /&gt;
temporarily some file for preview &amp;amp; then to remove it when the user is ready&lt;BR /&gt;
to continue), I enclose that part of the code in a (command "_.UNDO" "_M")&lt;BR /&gt;
... (command "_.UNDO" "_B").&lt;BR /&gt;
&lt;BR /&gt;
If the user hits &lt;ESC&gt; or cancels a dialog, or there is an (exit) statement&lt;BR /&gt;
in the code whatsoever, a single "U" is enough to restore AutoCAD to its&lt;BR /&gt;
state before the command was invoked. And this is true also if the break&lt;BR /&gt;
appeared in-between (command "_.UNDO" "_M") ... (command "_.UNDO" "_B").&lt;BR /&gt;
&lt;BR /&gt;
Of course, you need to mind your considerations where to put error- &amp;amp;&lt;BR /&gt;
undo-handlers. I put them only in the (defun C:...) &amp;amp; never in the lower&lt;BR /&gt;
level functions that C:... relies on. I also don't have cross-calls betwen&lt;BR /&gt;
C:..s - if I need such, I define just a new stub C:... command, put the&lt;BR /&gt;
undo- &amp;amp; error-handling there &amp;amp; keep the commonly referenced part as a lower&lt;BR /&gt;
level function. Also, don't forget that you cannot have nested&lt;BR /&gt;
"UNDO"-"BE"s...&lt;BR /&gt;
&lt;BR /&gt;
Spend some time studying that part of ACAD.MNL. To me that was very useful.&lt;BR /&gt;
Hope this helps you.&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
Andrey&lt;/ESC&gt;</description>
      <pubDate>Wed, 20 Aug 2003 23:05:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856041#M154617</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-08-20T23:05:57Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856042#M154618</link>
      <description>Don't use Marks.&lt;BR /&gt;
&lt;BR /&gt;
Search this ng for the reasons.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
R. Robert Bell, MCSE&lt;BR /&gt;
www.AcadX.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Andrey Marinov" &lt;ANDREY&gt; wrote in message&lt;BR /&gt;
news:8563DCEAA24952EA14B1915CE8D3E651@in.WebX.maYIadrTaRb...&lt;BR /&gt;
| If I need to have actions undone inside the command body depending on user&lt;BR /&gt;
| input or because of a pre-designed sequence of actions (e.g. to insert&lt;BR /&gt;
| temporarily some file for preview &amp;amp; then to remove it when the user is&lt;BR /&gt;
ready&lt;BR /&gt;
| to continue), I enclose that part of the code in a (command "_.UNDO" "_M")&lt;BR /&gt;
| ... (command "_.UNDO" "_B").&lt;BR /&gt;
|&lt;BR /&gt;
| If the user hits &lt;ESC&gt; or cancels a dialog, or there is an (exit)&lt;BR /&gt;
statement&lt;BR /&gt;
| in the code whatsoever, a single "U" is enough to restore AutoCAD to its&lt;BR /&gt;
| state before the command was invoked. And this is true also if the break&lt;BR /&gt;
| appeared in-between (command "_.UNDO" "_M") ... (command "_.UNDO" "_B").&lt;BR /&gt;
|&lt;/ESC&gt;&lt;/ANDREY&gt;</description>
      <pubDate>Thu, 21 Aug 2003 07:20:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-end/m-p/856042#M154618</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-08-21T07:20:04Z</dc:date>
    </item>
  </channel>
</rss>

