Skip to content

For setting up AutoCAD Start Up macro

Using Project DVB Files

  • You can store your autocad vba projects in DVB files
  • Now If you want to use this macro on any drawing you have to manually load this dvb file everytime you open autocad
  • But you can set it up to run it automatically
  • First type APPLOAD command , it will open new windowd, on that windows there's group called startup suite, click on contents button there which will let you add dvb files for automatically load at startup

image

Using AutoLisp File

Upon opening a drawing or starting a new drawing, AutoCAD will search all listed support paths including the working directory for a file with the filename: ACADDOC.lsp. If one or more such files are found, AutoCAD will proceed to load the first file found.

With this knowledge one can edit or create an ACADDOC.lsp to include any AutoLISP expressions to be evaluated upon startup.

Things get a little complicated should there exist more than one ACADDOC.lsp file, so, to check if such a file already exists, type or copy the following line to the AutoCAD command line: (findfile "ACADDOC.lsp") Should a filepath be returned, in the steps that follow, navigate to this file and amend its contents. Else, if the above line returns nil, you can create your own ACADDOC.lsp in Notepad or the VLIDE and save it in an AutoCAD Support Path. One clear advantage to using the ACADDOC.lsp to automatically load programs is that, upon migration, it may easily be copied from computer to computer, or indeed reside on a network to load programs on many computers simultaneously.

Code to Assign Command for Project.dvb in AutoCAD Support Folder

(defun c:Test() (command "vbarun" "Blocks.ExplodeBlocks"))

Code to Automatically Load project.dvb file at AutoCAD Startup

(defun s::startup()(command "-vbaload" "C:\Users\Ryzen2600x\source\repos\Upwork_Marco_ExplodeBlocks\Project.dvb"))

image

image

References