<?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: Lisp error restoring system variables autocad in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10696599#M53797</link>
    <description>&lt;P&gt;Normally (in the last 20+ years) one would make the *error* function local to a command function, and within the *error* function perform resetting sysvars.&lt;/P&gt;
&lt;P&gt;I like the way&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt; does it.&amp;nbsp; &amp;nbsp;Even if he is not the author of the approach he deserves lots of credit for sharing it.&amp;nbsp; Example:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun c:MyCommand ( / *error* vars vals)
  (defun *error* (error)
    (mapcar 'setvar vars vals)
    (vla-endundomark *doc*)
    (cond
      ((not error))
      ((wcmatch (strcase error) "*QUIT*,*CANCEL*"))
      (1 (princ (strcat "\nERROR: " error)))
    )
    (princ)
  )
  (setq vars '(cmdecho attreq attdia dimzin))
  (setq vals (mapcar 'getvar vars))
  (or *acad* (setq *acad* (vlax-get-acad-object)))
  (or *doc* (setq *doc* (vla-get-ActiveDocument *acad*)))
  (vla-endundomark *doc*)
  (vla-startundomark *doc*)
  (mapcar 'setvar vars '(0 1 0 0))
  ;; Now do all your stuff here
  (*error* nil) ; which will do all the clean-up and exit quietly
)&lt;/LI-CODE&gt;
&lt;P&gt;:&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Oct 2021 19:24:37 GMT</pubDate>
    <dc:creator>john.uhden</dc:creator>
    <dc:date>2021-10-18T19:24:37Z</dc:date>
    <item>
      <title>Lisp error restoring system variables autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10696292#M53793</link>
      <description>&lt;P&gt;When starting a lisp command , I'm getting an error restoring system variables , what does this mean ?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 16:46:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10696292#M53793</guid>
      <dc:creator>bsniderEMXBD</dc:creator>
      <dc:date>2021-10-18T16:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp error restoring system variables autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10696366#M53794</link>
      <description>&lt;P&gt;Author of this lisp file has defined function&amp;nbsp; GZERROR (at the end of file) that looks like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(DEFUN GZERROR(msg)
	(alert "ERROR RESTORING SYSTEM VARIABLES.")
        (GZRESTOREVARS)
	(PRINC)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This function is in main program assigned to global error handling function. In case of an error alert "ERROR RESTORING SYSTEM VARIABLES" shows up and than function GZRESTOREVARS is called that restores standard or old system variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(DEFUN GZRESTOREVARS()
	(SETQ *error* OLDERROR)
	(SETVAR "PLINEWID" OLDPLINEWID)
        (SETVAR "CELTYPE" OLDCELTYPE)
        (SETVAR "CECOLOR" OLDCECOLOR)
	(SETVAR "BLIPMODE" OLDBLIPMODE)
	(SETVAR "OSMODE" OLDOSMODE)
	(SETVAR "CMDECHO" OLDCMDECHO)
	(SETVAR "FILEDIA" OLDFILEDIA)
	(SETVAR "CMDDIA" OLDCMDDIA)
	(SETVAR "ORTHOMODE" OLDORTHOMODE)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since you are missing some parts of the script like variable GZPTH and files GZBOX.dat&amp;nbsp; and GZBOX.INI function doesn't work and it instantly calls error handling function. You have to look at original location about information how to save and load this code and download missing parts.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 17:17:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10696366#M53794</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2021-10-18T17:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp error restoring system variables autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10696387#M53795</link>
      <description>&lt;P&gt;Thank you , I will try to find the missing parts . The lisp works on a different computer here, we cant get it to work on the others.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 17:22:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10696387#M53795</guid>
      <dc:creator>bsniderEMXBD</dc:creator>
      <dc:date>2021-10-18T17:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp error restoring system variables autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10696545#M53796</link>
      <description>&lt;P&gt;Your the programe Lisp , contain &lt;FONT color="#FF0000"&gt;many &lt;EM&gt;&lt;FONT size="5"&gt;fantastics&lt;/FONT&gt;&lt;/EM&gt; -powerMathEquation/s... great calc of math point/s&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;That reason , together we need more help collaboration.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I need your help, for the recovery of all math equations and in the future You can insert these All math Equations .&lt;/P&gt;&lt;P&gt;inside C# or Vba.&lt;/P&gt;&lt;P&gt;I need &amp;nbsp;your Help for growing your Math-Equations.&lt;span class="lia-unicode-emoji" title=":kissing_face:"&gt;😗&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#region
dfn_rsc2

(Defun dfn_rsc2(/ $rr)

/*c2s: pt1=lISt(0,0);
pt2=lISt( ( (len+a)- (sw/2.0)),cadr(pt1));
pt3=lISt(car(pt2), ( ( (wid/2.0)+e)- (sw/2.0)));
pt4=lISt( (car(pt2)+sw),cadr(pt3));
pt5=lISt(car(pt4),cadr(pt1));
pt6=lISt( ( ( (len+wid)+ (a+b))- (sw/2.0)),cadr(pt1));
pt7=lISt(car(pt6),cadr(pt3));
pt8=lISt( (car(pt6)+sw),cadr(pt3));
pt9=lISt(car(pt8),cadr(pt1));
pt10=lISt( ( (len+c)+car(pt6)),cadr(pt1));
pt11=lISt(car(pt10),cadr(pt3));
pt12=lISt( (car(pt11)+sw),cadr(pt3));
pt13=lISt(car(pt12),cadr(pt1));
pt14=lISt( ( (car(pt2)+ (wid+d))- (sw/2.0)),cadr(pt1));
if (fl == 0.0)
   pt14=lISt( (car(pt14)+sw),cadr(pt14));
pt15=lISt(car(pt14), (cadr(pt3)+ (sw/2.0)))
pt16=lISt( ( (car(pt14)+sw)+fl),cadr(pt15))
if (fl == 0.0 )
   pt16=lISt(car(pt14),cadr(pt15));
cpt1=lISt(car(pt1), ( ( (wid/2.0)+e)+ ( (hgt+f)/2.0)));
cpt2=lISt(car(pt16),cadr(cpt1));
spt1=lISt(car(pt1),cadr(pt15));
spt2=lISt(car(pt15), ( (hgt+f)+cadr(pt15)));
spt3=lISt(car(pt1),cadr(spt2));
spt4=lISt( (len+a),cadr(spt1));
spt5=lISt(car(spt4),cadr(spt3));
spt6=lISt( (car(spt4)+ (wid+b)),cadr(spt1));
spt7=lISt(car(spt6),cadr(spt3));
spt8=lISt( (car(spt6)+ (len+c)),cadr(spt1));
spt9=lISt(car(spt8),cadr(spt3));
spt10=lISt( (car(spt4)+ (wid+d)),cadr(spt1));
spt11=lISt(car(spt10),cadr(spt3));
setvar("plinewid",0);
setvar("osmode",0);
setvar("cmdecho",0);
setvar("cecolor",clc);
setvar("celtype",clt);
command("pline",cpt1,pt1,pt2,pt3,"a",pt4,"l",pt5,pt14,pt15,pt16,cpt2,"")
command("zoom","all");
command("mirror",pt1,"",cpt1,cpt2,"n");
setvar("cecolor",slc);
setvar("celtype",slt);
command("line",spt1,pt15,"");
command("line",spt2,spt3,"");
command("line",spt4,spt5,"");
if (fl != 0.0 )
  command("line",spt10,spt11,"");
*/
$rr)
#endregion
io.sys="You must force all variabile name to lowercase";&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="5"&gt;Can you see the function name, RSC("is great math calc")?&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="5"&gt;If you love mathCalc, &amp;nbsp;then I hope we can share moreMath.&lt;span class="lia-unicode-emoji" title=":kissing_face_with_smiling_eyes:"&gt;😙&lt;/span&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="a14.jpg" style="width: 733px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/978673i86FF2CF1DF19ABE1/image-size/large?v=v2&amp;amp;px=999" role="button" title="a14.jpg" alt="a14.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 18:56:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10696545#M53796</guid>
      <dc:creator>diagodose2009</dc:creator>
      <dc:date>2021-10-18T18:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp error restoring system variables autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10696599#M53797</link>
      <description>&lt;P&gt;Normally (in the last 20+ years) one would make the *error* function local to a command function, and within the *error* function perform resetting sysvars.&lt;/P&gt;
&lt;P&gt;I like the way&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt; does it.&amp;nbsp; &amp;nbsp;Even if he is not the author of the approach he deserves lots of credit for sharing it.&amp;nbsp; Example:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun c:MyCommand ( / *error* vars vals)
  (defun *error* (error)
    (mapcar 'setvar vars vals)
    (vla-endundomark *doc*)
    (cond
      ((not error))
      ((wcmatch (strcase error) "*QUIT*,*CANCEL*"))
      (1 (princ (strcat "\nERROR: " error)))
    )
    (princ)
  )
  (setq vars '(cmdecho attreq attdia dimzin))
  (setq vals (mapcar 'getvar vars))
  (or *acad* (setq *acad* (vlax-get-acad-object)))
  (or *doc* (setq *doc* (vla-get-ActiveDocument *acad*)))
  (vla-endundomark *doc*)
  (vla-startundomark *doc*)
  (mapcar 'setvar vars '(0 1 0 0))
  ;; Now do all your stuff here
  (*error* nil) ; which will do all the clean-up and exit quietly
)&lt;/LI-CODE&gt;
&lt;P&gt;:&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 19:24:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10696599#M53797</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2021-10-18T19:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp error restoring system variables autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10698189#M53798</link>
      <description>&lt;P&gt;I have the missing files in the folder and I'm still getting the same error. Gzbox.ini and gzbox.dat.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 11:45:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10698189#M53798</guid>
      <dc:creator>bsniderEMXBD</dc:creator>
      <dc:date>2021-10-19T11:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp error restoring system variables autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10698366#M53799</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8172019"&gt;@bsniderEMXBD&lt;/a&gt;&amp;nbsp; Have you run GZSETUP.&amp;nbsp; Also add directory where you are holding this lisp to Autocad trusted location. If it won't run attach those missing files so that we can make tests.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 12:56:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10698366#M53799</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2021-10-19T12:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp error restoring system variables autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10699019#M53800</link>
      <description>&lt;P&gt;The gzbox setup file&amp;nbsp; is actually missing. I attached the .dat and ini file and renamed them .txt.&amp;nbsp; &amp;nbsp;I made sure they are in a trusted folder, still no luck&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 17:04:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10699019#M53800</guid>
      <dc:creator>bsniderEMXBD</dc:creator>
      <dc:date>2021-10-19T17:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp error restoring system variables autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10699097#M53801</link>
      <description>&lt;P&gt;On the computer where it works there must be setup directory&amp;nbsp; with other missing parts and code that loads at Acad startup. I don't know anything about your application, is it a freeware or payed application.....&lt;/P&gt;&lt;P&gt;When you set variable GZPTH t point to location where lsp, dat and ini file is saved, let say&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq GZPTH "D:\\GZ\\")&lt;/LI-CODE&gt;&lt;P&gt;Lisp loads but it's missing DCL and maybe something more.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 17:39:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10699097#M53801</guid>
      <dc:creator>hak_vz</dc:creator>
      <dc:date>2021-10-19T17:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp error restoring system variables autocad</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10699242#M53802</link>
      <description>&lt;P&gt;Thank you, I will search the directory on the other computer&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 18:54:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-error-restoring-system-variables-autocad/m-p/10699242#M53802</guid>
      <dc:creator>bsniderEMXBD</dc:creator>
      <dc:date>2021-10-19T18:54:12Z</dc:date>
    </item>
  </channel>
</rss>

