PDA

View Full Version : Audit, Purge and Save


pt_zooropa
2008-07-14, 05:46 PM
Hi,

I have this code:

(DEFUN NOECHO (/)
(SETQ CE (GETVAR "CMDECHO"))
(SETVAR "CMDECHO" 0)
(COMMAND "_.Undo" "_Begin")
) ;_ end of defun

(DEFUN ECHOON (/)
(COMMAND "_.Undo" "_End")
(SETVAR "CMDECHO" CE)
(PRINC)
) ;_ end of defun

(DEFUN AUDITFIX ()
(COMMAND "_.Audit" "_Yes")
(COMMAND "_.Regen")
) ;_ end of defun

(DEFUN *ERROR* (MSG)
(IF
(OR
(/= MSG "Function cancelled")
(= MSG "quit / exit abort")
) ;_ end of OR
(PRINC (STRCAT "\n\tERROR : " MSG "\n"))
(PRINC)
) ;_ end of IF
(COMMAND "_.Undo" "End")
(COMMAND "_.U")
(IF CE
(SETVAR "CMDECHO" CE)
) ;_ end of IF
(PRINC)
) ;_ end of DEFUN

(NOECHO)

(AUDITFIX)
(COMMAND "_.QSave") ;|Revised for AutoCAD 2007|;

(PRINC "\n\tDrawing Auditted and Saved\n\tin AutoCAD current format. \n") ;|Revised for AutoCAD 2007|;
(ECHOON))

I want to make an audit, purge and save, but this returns an error, and i dont know where is the error. Can someone help me? Thanks

Lions60
2008-07-14, 06:17 PM
The one thing i see is that you have an extra parenthesis at the very end of your program where it says ECHOON. Below is a revised copy that works for me.


(DEFUN NOECHO (/)
(SETQ CE (GETVAR "CMDECHO"))
(SETVAR "CMDECHO" 0)
(COMMAND "_.Undo" "_Begin")
) ;_ end of defun

(DEFUN ECHOON (/)
(COMMAND "_.Undo" "_End")
(SETVAR "CMDECHO" CE)
(PRINC)
) ;_ end of defun

(DEFUN AUDITFIX ()
(COMMAND "_.Audit" "_Yes")
(COMMAND "_.Regen")
) ;_ end of defun

(DEFUN *ERROR* (MSG)
(IF
(OR
(/= MSG "Function cancelled")
(= MSG "quit / exit abort")
) ;_ end of OR
(PRINC (STRCAT "\n\tERROR : " MSG "\n"))
(PRINC)
) ;_ end of IF
(COMMAND "_.Undo" "End")
(COMMAND "_.U")
(IF CE
(SETVAR "CMDECHO" CE)
) ;_ end of IF
(PRINC)
) ;_ end of DEFUN

(NOECHO)

(AUDITFIX)
(COMMAND "_.QSave") ;|Revised for AutoCAD 2007|;

(PRINC "\n\tDrawing Auditted and Saved\n\tin AutoCAD current format. \n") ;|Revised for AutoCAD 2007|;
(ECHOON)

pt_zooropa
2008-07-14, 07:48 PM
Thanks!
I have to pay more attention to parenthesis.

Lions60
2008-07-14, 08:09 PM
If you paste the code in Visual Lisp Editor (VLIDE) and try and load it then it will give you the error of extra right parenthesis. This is where i create all of my code so you may want to have a look at using it.