To Run Selected Lines of AutoLISP Code in the Visual LISP IDE (Visual LISP IDE)

From Visual LISP, you can execute specific lines of AutoLISP code in a program.

Note: The Visual LISP IDE is available on Windows only.
  1. Open an AutoLISP (LSP) file and highlight the lines of code to run.
  2. Do one of the following:
    • From the menu bar, click Tools Load Selection.
    • On the Tools toolbar, click the Load Selection.

    Visual LISP immediately executes the code and switches control to AutoCAD.

Example

This example requires the installation of the Visual LISP Sample files.

  1. In Visual LISP, click File Open File.
  2. In the Open File dialog box, browse to the Sample\VisualLISP folder, which is located in your AutoCAD installation directory.
  3. Double-click the drawline.lsp file.
  4. Highlight the following lines of code:
    (setq pt1(getpoint "\nEnter the start point for the line: ")
          pt2(getpoint pt1 "\nEnter the end point for the line: "))
  5. On the Tools toolbar, click Load Selection.

    Visual LISP immediately runs the code and switches control to AutoCAD to prompt you for input.