Author Topic: Setup routine  (Read 4009 times)

0 Members and 1 Guest are viewing this topic.

Anonymous

  • Guest
Setup routine
« on: September 07, 2004, 12:11:41 PM »
I am attempting to create a routine for setting up a drawing. I received the following error message:


Command:
Error: syntax error; error: An error has occurred inside the *error*
functionAutoCAD variable setting rejected: "filletrad" nil


The routine is as follows.....what do you suggest?


Code: [Select]
(DEFUN C:128)
              (setvar "textsize" 10.75)
     (setvar "dimtxt" 10.75)
     (setvar "dimasz" 10.75)
     (setvar "dimunit" 4)
     (setvar "ltscale" 128)
     (setvar "userr1" 4)
     (setvar "dimexo" 8)
     (setvar "dimexe" 23)
     (setvar "dimdli" 48)
     (setvar "dimcen" 11.5)
     (setvar "dimfit" 4)
     (setvar "dimgap" 11.5)
     (setvar "dimtad" 1)
(PRINC)



*Se7en edit*
- Added code tags to keep formatting.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Setup routine
« Reply #1 on: September 07, 2004, 12:23:38 PM »
Lines changed:
(DEFUN C:128 ()
.......
(PRINC)
)
Code: [Select]

(DEFUN C:128 ()
  (setvar "textsize" 10.75)
  (setvar "dimtxt" 10.75)
  (setvar "dimasz" 10.75)
  (setvar "dimunit" 4)
  (setvar "ltscale" 128)
  (setvar "userr1" 4)
  (setvar "dimexo" 8)
  (setvar "dimexe" 23)
  (setvar "dimdli" 48)
  (setvar "dimcen" 11.5)
  (setvar "dimfit" 4)
  (setvar "dimgap" 11.5)
  (setvar "dimtad" 1)
  (PRINC)
  )

JohnK

  • Administrator
  • Seagull
  • Posts: 10634
Setup routine
« Reply #2 on: September 07, 2004, 12:25:18 PM »
First and formost, the proper syntax for a AutoLisp procedure is as follows.

(defun <procedure name> ( <argument(s)> / <local vars> ) ...
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

TJAM51

  • Guest
Setup routine
« Reply #3 on: September 07, 2004, 12:26:16 PM »
I get the same error reading...I am using release 2000

JohnK

  • Administrator
  • Seagull
  • Posts: 10634
Setup routine
« Reply #4 on: September 07, 2004, 12:33:34 PM »
This is a lisp question. This would prolly be better answered if it is in the lisp forum.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Setup routine
« Reply #5 on: September 07, 2004, 12:33:36 PM »
functionAutoCAD variable setting rejected: "filletrad" nil

that has to do with the Fillet Radius variable, but that's not anywhere in your setup lisp...try copying and pasting my code into a new notepad file, select save, change to a directory specified in your file search path, change file type to "all types" and name it 128.LSP.  Then in AutoCAD type "AP" enter, load the 128.LSP and then type 128 at the command prompt...

JohnK

  • Administrator
  • Seagull
  • Posts: 10634
Setup routine
« Reply #6 on: September 07, 2004, 12:34:45 PM »
*bump!*
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Setup routine
« Reply #7 on: September 07, 2004, 12:49:12 PM »
Here is my lisp file...just download it into a search path directory (i.e. c:/program files/autocad/support) and load it...type 128 to run it...

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Setup routine
« Reply #8 on: September 07, 2004, 02:07:12 PM »
As shown by the error returned by AutoCAD, there is an error in your error routine, insomuch as it is trying to set the value of filletrad (in your error routine) and obviously the error routine relies on a variable to put it back where it should be. I would look at the error handler as well. It may be defined by another routine but not undefined at the end of the program.
The proper sequence of error handling is as follows ...
Code: [Select]

(defun <function> (<vars> / <localvars>)
 (setq olderror *error*)
 (setq *error* <thisfunctionerror>)
 ... program ...
 (setq *error* olderror)
)


In your error handler
Code: [Select]

(defun *thisfunctionerror* (err)
 ... program ...
(if olderror
 (setq *error* olderror)
)
)

Remember to ALWAYS reset your error handler to the default handler, both in the program AND the error routine itself. Otherwise you may have problems in your error handler if your program produces an error.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

CADaver

  • Guest
Setup routine
« Reply #9 on: September 07, 2004, 02:09:00 PM »
Quote from: Se7en
*bump!*
"Another brick in the wall"

Just curious, why reset all the dimvars, when you can just change the dimscale to 128????