Categories

AutoCAD 2015 and AutoCAD LT 2015 Bible

The most comprehensive AutoCAD book around!

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.
  2. 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.
  3. Make sure that Files of type displays the .lsp extension.
  4. Using the LookIn drop-down, you browse to the desired location (folder).
  5. If you want to be able to use step 2 above in future, select the Add to History checkbox.
  6. Select the .lsp file to load in the window.
  7. 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.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 the 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 sanganakskha@gmail.com

Get “Top Customization Tips Every AutoCAD User Should Know” to learn ways to be more productive and become a master at customizing AutoCAD!

Ellen Finkelstein

21 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?

  • Jean-Marie Chedid

    Dear all,
    i have a lisence in autocad 2015 in my company construction and i cant to load command sll(sum layer length).lsp
    can you help me how install or if u have another solution to select lines and have a um lo length in one response.
    thx

  • black gold

    hi jean-

    I’ve had the same problem as you, ever since post autocad 2011. but I’ve finally figured out a way (I’m currently using 2014) and it’s been working for me ever since (knock on wood).

    find your ACAD.LSP file and add the following command line..

    (load “xxx”) – xxx represents the command to run your sll.lsp file.

    and also, make sure you locate the sll.lsp file in the subfolder of the SUPPORT folder called EN-US.
    finally, add that lsp routine to your STARTUP SUITE content.

    hopefully this helps.

  • Pieter

    Make a directory called “start”.
    Create a folder called start.
    Adding your lisp routines in this folder.
    One routine is called acad.lsp.
    Now you open a drawing.
    You type In the command line OPTIONS.
    Go to the tab “Files”.
    Open “Support File Search Path”.
    Click “Add” and browse to the folder called “start”.
    Press “OK”.
    Go to Manage tab>Applications panel>Load Application.
    Select the directory “start”, in this directory select “acad.lsp”, click “Load”.
    In this routine is described which lisp routines must be loaded when you open a drawing.
    The routine is called acad, because when you open an autocad drawing is always first time this denomination.
    Every time when you open a drawing, all lisp routines that in your “acad. lsp”, are loaded.

  • Pieter

    The tekst of my “acad.lsp”

    ; startup programma
    (defun S::startup ()
    (LOAD “Prev_next_drawing”)
    (LOAD “replacetext”)
    (LOAD “STYLE”)
    ;;instellingen tekeningen
    (command “setvar” “GRIDMODE” “0”)
    (command “setvar” “GRIDUNIT” “5,5”)
    (command “setvar” “ERRNO” “0”) ;i.v.m. Lisp -> 0 = no error
    (command “setvar” “FILLMODE” “0”) ;zet aan dat een hatch en dikkere polylijnen worden gevuld
    (command “setvar” “MIRRTEXT” “0”) ;tekst wordt niet gespiegeld
    (command “setvar” “QTEXTMODE” “0”) ;laat tekst zien i.p.v. rechthoek
    ;;(command “setvar” “TEXTSTYLE” “Arial Narrow”)
    (command “setvar” “TEXTSIZE” “2.5”) ;hoogte van tekst
    (command “setvar” “XREFCTL” “0”) ;no log files
    (command “setvar” “SDI” “0”) ;multiple drawings
    (command “setvar” “OSMODE” “6383”) ;1=endp. 2=midp. 4=center 32=intersec.
    (command “setvar” “DONUTID” “0”) ;zet binnenste diameter op 0
    (command “setvar” “MEASUREINIT” “1”) ;=metrisch
    (command “setvar” “MEASUREMENT” “1”) ;metrisch / ISO linetype
    (command “setvar” “SHORTCUTMENU” “11”) ;i.v.m. rechtse muisknop menu
    (command “setvar” “UCSICON” “1”) ;icon display
    (command “setvar” “cmdecho” “1”) ;zet aan dat de lisp commando’s in de commandprompt te zien is
    (command “setvar” “filedia” “1”) ;zet de dialoogvensters aan
    (command “setvar” “lispinit” “0”) ;voor single-document interface
    (command “setvar” “attreq” “1”) ;zet het dialoogvenster voor invullen van values van attributen
    (command “setvar” “PDMODE” “3”) ;bij DIVIDE wordt er een kruisje gezet
    (command “setvar” “isavebak” “1”) ;backup file (.bak) wordt aangemaakt
    (command “setvar” “attdia” “1”) ;dialoog venster voor insert command zal hiermee worden aangezet
    (command “setvar” “cmddia” “1”)
    (command “setvar” “maxactvp” “48”) ;max. views
    (command “regenmode” “1”)
    (command “snap” “ON”)
    (command “ortho” “on”)
    ;;de grootte van de snap instellen
    (setvar ‘SNAPUNIT ‘(0.5 0.5))
    (COMMAND “VIEWRES” “Y” “20000”)
    (command “REGEN”) ;regeneren v/d tekening, fields correct invullen
    (command “ZOOM” “E”) ;de tekening volledig openen bij opstart
    )

  • BBB

    Thanx for your valueable Lisp Codes.

  • KS Raju

    please send me commands after loading lisp programme how to run programme and what are the commands to run programme or how to open csv file in autocad drawing
    regards
    santhi raju

  • zahid

    any friends guid me how to download xyleft applicatin for autocad it is not in our load/ unlod application

  • Yet

    thank you dear editor. it works on the program that i want to load on my autocad 15.

  • Ganesh

    how to ordinate app (Autocad) in my PC

  • RAJENDRA PRASAD JOSHI

    pl how to customise tools.

  • TARIQ

    HELLO DEAR,
    I HAVE AUTOCAD LT 2016. AND COULD YOU PLEASE TELL ME HOW TO UPLOAD LISP FILES IN THAT VERSION. I M TRYING BUT UNABLE TO DO.

  • Curt

    I am running several LISP routines at startup. But when the first drawing is opened I get dialog boxes for each LISP
    routine and I have to press the load button. How do I get the files to run without the dialog boxes?

  • Satish kumar sharma

    Sanjay sir, one my friend calculate and develop cone, frustum etc with autocad. but he did not said any about it that how it is possible. can you explain how he do it?

  • i think this all lisp is very use full

  • shubham

    hello , im using autocad 2006 , the lsp’s programe you have provide is not working in autocad 2006. any solution useful for me ?

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=""> <s> <strike> <strong>