Author Topic: Load or Code Issue? Invoking Lisp from Command Line  (Read 757 times)

0 Members and 1 Guest are viewing this topic.

Chillme1

  • Newt
  • Posts: 57
  • Must learn to earn!
Load or Code Issue? Invoking Lisp from Command Line
« on: December 20, 2021, 10:31:27 AM »
Before a needed back-to-basics LISP learning series, I ask:
What is needed to make this borrowed lisp routine run?

After ensuring the attached lisp file routine is in the SFSP and the loading it (load "deletelayerstate"), AutoCAD proudly announces that the LOAD failed.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:deletelayerstate (/ lsp pat s)
  2. (setvar "cmdecho" 0)
  3. (if (setq lst (a+layerstatelist))
  4. (foreach s lst
  5. (princ (strcat "\n" s))
  6. );foreach
  7. (setq pat (getstring "\nType name or patern of layerstates to delete: "))
  8. (command "_-Layer" "_State" )
  9. (foreach s lst
  10. (if (wcmatch s pat)
  11. (beep)
  12. (command "_delete" s)
  13. (princ (strcat "\n" s " - deleted"))
  14. );progn
  15. );if
  16. );foreach
  17. (command "" "")
  18. );progn
  19. );if
  20. );defun
Thanks, Clint
Mechanical Designer / Process Piping
AutoCAD Toolsets 2022
Newbie Betimes - LISP Programmer

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: Load or Code Issue? Invoking Lisp from Command Line
« Reply #1 on: December 20, 2021, 10:51:31 AM »
You need to find the following functions (and load those at the same time as this one):
(a+laterstatelist)
(beep)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Chillme1

  • Newt
  • Posts: 57
  • Must learn to earn!
Re: Load or Code Issue? Invoking Lisp from Command Line
« Reply #2 on: December 20, 2021, 02:42:19 PM »
Ah-ha! Delving into web history...!

Thanks,
Thanks, Clint
Mechanical Designer / Process Piping
AutoCAD Toolsets 2022
Newbie Betimes - LISP Programmer