S::Startup Function

In the previous post about Startup Lisp Functions, the special (S::STARTUP) function was mentioned. Startup lisp code is loaded before the drawing is initialized, but you cannot call the (COMMAND) function until after the drawing is initialized. The solution is to place your (COMMAND) calls inside the (S::STARTUP) function. For example, if you want to reset the scale list and purge out regapps each time a drawing is opened, you could use something like this:

 (defun-q mystartup ()
  (command "._purge" "_R" "*" "_N")
  (command "._-scalelistedit" "_R" "_Y" "_E")
 )
 (setq S::STARTUP (append S::STARTUP mystartup))

Notice that we did not directly define (S::STARTUP). Because this function can be defined in other places, it is best to append to it rather than overwrite it. Use (defun-q) to create a function defined as a list, so it can be appended. To finish the example from the previous post

;;; acaddoc.lsp
(load "mylisp")
(load "another_lisp")
(load "\\\\server\\share\\a_lisp_and_specify_the_path")
(setvar "blipmode" 0)
(setvar "highlight" 1)
(defun-q mystartup ()
 (command "._purge" "_R" "*" "_N")
 (command "-scalelistedit" "_R" "_Y" "_E")
)
(setq S::STARTUP (append S::STARTUP mystartup))
;;; end acaddoc.lsp