It must be getting close to the end of the year and time to clean out the good old sample vault. Many of the samples that have been put up on my blog have been created throughout this year based on questions that I have gotten through e-mail, in passing at events such as AU and even from my online forum.
Have you ever wanted to create a new document using a macro and tried to use the NEW command to do this? Using the NEW command might not be the best approach. Below is a very basic custom function that demonstrates how to create a new drawing based on a template through AutoLISP.
;; Begin Code
;; Written by: Lee Ambrosius
;; Command macro option ^P(createnewdwg "acadiso.dwt")
;; Load the Visual LISP environment
;; Custom routine that allows you to create a new drawing
(defun createNewDWG (templateName)
(vla-activate (vla-add (vla-get-documents (vlax-get-acad-object)) templateName))
;; End Code