; error: no function definition: nil

; error: no function definition: nil

Anonymous
Not applicable
2,764 Views
22 Replies
Message 1 of 23

; error: no function definition: nil

Anonymous
Not applicable

Hello.

I worked with .lsp below about 4 years and now it's not working. I didn't change the file, that error just happened. What should I do to make it work with AutoCAD 2020?

(defun c:elen(/ fList firSet entSet filOut entList totLen)
  (vl-load-com)
  (setq fList '((-4 . "<OR")(0 . "*LINE")
      (0 . "CIRCLE")(0 . "ARC")
      (0 . "ELLIPSE")(-4 . "OR>")
      (-4 . "<NOT")(0 . "MLINE")
      (-4 . "NOT>"))
   filOut 0
   ); end setq
  (if
    (not
      (and
   (setq firSet(ssget "_I")
         entSet(ssget "_I" fList)
         ); end setq
   ); end and
      ); end not
    (setq entSet(ssget fList))
    (setq filOut(-(sslength firSet)(sslength entset)))
    ); end if
  (if entSet
    (progn
      (setq entList
      (mapcar 'vlax-ename->vla-object
                    (vl-remove-if 'listp
                     (mapcar 'cadr(ssnamex entSet))))
       totLen
        (apply '+
          (mapcar '(lambda (x)
                (vlax-curve-getDistAtParam x
             (vlax-curve-getEndParam x)))
             entList); end mapcar
          ); end apply
       ); end setq
      (if(/= 0 filOut)
   (princ(strcat "\n" (itoa filout)
            " were filtered out (unsupported type)"))
   ); end if
      (princ(strcat "\nTotal entities: "(itoa(length entList))
          " Total length: "(rtos totLen)); end strcat
       ); end princ
      ); end progn
    (progn
        (if(/= 0 filOut)
   (princ(strcat "\n" (itoa filout)
            " were filtered out (unsupported type)"))
   (princ "\nNothing selected")
   ); end if
    ); end progn
    ); end if
      (princ)
      ); end c:elen
0 Likes
2,765 Views
22 Replies
Replies (22)
Message 21 of 23

john.uhden
Mentor
Mentor

I am baffled as well.

Perhaps some other program has been added that inadvertently sets one or more of those functions to nil.

Either that or he should reinstall.  I mean it's not as though he had localized cadr.

Meanwhile, you guys have spent a lot of typing about his filter list.

Might this be the simplest form?...

'((0 . "*LINE,ARC,<I forget>,~MLINE,~XLINE")) ;; btw, those are squiggles(?), not hyphens)

John F. Uhden

0 Likes
Message 22 of 23

Sea-Haven
Mentor
Mentor

~ Tilde

 

SeaHaven_0-1632011181035.png

 

0 Likes
Message 23 of 23

Anonymous
Not applicable

Hello everyone,

thanks for your answers and help!

Anyway, I messed up the Windows Registry and every LISP stopped working. Also I moved my system to new SSD (not related to LISP problem) and with ACAD 2021 everything works fine.

 

0 Likes