Jump to content

Combining Lisp routines


Nobull84

Recommended Posts

Maybe I'm just too new at the LISP thing but I've been through many forums and nothing really seems to spell it out for the layman, i.e. me.

 

My company seems rather fresh to LISP as well but they have one "master" list of lisps they have used for some time. This list is loaded in everyone's CAD. I have several others that I have found that I would like to add to this master list but I don't see how they are separated and loaded.

 

The idea is to update this master list with new commands and have others be able to simply have them available the next time CAD is started up again when the original lisp is loaded. Is there a quickie routine that loads other locations?

 

I was given this style of line and told it would do such a thing but I must still be doing something wrong

(load "brkblk")
(load "BreakObjects18")
(load "CCC")
(load "Copy2DrawingsV1-2")
(load "Copy2LayoutsV1-1")
(load "DoubleOffsetV1-1")
(load "Dynamic-Offset")
(load "MCOPY")
(load "QuickDimAligned-QDA")
(load "ROT2ENT")


(princ (load "BreakObjects18" "\nBreakObjects18.LSP file not loaded.."))
(princ (load "CCC" "\nCCC.LSP file not loaded.."))
(princ (load "Copy2DrawingsV1-2" "\nCopy2DrawingsV1-2.LSP file not loaded.."))
(princ (load "Copy2LayoutsV1-1" "\nCopy2LayoutsV1-1.LSP file not loaded.."))
(princ (load "DoubleOffsetV1-1" "\nDoubleOffsetV1-1.LSP file not loaded.."))
(princ (load "Dynamic-Offset" "\nDynamic-Offset.LSP file not loaded.."))
(princ (load "MCOPY" "\nMCOPY.LSP file not loaded..."))
(princ (load "QuickDimAligned-QDA" "\nQuickDimAligned-QDA.LSP file not loaded..."))
(princ (load "ROT2ENT" "\nROT2ENT.LSP file not loaded..."))

 

Thanks for the patience,

 

-Nobull

Link to comment
Share on other sites

I use this scenario; lets say ycopy.lsp contains a definition for c:ycopy

(defun c:yc () (if (not c:ycopy) (load "YCOPY"))(c:ycopy))

 

This way you have shortcut keys defined with on demand usage of resources.

 

I have approx 400 of these in my acad(doc).lsp file

 

 

You would need to make a single defun for each routine.

 

You could always have a large library .lsp file that contains many routines but has to be fully loaded in each session. A waste of resources ( IMO ) not to mention very hard to debug.

 

 

-David

Link to comment
Share on other sites

Just be careful as David's example uses a two letter name "YC", not to replace an ACAd command with the name of the lisp.

 

 

Other than acad.pgp, I know of no other core ACAD command that is only 2 letters long. Maybe something new ?

Link to comment
Share on other sites

My question is are you only accessing via the keyboard ?

 

If your using menus or toolbars then you can demand load a single lisp that is not in the master lisp. I took a different approach for a big scheme 100+ lisps I had a common library of functions that autoloaded stuff like setting correct layers dynamically, each lisp was called from a menu but once loaded often could then be called again by keyboard. Its pretty hard to remember the key code for every lisp hence menu's.

Link to comment
Share on other sites

There's a bunch more two letter shortcuts like that (sorry I don't have a list), just as a precaution the OP should test for the existance of any particular two letter shortcut prior to naming a LISP function with a two letter name.

 

I don't believe the two letter commands are part of express tools as they also works in BricsCAD.

 

Bruce

Link to comment
Share on other sites

There's a bunch more two letter shortcuts like that (sorry I don't have a list), just as a precaution the OP should test for the existance of any particular two letter shortcut prior to naming a LISP function with a two letter name.

 

Defining AutoLISP commands using existing command aliases does not cause a problem (other than the user may not receive the command they were expecting when issuing the alias).

 

For example, I can safely write the following program even though 'L' is the standard alias for the LINE command:

(defun c:L ( )
   (princ "\nHa! I bet you were expecting the LINE command...")
   (princ)
)

The problems arise if an AutoLISP program attempts to redefine the full command name without issuing a call to the UNDEFINE command first, for example:

(defun c:LINE ( )
  ...
)

It is unrealistic to expect a developer to ensure that a defined AutoLISP command does not clash with any existing aliases as command aliases are not fixed and may be added & amended on a per user basis.

 

Lee

Link to comment
Share on other sites

Back to Nobull re-read 1st post a lisp can live anywhere the user has read access to on local or networks just use full path name F:\mystuff\inthere also\about\now biglisp.lsp may need \\ to work properly.

Link to comment
Share on other sites

I was given this style of line and told it would do such a thing but I must still be doing something wrong
Why do you think you are doing something wrong? I don't see where you explained what you did and what the results were to evaluate this. Maybe you could share a bit more of what you have actually done with what you were given. E.g., Did you actually find the master list? Is that what you are showing us? Did you try adding something to it? Etc.

 

BTW, I think you are expected to use Code tags for LISP, not use HTML tags.

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...