Friday, February 11, 2005

Set the Default Template File Name for QNEW using LISP or VBA

This can be set using the Options dialog box or code as well as directly accessing the registry. But writing to the registry directly from AutoCAD doesn't work since AutoCAD overwrites it when exiting AutoCAD or when the Options dialog box is opened. Writing to the registry only works if AutoCAD is closed. Reading from the registry works. What on the other hand works is the following. Using VBA where QnewPath is the Template File Name:
ThisDrawing.Application.Preferences.Files.QNewTemplateFile = QnewPath
Using LISP:
(vla-put-QNewTemplateFile (vla-Get-Files
  (vla-Get-Preferences (vlax-get-acad-object))) QnewPath)
or using LISP and setenv
(setenv "QnewTemplate" QnewPath)
Here you can see how VBA code can be translated to LISP and the other way around. To get the application object using VBA ThisDrawing.Application is used and in LISP vlax-get-acad-object is used.

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner