Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is best way to use the Lisp in AutoCAD?

user-image
Question added by Muhammad Shakeel , CAD Design Manager , M/S zeeruk Intl.
Date Posted: 2015/01/06
Deleted user
by Deleted user

I basically did research on some online tutorials and use the Help function. AutoCAD2008 has a built in visual auto lisp function that makes it even easier to do.

 

Elke Woofter
by Elke Woofter , Project Assistant , American Technical Associates

Custom Programs for AutoCAD ... If the LISP file does not reside in the AutoCAD Support Path, a full file path is needed so that the LISP navigate to the correct file address.

At the AutoCAD command line, type AppLoad (alternatively go to Tools » Load Application).Select the program file as previously saved and click Load to load the program into the current drawing session. Click Close to close the Appload Dialog.

Another way to load an AutoLISP program is to include a load call in the ACADDOC.lsp Everytime a new drawing is opened, AutoCAD will search the Support Paths for any ACADDOC.lsp files, and will proceed to load the first one it discovers.First we must check that an ACADDOC.lsp file exists - to do this type at the AutoCAD command line:If this returns a filepath, navigate to the existing ACADDOC.lsp file and in the steps that follow, amend its contents.If the LISP file does not reside in the AutoCAD Support Path, a full filepath is needed so that the LISP file may be located; in this case, be sure to use double backslashes when specifying the path.When finished, open a new drawing and the LISP files should load.Note: if using this method to load many LISP files on startup is causing drawings to open slower, refer to my tutorial on the use of AutoLoad to demand load LISP files

USAMA YOSSRY AHMED GENDIA
by USAMA YOSSRY AHMED GENDIA , Resident Engineer , ACE ARAB CONSULANT ENGINEER - MOHARM BAKHOOM

Running the lisp routineOnce the lisp file is loaded, you can run the routine from the command line. The routine is run simply by entering its name. In this example, enter zone at the command line. Remember, the routine name is the bit following the c: near the beginning of the code.Tip: You may also load the lisp file by dragging-and-dropping the file icon onto the AutoCAD drawing area

 

Additional Loading Instructions

 

In addition to the above advice, there are a few other filetypes to be aware of when delving into the world of LISP programming.VLX/FAS FilesYou may discover that some programs are posted in the form of either a .VLX or .FAS file. These are programs that have been compiled into one file to make them not only easier to load (with only one file to deal with), but also more secure as far as code protection is concerned.To load a .VLX or .FAS file, just save the file to a known location, and follow the instructions in the above post, as if you were dealing with a LISP file. Of course, the syntax to invoke the function is not readily available, but may be either provided by the program developer, or appear at the command line upon loading the file.

DCL Files

 

 

DCL (Dialog Control Language) gives the user the ability to create dialog boxes with relative ease. These files run in conjunction with LISP files, and may be compiled with the relevant LISP file into a VLX or FAS file.DCL language looks like this:

Code: // Increment Numerical Text Sign Selector adder : dialog { label = "Specify Increment Direction"; : text { label = ""; key = "sel_text"; alignment = centered; } : row { : button { label = "+1"; key = "sel_add"; fixed_width = true; mnemonic = "+"; } : button { label = "-1"; key = "sel_sub"; fixed_width = true; mnemonic = "-"; } } // row ok_only; } // dialog

To run a program that uses a DCL file, save the provided DCL file into your AutoCAD Search Path.The AutoCAD Search Path is normally found:C:\\Program Files\\AutoCAD <version>\\Support\\But additonal Search Path locations may be added by going to:Tools > Options > Files (tab) > Support File Search PathAnd adding a new filepath.The LISP file associated with the DCL file can be loaded and run as normal, using the instructions provided in the above post.

"; error: no function definition: vlax-get-acad-object""; error: no function definition: vlax-ename->vla-object"If you find yourself receiving either of these errors, this is an indication that the Visual LISP ActiveX functions required by some programs have not been loaded on your system.The Visual LISP ActiveX functions can be loaded using the (vl-load-com) function.This function need only be called once per session to ensure the functions are available throughout the drawing session, hence many users will have (vl-load-com) located at the top of their ACADDOC.lsp / ACAD.lsp customisation files so that it may be loaded on startup. For this reason, a developer may not notice the omission of this function in their program.If you are receiving one of the above error messages when running a program, simply add (vl-load-com) on a new-line at the top of the relevant LISP file.

 

 

 

 

 

 

 

Muhammad Shakeel
by Muhammad Shakeel , CAD Design Manager , M/S zeeruk Intl.

Agreed with Elke and Mr. Usama. If we follow the steps mentioned in answers for using Lisp in AutoCAD any Designer and Drafter can make progress more faster, Accurate and minimize the time schedule of work under pressure. 

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.