Nick Gilbert
Nick Gilbert

Reputation: 4240

Running a Lisp function on AutoCAD startup

I'm using a Lisp program to load a VBA macro into AutoCAD. The Lisp program below is autoloaded into AutoCAD on startup

(defun C:LoadDVB ()
  (command "vbaload" "WindowsDoors.dvb")
)

However I still have to type "LoadDVB" into AutoCAD's command line to get the plugin to work otherwise it gives me an error. I need to automate this step so that on startup I can just use the VBA plugin.

Upvotes: 2

Views: 1371

Answers (1)

Wes Lord
Wes Lord

Reputation: 457

Basically your autoloader is creating a new command, and that command is what loads your VBA macro.

In this case (defun C:LoadDVB () ...) is defining a function called "LoadDVB" that you can run at the command line. The code inside the function loads your VBA macro... but this code doesn't run until you call the function at the command line.

If you want your autoloader to load your macro directly, take out the function definition. All you need is one line that reads (command "vbaload" "WindowsDoors.dvb").

Upvotes: 1

Related Questions