TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ROBBO on March 07, 2014, 10:07:57 AM

Title: acaddoc.lsp
Post by: ROBBO on March 07, 2014, 10:07:57 AM
Hello,

I have a acaddoc.lsp to load and autoload various lisp routines and commands on AutoCAD start-up. There is one particular routine I would like to Load in after all other routines and commands have loaded from the acaddoc.lsp .

Any help on how I can achieve this would be much appreciated.

Many thanks in advance, Robbo.
Title: Re: acaddoc.lsp
Post by: alanjt on March 07, 2014, 10:11:59 AM
Put its loading sequence at the bottom of the acaddoc file.
Title: Re: acaddoc.lsp
Post by: ROBBO on March 07, 2014, 10:21:55 AM
Thank you alanjt for your prompt reply. I tried this, but didn't appear to work. The particular routine in question appears to load again once another routine is loaded from a custom dll on start-up.
Title: Re: acaddoc.lsp
Post by: Lee Mac on March 08, 2014, 09:58:26 AM
There is one particular routine I would like to Load in after all other routines and commands have loaded from the acaddoc.lsp

Load the program using the s::startup function - this is a 'post-initialisation' funciton which is evaluated after all other drawing startup processes.

Here is an example of a wrapper for the load function to enable you to define a post-initialisation load call:
Code: [Select]
(defun post-load ( lsp )
    (if (findfile lsp)
        (if (= 'list (type s::startup))
            (if (not (member (list 'load lsp 'nil) s::startup))
                (setq s::startup (append s::startup (list (list 'load lsp 'nil))))
            )
            (eval (list 'defun-q 's::startup 'nil (list 'load lsp 'nil) '(princ)))
        )
        (prompt (strcat "\n\"" lsp "\" not found."))
    )
)
Add an expression to your acaddoc.lsp with the filename of the program to load, e.g.:
Code: [Select]
(post-load "mylisp.lsp")
Title: Re: acaddoc.lsp
Post by: ROBBO on March 10, 2014, 03:01:54 AM
Excellent! Thank you Lee for your responce. This solved my problem and routines now load (once) in the correct order as listed in my acaddoc.lsp. :kewl:

Cheers, Robbo.
Title: Re: acaddoc.lsp
Post by: Lee Mac on March 10, 2014, 06:40:29 PM
Excellent to hear Robbo - you're most welcome!  :-)