Author Topic: loading lisp routines  (Read 11493 times)

0 Members and 1 Guest are viewing this topic.

danny

  • Guest
loading lisp routines
« on: March 09, 2005, 03:29:09 PM »
I have my ACAD search path browsing to a folder which contains .lsp files and .mns file.  For some reason ACAD does not recognize the .lsp files.  How can I get this to work?

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
loading lisp routines
« Reply #1 on: March 09, 2005, 03:51:18 PM »
Do get any error messages? What if you drag-n-drop from windows explorer into acad? What command are you using to load the .lsp files?
TheSwamp.org  (serving the CAD community since 2003)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
loading lisp routines
« Reply #2 on: March 09, 2005, 03:51:34 PM »
So this doesn't work ??

(findfile "TheHidingLispFile.lsp")
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.

danny

  • Guest
loading lisp routines
« Reply #3 on: March 09, 2005, 04:10:57 PM »
mark,
if I use the appload command the files will work, but I've seen it done through the search path before.  The reason is because I don't want to load all lisp files in the startup or 1 by 1 when I need them.
kerry
Quote
(findfile "TheHidingLispFile.lsp")

??

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
loading lisp routines
« Reply #4 on: March 09, 2005, 04:15:08 PM »
Unusual, I've never seen it return question marks before.

Is it possible the search path is too long?

What value is returned from this?

(strlen (getvar "acadprefix"))
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

nivuahc

  • Guest
loading lisp routines
« Reply #5 on: March 09, 2005, 04:22:35 PM »
Try putting this in your .MNL file (one for each lisp you want to load).

Code: [Select]
(defun C:LISP_COMMAND    () (prompt "\nLoading...") (load"path:/to/Lisp/Lisp_File")    (prompt "\nloaded.")(C:LISP_COMMAND))

For example, let's say I have a routine called OT that I store in my LISP folder on my C drive. The command that runs the routine is also OT so my line in my MNL file would look like this:

Code: [Select]
(defun C:OT      () (prompt "\nLoading...") (load"C:/LISP/OT")      (prompt "\nloaded.")(C:OT))

don't forget to use forward slashes (/)

danny

  • Guest
loading lisp routines
« Reply #6 on: March 09, 2005, 04:27:10 PM »
MP,
I got this
Code: [Select]
Command: (strlen(getvar"acadprefix"))
600

kerry,
Igot this
Code: [Select]
Command: (findfile"thehidinglispfile.lsp")
nil

ELOQUINTET

  • Guest
loading lisp routines
« Reply #7 on: March 09, 2005, 04:27:21 PM »
i only have this single file in my startup suite which will load whatever lisps i include. works great thanks to the smart peps here  :wink:

Code: [Select]
(defun danloader (/ filelst)

  (setq
    filelst
    (list
      "ADDEMUP.LSP"<<<<<<<INSERT YOUR LISPS HERE
      )
    )
  (setvar 'cmdecho 0)
  (foreach n filelst
           (if (not
                 (findfile n)
                 )
             (progn
               (prompt (strcat "\n" n " not found"))
               (princ)
               ); progn
             ;else
             (load n)
             ); if
           )
  (setvar 'cmdecho 1)
  (prompt "\nFiles Loaded.....")(princ)

  ); defun

nivuahc

  • Guest
loading lisp routines
« Reply #8 on: March 09, 2005, 04:29:06 PM »
That works too! :)

Mine loads them on demand.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
loading lisp routines
« Reply #9 on: March 09, 2005, 04:32:54 PM »
Quote from: danny
MP,
I got this
Code: [Select]
Command: (strlen(getvar"acadprefix"))
600

kerry,
Igot this
Code: [Select]
Command: (findfile"thehidinglispfile.lsp")
nil


uhm, Danny, replace the "thehidinglispfile.lsp" with the name of the file you want to find.
This will not load it, just returns the address if the file is found ...
If you get the address, then we can look at loading the file ..
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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
loading lisp routines
« Reply #10 on: March 09, 2005, 04:34:49 PM »
600 is reasonable, so that can be ruled out.

Now run this --

Code: [Select]
(progn
    (princ (getvar "acadprefix"))
    (princ)
)

What did it dump?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

danny

  • Guest
loading lisp routines
« Reply #11 on: March 09, 2005, 04:48:22 PM »
MP,
That listed what was in my search path
Code: [Select]
Command: (progn(princ(getvar"acadprefix"))(princ))
C:\Documents and Settings\derek\Application Data\Autodesk\Autodesk
Architectural Desktop 2004\R16.0\enu\SUPPORT;C:\Program Files\Autodesk
Architectural Desktop 2004\SUPPORT;C:\Program Files\Autodesk Architectural
Desktop 2004\FONTS;C:\Program Files\Autodesk Architectural Desktop
2004\HELP;C:\Program Files\Autodesk Architectural Desktop
2004\EXPRESS;C:\Program Files\Autodesk Architectural Desktop
2004\SUPPORT\COLOR;C:\DOCUMENTS AND SETTINGS\ALL USERS\APPLICATION
DATA\AUTODESK\AUTODESK ARCHITECTURAL DESKTOP
2004\R16.0\ENU\LAYERS;C:\2004CADMENU\MENU;M:\_Cad Support\AutoCAD
2004\2004dannyCAD\MENU;G:\AutoCADD misc\lisp files\UCS&Crosshairs;

kerry,
that found the path
Code: [Select]
Command: (findfile"35.lsp")
"G:\\AutoCADD misc\\lisp files\\UCS&Crosshairs\\35.lsp"

danny

  • Guest
loading lisp routines
« Reply #12 on: March 09, 2005, 04:50:40 PM »
dan,
thanks for that, but I'm not sure how to run that?  Is that a .lsp file that I put in the startup?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
loading lisp routines
« Reply #13 on: March 09, 2005, 04:58:41 PM »
I believe the ampersand (&) in the path

G:\\AutoCADD misc\\lisp files\\UCS&Crosshairs

may be throwing the load function for a loop. I always advise our users to avoid directory and files names with embedded ampersands.

What happens if you rename the directory and modify the acadprefix variable accordingly?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

danny

  • Guest
loading lisp routines
« Reply #14 on: March 09, 2005, 05:16:19 PM »
MP,
renamed path to G:\\AutoCADD misc\\lisp files\\UCS and reloaded in the search path.  Still doesn't reconize the .lsp files in that folder.  
I don't understand cause I have a folder with lisp in it which works fine.  If I put a new .lsp file in that folder, ACAD will not reconize it.