Lisp error restoring system variables autocad

Lisp error restoring system variables autocad

bsniderEMXBD
Participant Participant
851 Views
9 Replies
Message 1 of 10

Lisp error restoring system variables autocad

bsniderEMXBD
Participant
Participant

When starting a lisp command , I'm getting an error restoring system variables , what does this mean ?

0 Likes
852 Views
9 Replies
Replies (9)
Message 2 of 10

hak_vz
Advisor
Advisor

Author of this lisp file has defined function  GZERROR (at the end of file) that looks like this

 

(DEFUN GZERROR(msg)
	(alert "ERROR RESTORING SYSTEM VARIABLES.")
        (GZRESTOREVARS)
	(PRINC)
)

 

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.

 

(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)
)

 

Since you are missing some parts of the script like variable GZPTH and files GZBOX.dat  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.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 3 of 10

bsniderEMXBD
Participant
Participant

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.

0 Likes
Message 4 of 10

diagodose2009
Collaborator
Collaborator

Your the programe Lisp , contain many fantastics -powerMathEquation/s... great calc of math point/s

That reason , together we need more help collaboration.

I need your help, for the recovery of all math equations and in the future You can insert these All math Equations .

inside C# or Vba.

I need  your Help for growing your Math-Equations.😗

 

 

 

 

 

 

#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";

 

 

 

 

 

 

Can you see the function name, RSC("is great math calc")?

If you love mathCalc,  then I hope we can share moreMath.😙

a14.jpg

0 Likes
Message 5 of 10

john.uhden
Mentor
Mentor

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.

I like the way @Kent1Cooper does it.   Even if he is not the author of the approach he deserves lots of credit for sharing it.  Example:

(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
)

John F. Uhden

0 Likes
Message 6 of 10

bsniderEMXBD
Participant
Participant

I have the missing files in the folder and I'm still getting the same error. Gzbox.ini and gzbox.dat.

0 Likes
Message 7 of 10

hak_vz
Advisor
Advisor

@bsniderEMXBD  Have you run GZSETUP.  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.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 8 of 10

bsniderEMXBD
Participant
Participant

The gzbox setup file  is actually missing. I attached the .dat and ini file and renamed them .txt.   I made sure they are in a trusted folder, still no luck

0 Likes
Message 9 of 10

hak_vz
Advisor
Advisor

On the computer where it works there must be setup directory  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.....

When you set variable GZPTH t point to location where lsp, dat and ini file is saved, let say 

(setq GZPTH "D:\\GZ\\")

Lisp loads but it's missing DCL and maybe something more.

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 10 of 10

bsniderEMXBD
Participant
Participant

Thank you, I will search the directory on the other computer

0 Likes