About Passing Pick Points to AutoCAD Commands (AutoLISP)

Some AutoCAD commands (such as TRIM, EXTEND, and FILLET) require the user to specify a pick point as well as the object itself.

Object and point data can be passed to the command and command-s functions without the use of a PAUSE, but requires you to first store the values as variables. Points can be passed as strings within the command and command-s functions, or can be defined outside the function and passed as variables, as shown in the following example.

The following example code demonstrates one method of passing an entity name and a pick point to the command function.

(command "._circle" "5,5" "2")    ;Draws a circle
(command "._line" "3,5" "7,5" "") ;Draws a line
(setq el (entlast))               ;Gets the last entity 
                                  ;  added to the drawing
(setq pt '(5 7))                  ;Sets the trim point
(command "._trim" el "" pt "")    ;Performs the trim

If AutoCAD is at an idle Command prompt when these statements are called, AutoCAD performs the following actions:

  1. Draws a circle centered at (5,5) with a radius of 2.
  2. Draws a line from (3,5) to (7,5).
  3. Creates a variable el that is the name of the last object added to the database.
  4. Creates a pt variable that is a point on the circle. (This point selects the portion of the circle to be trimmed.)
  5. Performs the TRIM command by selecting the el object (the line) and by selecting the point specified by pt.