Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Override error handler or catch error twice?

1 REPLY 1
Reply
Message 1 of 2
Anonymous
446 Views, 1 Reply

Override error handler or catch error twice?

I'm trying to set variables before and after running a script I downloaded that is encrypted. The script has it's own error handling and puts up an error message every time you end the command. My error handler is never being called, let alone the rest of the script.

 

Is there a way to override the error handler of an already defined function? or to catch errors that have already been caught?

 

 

(load "LBL2.LSP") ; contains "C:LBL" command

(defun c:PropertyLineLabel (/ *error* main doc)
	(vl-load-com)
	(defun main ()
		(vla-StartUndoMark (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))))
		
		(setvar "DIMLFAC" (/ 1 12.0))
		(setvar "LUPREC" 2)
		(C:LBL)
		(setvar "DIMLFAC" 1)
		(setvar "LUPREC" 4)

		(vla-EndUndoMark doc)
		(princ)
	)
	(defun *error*(s)
		(princ s)
		(vla-EndUndoMark doc)
		(setvar "DIMLFAC" 1)
		(setvar "LUPREC" 4)
		(princ)
	)
	(main)
)

 

 

Labels (1)
1 REPLY 1
Message 2 of 2
CodeDing
in reply to: Anonymous

@Anonymous ,

 

I believe you will need to use a global error handler. The error handler defined inside of (c:LBL) was created to HANDLE errors within that function. so if a user is "exiting" (creating an errror) inside THAT function, then THAT error handler will be called.

 

To alleviate this, you will need to update the internal handler for (c:LBL) OR create a global error handler.

 

Best,

~DD


Need AutoLisp help? Try my custom GPT 'AutoLISP Ace':
https://chat.openai.com/g/g-Zt0xFNpOH-autolisp-ace

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report