Categories

AutoCAD 2013 & AutoCAD LT 2013 Bible

The most comprehensive AutoCAD book around!

AutoCAD 2012 Bible

How to load an AutoLISP program

This is a guest post by Sanjay Kulkarni, an AutoCAD programmer.

This post describes the method to load an AutoLISP program in an open drawing.

Some basic & fundamental information before we move to the procedure

An AutoLISP program runs inside (in the same workspace of) an open drawing. Therefore it is necessary to load the program in each individual drawing you want to use the program in. You can load a program into a drawing at any time.

Once you load the program in a drawing, it remains loaded into that specific drawing until the drawing is closed. This means that you can use the functions in the program multiple times once you load the program.

The flip side is that you can’t unload an AutoLISP program once you load it except by closing the drawing.

If you want to use the same program in multiple drawings, you will need to load the program in each individual drawing even if there exists a drawing in which the program has been already loaded.

Loading an AutoLISP program

Now to the action:

  1. Type appload at the command prompt (In AutoCAD 2012, you can go to Manage tab>Applications panel>Load Application.). This will display the Load/Unload Applications dialog box as shown below.

  1. Click the History List tab at the bottom of the dialog box. In case the program was previously loaded in any drawing with Add to History checked, it will be listed there. Select the desired file in the list and go to step 7. Otherwise, go to step 3.
  2. Make sure that Files of type displays the .lsp extension.
  3. Using the LookIn drop-down, you browse to the desired location (folder).
  4. If you want to be able to use step 2 above in future, select the Add to History checkbox.
  5. Select the .lsp file to load in the window.
  6. Click Load. If the file is successfully loaded, a message to that effect is displayed at the bottom of the dialog box. Also if you have checked Add to History, the names of loaded programs are added to in the History List tab of the window.
  7. Click the Close button to close the dialog box.

You are now ready to use the functions in the loaded files.

Notes:

  • You can select multiple files in the History List or the browser using Shift & Control keys and then click the Load button to load all the selected files simultaneously.
  • You can double-click on an individual file to both select and load it. Then you don’t need to click the Load button.
  • When you double-click on a file in History List with Add to History checked, the file name is added again to the History List. You can remove filenames in the History List by selecting the file and clicking the Remove button.
  • If you load a file multiple times in a drawing, AutoCAD does not generate any error and overwrites the previous version of the loaded file.

For a quicker method of loading a program, see the tip, “Loading AutoLISP programs quickly.” This will also obviate the need to load program in each drawing.

Sanjay Kulkarni is an experienced CAD (AutoCAD, Inventor, SolidEdge, CATIA, NX) programmer and a member of the Autodesk Developer Network. He is fluent in AutoLISP, VBA, and VB.NET. He has written for AugiWORLD and Inside AutoCAD (a monthly magazine that has since gone out of publication). You can contact him at [email protected]

6 comments to How to load an AutoLISP program

  • I always use appload to load a single file. It could be quicker. There’s a way to configure the window “Load/unload application” to close after a double-click in a autolisp file?

  • Sanjay Kulkarni

    nilsonrdg,

    Thank you for your response.

    Yes, using upload can be quicker. Butit’s a matter of choice. As usual, there are multiple ways to do things in AutoCAD and you can choose whichever way that suits you.

    I do not think there is way to close “Load/unload application” dialog box after a double-click on an Autolisp file.

    This is logical since you may want to load multiple files and it would be very irritating if every time the window closes and you have to re-open it to load the next program immediately.

    I have not explored, but this could possibly be done using a VisualLisp reactor.

    Sorry for the delay in responding.

  • jd

    well i always did this like a million times but nothings appear. what to do?..it’s said that it successfully load but nothing happens.. . I already follow the procedure the appload thingy but nothings happen how will you see the structure of the drawing //

  • Matt

    Hi

    I am trying to use the Appload command in AutoCAD 2013 LT…does it work on LT version? and if so how can I load it please

  • Matt, AutoCAD LT doesn’t support programming.

  • Matt

    Thank you, I believe that there is an add on package that I can buy? which will allow this? if so would I need one per Cad user?

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>