My Photo

Search


  • Search 280+ postings

Site Awards



Syndications for this Site


« Autodesk Offers AU Discount to All | Main | Working with Environment Variables through AutoLISP »

Creating a New Document in AutoCAD with AutoLISP

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
(vl-load-com)

;; 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))
(princ)
)
;; End Code

Sincerely,
  Lee

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83420642b53ef00d83461afc569e2

Listed below are links to weblogs that reference Creating a New Document in AutoCAD with AutoLISP:

» Old PCAD and AutoCAD degree visualize experiments from DmLog
Six years ago I wrote educational software for 3D printed-circuit-board modeling. The program uses pdif format file from PCAD v4.5 (2000 and higher) as original source. For programming I used embedded Lisp in AutoCAD. AutoCAD v14 (2000 or higher) requi... [Read More]

Comments

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Comments are moderated, and will not appear until the author has approved them.

Feeds


  • Between the Lines Blog

  • Will render for food... Digital Media Blog

  • HyperPics.com