Subject: Using LISP routines



CADdirect supports the LISP programming language and is compatible with AutoLISP, the implementation of the LISP language in AutoCAD. This means that you can load and run any AutoLISP program written for use with AutoCAD.

To load a LISP routine

Advanced experience level

   1   Do one of the following:

   On the ribbon, choose Tools > Load Application (in Applications).

   On the menu, choose Tools > Load Application.

   Type appload and then press Enter.

   Drag and drop the LISP file into CADdirect.

   2   In the Load Application Files dialog box, click Add File.

   3   Select the LISP file that you want to load, and then click Open.

Click OK.  Load LISP routines from the command bar.
In the command bar, type (load “d:/path/routine.lsp”), making sure to include the parentheses and the quotation marks, where d:/path is the drive and path where the LISP routine is located on your computer, and routine.lsp is the LISP routine file name.

To run a LISP routine

Advanced experience level

   1   Do one of the following:

   On the ribbon, choose Tools > Load Application (in Applications).

   On the menu, choose Tools > Load Application.

   Type appload and then press Enter.

   2   In the Load Application Files dialog box, choose the routine you want to run (make sure that it is the only one selected), and then click Load.

Some LISP routines are created in such a way that you can run them by simply typing the name of the routine, or by typing a keyword, directly in the command bar. If noth­ing happens when you attempt to run the LISP routine from within the Load Applica­tion Files dialog box, turn on the display of the command bar or Prompt History window by choosing View > Display > Command Bar or View > Display > Prompt History Window, and look for an entry that is similar to the following:

Loading D:\path\routine.lsp

C:KEYWORD

where D:\path\routine.lsp is the complete drive, path, and file name of the LISP rou­tine. You may need to scroll back several lines in the command bar or Prompt History window to find the lines indicating where the LISP routine was loaded. You can run the LISP routine by typing the name of the routine or keyword appearing after the C drive designation.

For example, if you loaded a LISP routine named drawbox.lsp and see the designa­tion C:DRAWBOX in the command bar or Prompt History window, you can run the LISP routine by typing drawbox in the command bar.  

To automatically load a LISP routine when CADdirect starts

   1   Create an ASCII file that contains the path to a LISP routine on each line of the file. Example file content:

(load "C:\\Users\\Documents\\username\\lisp routines\\areap.lsp")

   2   Save the file with one of the following names:

   ICAD.LSP — Automatically loads the referenced LISP routines when Intel­liCAD starts.

   ICADDOC.LSP — Automatically loads the referenced LISP routines when creating or opening drawings.

   3   Place the .lsp file in the same folder as icad.exe.

   4   Run CADdirect.

Use a system variable.
To make all drawings share the same LISP environment (variables, functions, etc.), set the LISPINIT system variable to 2.

Using_LISP_routines
© Copyright 2022. BackToCAD Technologies LLC. All rights reserved. Kazmierczak® is a registered trademark of Kazmierczak Software GmbH. Print2CAD, CADdirect, CAD.direct, CAD Direct, CAD.bot, CAD Bot, are Trademarks of BackToCAD Technologies LLC. DWG is the name of Autodesk’s proprietary file format and technology used in AutoCAD® software and related products. Autodesk, the Autodesk logo, AutoCAD, DWG are registered trademarks or trademarks of Autodesk, Inc. All other brand names, product names, or trademarks belong to their respective holders. This website is independent of Autodesk, Inc., and is not authorized by, endorsed by, sponsored by, affiliated with, or otherwise approved by Autodesk, Inc. The material and software have been placed on this Internet site under the authority of the copyright owner for the sole purpose of viewing of the materials by users of this site. Users, press or journalists are not authorized to reproduce any of the materials in any form or by any means, electronic or mechanical, including data storage and retrieval systems, recording, printing or photocopying.