Author Topic: error: bad argument type: consp nil  (Read 4802 times)

0 Members and 1 Guest are viewing this topic.

mattsibum

  • Guest
error: bad argument type: consp nil
« on: August 04, 2015, 12:13:27 AM »
Hi all,

Have a routine i use to load / unload xrefs, but is displaying this error on the first run "error: bad argument type: consp nil". If i reload the lisp file, the error disappears, but want to fix it to avoid reloading every time. Lisp file attached.

Any help would be great.
Matt


Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: error: bad argument type: consp nil
« Reply #1 on: August 04, 2015, 01:18:07 AM »

I have no issues with the execution


Command: _XATTACH
Overlay Xref "201-Test02": I:\Jobs\_Dev\ST201\201-Test02.dwg
"201-Test02" loaded.
Command: XXX
1
Command:
XXX
Command:



Personally I'd add an error handler that includes a back-trace (BT) which will assist sorting out any issues.

In the meantime :
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

ronjonp

  • Needs a day job
  • Posts: 7531
Re: error: bad argument type: consp nil
« Reply #2 on: August 04, 2015, 09:01:32 AM »
Also you should get in the habit of localizing your variables .. that can bite you in the arse :) . Welcome to the Swamp.
Quote
; === Top statistic:
; Global variables: (USERCLICK)
; Function definition (with number of arguments): ((C:XXX . 0))
..
; === Top statistic:
; Global variables: (COUNT L LENLIST RELIST)
; Function definition (with number of arguments): ((RETXR . 0))
..
; === Top statistic:
; Global variables: (COUNT LENLIST TOGON)
; Function definition (with number of arguments): ((SWALL . 0))
.
; === Top statistic:
; Global variables: (COUNT LENLIST TOGOFF)
; Function definition (with number of arguments): ((SWNONE . 0))
.
; === Top statistic:
; Global variables: (COUNT LENLIST RELIST TOGGLE TOGSW)
; Function definition (with number of arguments): ((SWINV . 0))
.
; === Top statistic:
; Global variables: (COUNT LENLIST TOGS TV XDEFAULT)
; Function definition (with number of arguments): ((SWDEF . 0))
.
; === Top statistic:
; Global variables: (ABLOCK ACTIVEDOCUMENT THELIST THTOGLOCKS YESXREF)
; Function definition (with number of arguments): ((GETXREF . 0))
.
; Check done.
« Last Edit: August 04, 2015, 11:13:37 AM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: error: bad argument type: consp nil
« Reply #3 on: August 04, 2015, 11:04:10 AM »
If i reload the lisp file, the error disappears, but want to fix it to avoid reloading every time.
That tells me it's most probably global variables being set to something else somewhere, and then the next time you run the code the needed values are wrong.



It does seem that this is the case as per ronjon's test.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

mattsibum

  • Guest
Re: error: bad argument type: consp nil
« Reply #4 on: August 09, 2015, 10:47:01 PM »
Thanks for your help everyone, will try fix any global variables and see if that works.

Matt