Jump to content

Recommended Posts

Posted
Thanks Rick,

 

I got this error when I ran this lisp. What does it mean??

AutoCAD command: (nil)

AutoCAD command: (nil)

AutoCAD command: (nil)

...............

LOG Error trace

...............

:ERROR-BREAK

[2] (SETVAR "cmdpblightho" 1)

[3] (ETRAP "bad argument type: stringp nil")

:ERROR-BREAK

[5] (STRCAT "CCC_PL_" nil)

[6] (OUTPUT)

[7] (VARIABLE)

[8] (POPUP_MF)

[9] (C:BG)

:CALLBACK-ENTRY

:ARQ-SUBR-CALLBACK

...............

Backtrace is out of date

...............

 

 

;//////////////////////////////////////////////////////////////////////////
;
; Start-Up Function
;
(defun C:BG ()
 (POPUP_MF)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Main Function
;
(defun POPUP_MF (/ SIZE$ SIZE SUCE  SUOM  SUSM SUAB SUAD MIDPT PLEN
                  PT01  PT02 a b COLR)
 (setq SUCE (getvar "cmdecho"))
 (setq SUOM (getvar "orthomode"))
 (setq SUSM (getvar "osmode"))
 (setq SUAB (getvar "angbase"))
 (setq SUAD (getvar "angdir"))
 (setq SUCL (getvar "clayer"))
 (setq SUCR (getvar "cecolor"))
 (setq temperr *error*)
 (setq *error* ETRAP)
 (setq S1_list
  '("Proposed 180 PE 4 A" "Proposed 180 PE 4 B"
    "Proposed 150 PE 19 A" "Proposed 150 PE 19 B"
     "Proposed 125 PE 4 A"  "Proposed 125 PE 4 B"
     "Proposed 90 PE 4 A"  "Proposed 90 PE 4 B"
     "Proposed 63 PE 4 A"  "Proposed 63 PE 4 B"
     "--------------------------"
     "Existing 180 PE 4"  "Existing 150 PE 19"
     "Existing 125 PE 4"  "Existing 90 PE 4"
     "Existing 63 PE 4"
   )
 )
 (setq dcl_id (load_dialog "BG.dcl"))
 (if
   (not
     (new_dialog "BG" dcl_id)
   )
   (progn
     (ALERT "Can not find your dcl file")
     (exit)
   )
 )
 (start_list "S1")
 (mapcar 'add_list S1_list)
 (end_list)
 (if SIZE:DEF
   (set_tile "S1" (itoa SIZE:DEF))
 )
 (action_tile "cancel"
  "(done_dialog)(setq userclick nil)"
 )
 (action_tile "accept"
   (strcat
    "(progn
     (setq S:IZE (atoi (get_tile \"S1\")) SIZE:DEF S:IZE)"
    "(done_dialog)(setq userclick T))"
   )
 )
 (start_dialog)
 (unload_dialog dcl_id)
 (if userclick
   (VARIABLE)
 )
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Variable Function
;
(defun VARIABLE ()
 (progn 
   (setq SIZE$ (fix S:IZE))
   (setq SIZE$ (nth S:IZE S1_list))
   (cond
     ((= SIZE$ "Proposed 180 PE 4 A")(setq SIZE$ "PROPOSED_BordGais_180_PE_4_A")(setq LTYP "180PE4A")(setq COLR "177,12,228"))
     ((= SIZE$ "Proposed 180 PE 4 B")(setq SIZE$ "PROPOSED_BordGais_180_PE_4_B")(setq LTYP "180PE4B")(setq COLR "177,12,228"))
     ((= SIZE$ "Proposed 150 PE 19 A")(setq SIZE$ "PROPOSED_BordGais_150_PE_19_A")(setq LTYP "150PE19A")(setq COLR "177,12,228"))
     ((= SIZE$ "Proposed 150 PE 19 B")(setq SIZE$ "PROPOSED_BordGais_150_PE_19_B")(setq LTYP "150PE19B")(setq COLR "177,12,228"))
     ((= SIZE$ "Proposed 125 PE 4 A")(setq SIZE$  "PROPOSED_BordGais_125_PE_4_A")(setq LTYP "125PE4A")(setq COLR "177,12,228"))
     ((= SIZE$ "Proposed 125 PE 4 B")(setq SIZE$  "PROPOSED_BordGais_125_PE_4_B")(setq LTYP "125PE4B")(setq COLR "177,12,228"))
     ((= SIZE$ "Proposed 90 PE 4 A")(setq SIZE$  "PROPOSED_BordGais_90_PE_4_A")(setq LTYP "90PE4A")(setq COLR "177,12,228"))
     ((= SIZE$ "Proposed 90 PE 4 B")(setq SIZE$  "PROPOSED_BordGais_90_PE_4_B")(setq LTYP "90PE4B")(setq COLR "177,12,228"))
     ((= SIZE$ "Proposed 63 PE 4 A")(setq SIZE$  "PROPOSED_BordGais_63_PE_4_A")(setq LTYP "63PE4A")(setq COLR "177,12,228"))
     ((= SIZE$ "Proposed 63 PE 4 B")(setq SIZE$  "PROPOSED_BordGais_63_PE_4_B")(setq LTYP "63PE4B")(setq COLR "177,12,228"))
     ((= SIZE$ "Existing 180 PE 4")(setq SIZE$  "EXISTING_BordGais_180_PE_4")(setq LTYP "180PE4A")(setq COLR "204,81,5"))
     ((= SIZE$ "Existing 150 PE 19")(setq SIZE$  "EXISTING_BordGais_150_PE_19")(setq LTYP "150PE19A")(setq COLR "204,81,5"))
     ((= SIZE$ "Existing 125 PE 4")(setq SIZE$  "EXISTING_BordGais_125_PE_4")(setq LTYP "125PE4A")(setq COLR "204,81,5"))
     ((= SIZE$ "Existing 90 PE 4")(setq SIZE$  "EXISTING_BordGais_90_PE_4")(setq LTYP "90PE4A")(setq COLR "204,81,5"))
     ((= SIZE$ "Existing 63 PE 4")(setq SIZE$  "EXISTING_BordGais_63_PE_4")(setq LTYP "63PE4A")(setq COLR "204,81,5"))
   )
 )
 (setq SIZE SIZE$) 
 (OUTPUT)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Output Function
;
(defun OUTPUT ()
 (setq a (strcat "CCC_BG_"LTYP)
       b (strcat "CCC_SERVICES_"SIZE)
 )
 (if
   (not
     (tblsearch "LTYPE" a)
   )
   (command "_.-linetype" "_l" a "CCC_BordGais.lin" "")
 )
 (command "_.-layer" "_N" b "_M" b "_L" a b "_C" "_T" COLR b "_LW" "0.3" b "" )
 (command "_-color"  "bylayer")
 (command "._-linetype"  "s"  "bylayer" "")
 (setvar "angbase" 0.0000)
 (setvar "angdir"  0)
 (setvar "orthomode" 0)
 (setvar "osmode"    16383)
 (setq PT01 (getpoint "\nEnter the line start point:"))
 (while
   (/= nil
     (setq PT02 (getpoint pt01 "\nEnter the line end point:"))
   )
   (setvar "osmode" 0)
   (command "_.pline" PT01 PT02 "")
   (setq PT01 PT02)
   (setvar "osmode" 16383)
 )
 (setq *error* temperr)
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (setvar "clayer"    SUCL)
 (setvar "cecolor"    SUCR)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Error Trap Function
;
(defun ETRAP (errmsg)
 (command nil nil nil)
 (if
   (not
     (member errmsg '("console break" "Function Cancelled"))
   )
   (princ (strcat "\nError:" errmsg))
 )
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (princ "\nError, Restoring Variables.")
 (terpri)
 (setq *error* temperr)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////

 

The error Setvar [2] seems to point to a variable that doesn't exist in this lisp???

 

 

Hey woodman78,

 

I could'nt help but notice you are still using the same local function names in most of your codes. As I have pointed out to you this will cause a conflict.

 

This thread from months back is the origin of those local functions.

http://www.cadtutor.net/forum/showthread.php?t=38415&highlight=woodman78&page=2

 

And this thread brought a problem to light for you.

http://www.cadtutor.net/forum/showthread.php?t=39998&highlight=woodman78

 

Now here is another program with those same local functions. This is not to say that there may not be any other type of problem, But this code is a good indicator that you went back to naming all your local functions the same. Please give this a check and make sure that no other programs are loading with these same local function names.

The second link I had explained how to deal with this.

 

Good Luck

  • Replies 26
  • Created
  • Last Reply

Top Posters In This Topic

  • woodman78

    12

  • Lee Mac

    8

  • rkmcswain

    5

  • NBC

    1

Posted

You needn't rename all your functions, just localise them, as you do with variables.

Posted

Thanks Buzzard and LeeMac. I had missed out on a few alright.

I have gone back and started adding the Lisps one by one into the acaddoc.lsp to see which one was causing a problem and this one seems to be the first. The ones I include after this don't run but it doesn't show up any errors in vlide.

 

I do get the following when I load it though

bgblock.lsp successfully loaded.

Command: ; error: AutoCAD variable setting rejected: "cmdecho" nil

 

 
;//////////////////////////////////////////////////////////////////////////
;
; Start-Up Function
;
(defun C:bgblock ()
 (bgblock_MF)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Main Function
;
(defun bgblock_MF (/ SIZE$ SIZE SUCE  SUOM  SUSM SUAB SUAD MIDPT PLEN
                  PT01  PT02 a b Color INPT)
 (setq SUCE (getvar "cmdecho"))
 (setq SUOM (getvar "orthomode"))
 (setq SUSM (getvar "osmode"))
 (setq SUAB (getvar "angbase"))
 (setq SUAD (getvar "angdir"))
 (setq SUCL (getvar "clayer"))
 (setq SUCR (getvar "cecolor"))
 (setq temperr *error*)
 (setq *error* bgblock_ETRAP)
 (setq S1_list
  '("Proposed Gas Valve" "Existing Gas Valve"
   )
 )
 (setq dcl_id (load_dialog "bgblock.dcl"))
 (if
   (not
     (new_dialog "bgblock" dcl_id)
   )
   (progn
     (ALERT "Can not find your dcl file")
     (exit)
   )
 )
 (start_list "S1")
 (mapcar 'add_list S1_list)
 (end_list)
 (if SIZE:DEF
   (set_tile "S1" (itoa SIZE:DEF))
 )
 (action_tile "cancel"
  "(done_dialog)(setq userclick nil)"
 )
 (action_tile "accept"
   (strcat
    "(progn
     (setq S:IZE (atoi (get_tile \"S1\")) SIZE:DEF S:IZE)"
    "(done_dialog)(setq userclick T))"
   )
 )
 (start_dialog)
 (unload_dialog dcl_id)
 (if userclick
   (bgblock_VARIABLE)
 )
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; bgblock_VARIABLE Function
;
(defun bgblock_VARIABLE ()
 (progn 
   (setq SIZE$ (fix S:IZE))
   (setq SIZE$ (nth S:IZE S1_list))
   (cond
     ((= SIZE$ "Proposed Gas Valve")(setq SIZE$ "PROPOSED Gas Valve")(setq Color "117,12,228"))
     ((= SIZE$ "Existing Gas Valve")(setq SIZE$ "Existing Gas Valve")(setq Color "204,81,5"))
   )
 )
 (setq SIZE SIZE$) 
 (bgblock_OUTPUT)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; bgblock_OUTPUT Function
;
(defun bgblock_OUTPUT ()
       (setq b (strcat "CCC_SERVICES_"SIZE))
 (command "_.-layer" "_M" b "_C" "_T" Color b "_LW" "0.3" b "" )
 (command "_-color"  "bylayer")
 (command "._-linetype"  "s"  "bylayer" "")
 (setq INPT (getpoint "\Get insertion point:"))
 (command "_.insert" SIZE INPT "1" "1" "0")
 (setvar "angbase" 0.0000)
 (setvar "angdir"  0)
 (setvar "orthomode" 0)
 (setvar "osmode"    16383)
   (setvar "osmode" 0)
   (setvar "osmode" 16383)
 )
 (setq *error* temperr)
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (setvar "clayer"    SUCL)
 (setvar "cecolor"   SUCR)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Error Trap Function
;
(defun bgblock_ETRAP (errmsg)
 (command nil nil nil)
 (if
   (not
     (member errmsg '("console break" "Function Cancelled"))
   )
   (princ (strcat "\nError:" errmsg))
 )
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (princ "\nError, Restoring Variables.")
 (terpri)
 (setq *error* temperr)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////

 

Anyone any ideas???

Posted

Try this:

 


;//////////////////////////////////////////////////////////////////////////
;
; Start-Up Function
;
(defun C:bgblock ()
 (bgblock_MF)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Main Function
;
(defun bgblock_MF (/ SIZE$ SIZE SUCE  SUOM  SUSM SUAB SUAD MIDPT PLEN
                  PT01  PT02 a b Color INPT)
 (setq SUCE (getvar "cmdecho"))
 (setq SUOM (getvar "orthomode"))
 (setq SUSM (getvar "osmode"))
 (setq SUAB (getvar "angbase"))
 (setq SUAD (getvar "angdir"))
 (setq SUCL (getvar "clayer"))
 (setq SUCR (getvar "cecolor"))
 (setq temperr *error*)
 (setq *error* bgblock_ETRAP)
 (setq S1_list
  '("Proposed Gas Valve" "Existing Gas Valve"
   )
 )
 (setq dcl_id (load_dialog "bgblock.dcl"))
 (if
   (not
     (new_dialog "bgblock" dcl_id)
   )
   (progn
     (ALERT "Can not find your dcl file")
     (exit)
   )
 )
 (start_list "S1")
 (mapcar 'add_list S1_list)
 (end_list)
 (if SIZE:DEF
   (set_tile "S1" (itoa SIZE:DEF))
 )
 (action_tile "cancel"
  "(done_dialog)(setq userclick nil)"
 )
 (action_tile "accept"
   (strcat
    "(progn
     (setq S:IZE (atoi (get_tile \"S1\")) SIZE:DEF S:IZE)"
    "(done_dialog)(setq userclick T))"
   )
 )
 (start_dialog)
 (unload_dialog dcl_id)
 (if userclick
   (bgblock_VARIABLE)
 )
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; bgblock_VARIABLE Function
;
(defun bgblock_VARIABLE ()
 (progn 
   (setq SIZE$ (fix S:IZE))
   (setq SIZE$ (nth S:IZE S1_list))
   (cond
     ((= SIZE$ "Proposed Gas Valve")(setq SIZE$ "PROPOSED Gas Valve")(setq Color "117,12,228"))
     ((= SIZE$ "Existing Gas Valve")(setq SIZE$ "Existing Gas Valve")(setq Color "204,81,5"))
   )
 )
 (setq SIZE SIZE$) 
 (bgblock_OUTPUT)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; bgblock_OUTPUT Function
;
(defun bgblock_OUTPUT ()
       (setq b (strcat "CCC_SERVICES_"SIZE))
 (command "_.-layer" "_M" b "_C" "_T" Color b "_LW" "0.3" b "" )
 (command "_-color"  "bylayer")
 (command "._-linetype"  "s"  "bylayer" "")
 (setq INPT (getpoint "\Get insertion point:"))
 (command "_.insert" SIZE INPT "1" "1" "0")
 (setvar "angbase" 0.0000)
 (setvar "angdir"  0)
 (setvar "orthomode" 0)
 (setvar "osmode"    16383)
   (setvar "osmode" 0)
   (setvar "osmode" 16383)
 
 (setq *error* temperr)
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (setvar "clayer"    SUCL)
 (setvar "cecolor"   SUCR)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Error Trap Function
;
(defun bgblock_ETRAP (errmsg)
 (command nil nil nil)
 (if
   (not
     (member errmsg '("console break" "Function Cancelled"))
   )
   (princ (strcat "\nError:" errmsg))
 )
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (princ "\nError, Restoring Variables.")
 (terpri)
 (setq *error* temperr)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////

 

You had an extra bracket.

Posted

Thanks for that LeeMac. It moved things on a bit. How do you spot the extra bracket? Can you check it in vlide??

Posted
Thanks for that LeeMac. It moved things on a bit. How do you spot the extra bracket? Can you check it in vlide??

 

Well, because the error was upon loading, I knew the that code was outside of a functiond definition - which pointed me to an extra bracket somewhere, so I double clicked on the end bracket of each function definition, until I found one that didn't encapsulate the whole function, and bingo! :)

Posted

Thanks LeeMac and Buzzard, I created the acaddoc.lsp one line at a time and saw which lisps were giving trouble. A number of them had the extra bracket so now there are all working correctly.

 

Thanks again.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...