Jump to content

best way to load different lisp files depending on which drawing is opened?


rtlflat

Recommended Posts

I was wanting to know best way to go about "linking" separate copies of lisp to specific drawings. I have drawings grouped in folders and would like to be able tweak the lisp for a group separately

 

brainstorming on it a bit it seems best way to go about this would be to write a lisp routine that automatically loads when a drawing is opened, and then loads the proper lisp from a relative path.

 

Folder1

-drawing1.dwg

-LISP

-lisp.lsp

Folder2

-drawing2.dwg

-LISP

-lisp.lsp

 

^^^ so for folder hierarchy above would mean opening drawing1.dwg would cause the lisp routine to open LISP/lisp.lsp in the Folder1 tree but opening drawing2.dwg opens LISP/lisp.lsp under Folder2 tree

 

Is this method a logical route to take or is there a more efficient way to get same result? or a script as opposed to a lisp routine?

Link to comment
Share on other sites

From your description, the easiest way that I see to achieve this (with no hardcoding of paths/filenames) would be to include an acaddoc.lsp in each drawing folder to load the appropriate programs; this exploits the fact that AutoCAD will search the working directory before any support file search paths and will only load the first acaddoc.lsp file found.

Link to comment
Share on other sites

How about using something like this on startup:

 

(defun LoadLispOnStart ( LispFileName / fnm )
 (if (findfile (setq fnm (strcat (getvar 'dwgprefix) LispFileName ".lsp")))
   (load fnm)
   (prompt "\nUnable to find \"" fnm "\" !")
 )
)

(LoadLispOnStart "Test")

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...