<?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 Undo begin and Undo End not getting trapped in error routine in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913028#M31035</link>
    <description>&lt;P&gt;In my Startup routine I have the following code.&lt;/P&gt;&lt;P&gt;This is what I currently use&amp;nbsp; and&amp;nbsp;"._undo" "_begin" does not make any difference.&lt;/P&gt;&lt;P&gt;(command "._undo" "_group")&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my ending routine I have the following code:&lt;/P&gt;&lt;P&gt;(command "._UNDO" "_END")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there is no error, everything works as it should.&lt;/P&gt;&lt;P&gt;When there is an error, such as hitting the esc key during the program execution, it displays the error below:&lt;/P&gt;&lt;P&gt;Command: _COPE&lt;/P&gt;&lt;P&gt;Inside Radius &amp;lt;0.25&amp;gt;: *Cancel*&lt;/P&gt;&lt;P&gt;error: Function cancelled&lt;/P&gt;&lt;P&gt;Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).&lt;/P&gt;&lt;P&gt;Converting (command) calls to (command-s) is recommended.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I get when I comment out this one line of code ;; (command "._UNDO" "_END") in my ending routine and then press the esc key during the program execution.&lt;/P&gt;&lt;P&gt;Command: _COPE&lt;/P&gt;&lt;P&gt;Inside Radius &amp;lt;0.25&amp;gt;: *Cancel*&lt;/P&gt;&lt;P&gt;error: Function cancelled&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
    <pubDate>Fri, 21 Apr 2023 15:37:07 GMT</pubDate>
    <dc:creator>brbowen</dc:creator>
    <dc:date>2023-04-21T15:37:07Z</dc:date>
    <item>
      <title>Undo begin and Undo End not getting trapped in error routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913028#M31035</link>
      <description>&lt;P&gt;In my Startup routine I have the following code.&lt;/P&gt;&lt;P&gt;This is what I currently use&amp;nbsp; and&amp;nbsp;"._undo" "_begin" does not make any difference.&lt;/P&gt;&lt;P&gt;(command "._undo" "_group")&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my ending routine I have the following code:&lt;/P&gt;&lt;P&gt;(command "._UNDO" "_END")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there is no error, everything works as it should.&lt;/P&gt;&lt;P&gt;When there is an error, such as hitting the esc key during the program execution, it displays the error below:&lt;/P&gt;&lt;P&gt;Command: _COPE&lt;/P&gt;&lt;P&gt;Inside Radius &amp;lt;0.25&amp;gt;: *Cancel*&lt;/P&gt;&lt;P&gt;error: Function cancelled&lt;/P&gt;&lt;P&gt;Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).&lt;/P&gt;&lt;P&gt;Converting (command) calls to (command-s) is recommended.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I get when I comment out this one line of code ;; (command "._UNDO" "_END") in my ending routine and then press the esc key during the program execution.&lt;/P&gt;&lt;P&gt;Command: _COPE&lt;/P&gt;&lt;P&gt;Inside Radius &amp;lt;0.25&amp;gt;: *Cancel*&lt;/P&gt;&lt;P&gt;error: Function cancelled&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 15:37:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913028#M31035</guid>
      <dc:creator>brbowen</dc:creator>
      <dc:date>2023-04-21T15:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: Undo begin and Undo End not getting trapped in error routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913103#M31036</link>
      <description>&lt;P&gt;Try this instead of group&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(command "._undo" "_mark")&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 16:04:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913103#M31036</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-04-21T16:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Undo begin and Undo End not getting trapped in error routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913136#M31037</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/345513"&gt;@brbowen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;In my ending routine I have the following code:&lt;/P&gt;
&lt;P&gt;(command "._UNDO" "_END")&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;error: Function cancelled&lt;/P&gt;
&lt;P&gt;Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).&lt;/P&gt;
&lt;P&gt;Converting (command) calls to (command-s) is recommended.&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The simplest thing is to just do what they recommend:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;(command&lt;STRONG&gt;&lt;FONT size="4" color="#0000FF"&gt;-s&lt;/FONT&gt;&lt;/STRONG&gt; "._UNDO" "_END")&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's a&amp;nbsp; &lt;FONT color="#000000"&gt;(vla-...&lt;/FONT&gt;&amp;nbsp; way to go about beginning &amp;amp; ending Undo that gets around that by not using&amp;nbsp; &lt;FONT color="#000000"&gt;(command)&lt;/FONT&gt;&amp;nbsp; for the purpose, but the simple edit should do it for you.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 16:20:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913136#M31037</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-04-21T16:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Undo begin and Undo End not getting trapped in error routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913231#M31038</link>
      <description>Amazing how you can overlook the obivous, when it is right there in front of you!</description>
      <pubDate>Fri, 21 Apr 2023 16:54:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913231#M31038</guid>
      <dc:creator>brbowen</dc:creator>
      <dc:date>2023-04-21T16:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Undo begin and Undo End not getting trapped in error routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913332#M31039</link>
      <description>&lt;P&gt;if you're curious, here's the vla version:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(vla-startundomark (vla-get-activedocument (vlax-get-acad-object)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(vla-endundomark (vla-get-activedocument (vlax-get-acad-object)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 21 Apr 2023 17:26:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913332#M31039</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-04-21T17:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Undo begin and Undo End not getting trapped in error routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913481#M31040</link>
      <description>Great, thanks.</description>
      <pubDate>Fri, 21 Apr 2023 18:29:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913481#M31040</guid>
      <dc:creator>brbowen</dc:creator>
      <dc:date>2023-04-21T18:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Undo begin and Undo End not getting trapped in error routine</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913489#M31041</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1137264"&gt;@paullimapa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;if you're curious, here's the vla version:&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;(vla-startundomark (vla-get-activedocument (vlax-get-acad-object)))&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;(vla-endundomark (vla-get-activedocument (vlax-get-acad-object)))&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The way I usually do that is, at the beginning:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(vla-startundomark &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;(setq doc&lt;/FONT&gt; &lt;/STRONG&gt;(vla-get-activedocument (vlax-get-acad-object))&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, &lt;EM&gt;both&lt;/EM&gt; at the end of the routine &lt;EM&gt;and&lt;/EM&gt; inside the *error* handler, all I need is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(vla-endundomark &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;doc&lt;/FONT&gt;&lt;/STRONG&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I include &lt;FONT color="#0000FF"&gt;doc&lt;/FONT&gt; in the localized variables list.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 18:33:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/undo-begin-and-undo-end-not-getting-trapped-in-error-routine/m-p/11913489#M31041</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-04-21T18:33:22Z</dc:date>
    </item>
  </channel>
</rss>

