Completing a Word Automatically

AutoCAD Visual LISP

 
Completing a Word Automatically
 
 
 

Imagine you are adding some new functionality to your program using the following code:

ObjectCreationStyle (strcase (cdr (assoc 3 BoundaryData)))
(if (equal ObjectCreationStyle  "COMMAND")
 (progn
  (setq firstCenterPt(polar rowCenterPt (Degrees->Radians 45) distanceOnPath))
    (gp:Create_activeX_Circle)
  )
)

(Don't worry about what this code actually does, if anything. It is only an example that includes several long variable and function names.)

VLISP can save you some keystrokes by completing words for you.

To use the Visual LISP Complete Word by Match feature

  1. Scroll to the bottom of the gpdraw.lsp file and enter the following code:
    ObjectCreationStyle (strcase (cdr (assoc 3 BoundaryData)))
       (if (equal Ob
  2. Press CTRL + SPACEBAR.

    VLISP just saved you seventeen keystrokes as it searched within the current file and found the closest match to the last two letters you typed.

  3. Complete the line of code so that it looks like the following:
    (if (equal ObjectCreationStyle  "COMMAND")
  4. Add the following lines:
     (progn
      (setq firstCenterPt(p
  5. Press CTRL + SPACEBAR.

    VLISP matches the most recent “p” word, which happens to be progn. However, the word you need is polar. If you keep pressing CTRL + SPACEBAR, VLISP cycles through all the possible matches in your code. Eventually, it will come around to polar.

  6. Delete all the code you just entered; it was for demonstration purposes only.

    The Complete Word by Match feature is also available from the VLISP Search menu.