;;;============================================================================
;; KDUB_DemandLoader.LSP
;| KDUB:autolspload
Usage and Notes:
Adapted by kwb 2002 Aug 29
from posting to newsgroup by Kevin J. Nehls 3-31-2002
(KDUB:autolspload "<filename>"
'(("<func1_name>" "<arg1>" "<arg2>") ("<func2_name>" "<arg1>"))
)
(KDUB:autoarxload "<filename>" '(("<func1_name>" "<arg1>") ("<func2_name>")))
Example 1:
(KDUB:AutoLSPLoad "lspExample1" '(("C:cmd1") ("C:cmd2")))
Example 2:
(KDUB:AutoLSPLoad "lspExample2" '(("KDUB:EX2" "str1" "str2" "real" "int")))
KDUB:AutoARXLoad works exactly the same way as KDUB:AutoLSPLoad only for ARX files
Just add your KDUB:AutoxxxLoad statements to the end of this file or have
this file load
another file which has these statements.
1) Default support for VLX and FAS files without having to specify
the file extension.
2) It can KDUB:AutoXXXLoad any function with any number of arguments.
3) It won't throw you into an infinite loop if the file loaded
doesn't redefine the function/command that is to be called.
--AutoCAD's AutoLoader will do this.
If this happens you now get a message telling you where the
error occured.
--AutoCAD's AutoLoader does not do this.
4) If you want to autoload a command line command you have to
prefix it with C:, see Example 1.
5) To have multiple fuctions/commands autoloaded from the same
file, just add the additional functions as shown in the examples
6) There is no error handling in this AutoLoader. The only reason you
would have it is if the file you were loading was "self-executing".
I have my functions/routines handle the error handling and don't
need the AutoLoader to do this.
7) This AutoLoader currently needs to have AutoCAD 2000 or newer installed
to work just becuase of the use of (vl-filename-extension). You can
easily add support for just about all previous versions that support
the AutoLISP functions used by either removing that or just looking
at the last four chars and determining if it's an extension or not.
|;
(apptyp cmdfile cmdlst / cmdnam arglst cmdpfile)
arglst ""
)
)
)
"(defun "
cmdnam
" ("
arglst
" / tst)"
"(princ \"\nInitializing....\")"
"(setq tst "
cmdnam
")"
"(if (KDUB:autoloaderFindFile "
cmdpfile
")"
(strcat "(progn (load " cmdpfile
")") cmdpfile
")"
)
)
"(if (/= tst "
cmdnam
")"
"("
cmdnam
" "
arglst
")"
"(KDUB:autoloaderNoReDefun "
"\""
apptyp
"\""
" "
"\""
cmdnam
"\""
")
)
)"
"(KDUB:autoloaderNoFile "
cmdpfile
")
)"
")"
)
)
)
)
)
)
cmdlst
)
nil
)
;;;---------------------------------------------------------------------------------
(DEFUN KDUB:autoloaderFindFile
(appnam
) )
)
;;;---------------------------------------------------------------------------------
(DEFUN KDUB:autoloaderNoFile
(appnam
) appnam
"\""
"(.vlx/.fas/.lsp/.arx) "
" "
)
"was not found in your search path folders.\n"
"Check the installation of the support files and try again."
)
)
)
;;;---------------------------------------------------------------------------------
(DEFUN KDUB:autoloaderNoReDefun
(apptyp cmdnam
) "Load for function/command:\n\n\""
"\""
"\""
)
)
)
;;;---------------------------------------------------------------------------------
(DEFUN KDUB:autolspload
(appnam cmdlst
) (KDUB:autoloader
"lsp" appnam cmdlst
)) ;;;---------------------------------------------------------------------------------
;;;---------------------------------------------------------------------------------