Author Topic: loading lisp routines  (Read 11506 times)

0 Members and 1 Guest are viewing this topic.

danny

  • Guest
loading lisp routines
« Reply #30 on: March 10, 2005, 03:58:01 PM »
thanks CAB,
This (autoload) is sweet.  I like the fact that it will only load a lisp file on demand.

ronjonp

  • Needs a day job
  • Posts: 7529
loading lisp routines
« Reply #31 on: March 10, 2005, 04:26:05 PM »
I modified this routine sometime ago to write the autoload lines for all the lisp routines in a selected dir. The output file name is ACAD.LSP in the same dir picked. It's nice to use....especially if you have 100+ routines.


Code: [Select]
(defun c:acadlsp (/ fname dir dirlist file cntr)
  (setq fname (getfiled "Select a lisp file directory" "" "lsp" 8))
  (if fname
    (progn
      (setq dir     (vl-filename-directory fname)
    dirlist (vl-directory-files dir "*.lsp")
    file    (open (strcat dir "\\ACAD.LSP") "w")
    cntr    0
      )
      (repeat (length dirlist)
(setq fname (vl-filename-base (nth cntr dirlist)))
(write-line
  (strcase
    (strcat "(AUTOLOAD \"" fname "\" '(\"" fname "\"))")
    T
  )
  file
)
(setq cntr (1+ cntr))
      )
      (close file)
    )
  )
  (princ dir)
  (princ)
)

It will work with spaces in the directory.

*cleaned up code*

Ron
« Last Edit: August 24, 2006, 10:39:12 AM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
loading lisp routines
« Reply #32 on: March 10, 2005, 05:55:57 PM »
Very cool Ron. :)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Birdy

  • Guest
loading lisp routines
« Reply #33 on: March 10, 2005, 07:15:18 PM »
Hmmm... Interesting topic. Quite a few ways to skin this kitty.  I've been doing a few different things and just a week or so ago set up something similar to
Quote
have an acad.lsp with:

(AUTOLOAD "a2c" '("a2c"))
(AUTOLOAD "abl" '("abl"))
(AUTOLOAD "acret" '("acret"))......


except it's an acaddoc.lsp file.
A few lisps are "load" rather than "autoload" though.
I used to use the startup suite, but had periodic problems with it. Prolly something I did to screw it up though. :oops:

All our custom lisps are in one folder on the server and users s'port paths point to it.  I can just add files as I create them, and they're instantly available to everyone.

danny

  • Guest
loading lisp routines
« Reply #34 on: March 10, 2005, 07:42:55 PM »
ron,
dude...you just saved me choke time,
mahalo,

CADaver

  • Guest
loading lisp routines
« Reply #35 on: March 10, 2005, 08:13:05 PM »
Cool Ron, thanks.

ronjonp

  • Needs a day job
  • Posts: 7529
loading lisp routines
« Reply #36 on: March 11, 2005, 10:53:37 AM »
Glad to have helped :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC