;| MSLOT, short for Milled SLOT 
   Copyright © 1998 Ronald W. Leigh 
   Requests width and two center points. 
   Draws a polyline with two straight and two arc segments. 
Variables: 
a/b    Centers 
a1/a2  Endpoints of arc around a 
b1/b2  Endpoints of arc around b 
ang    Angle of slot centerline 
obm    Old blipmode setting, 0 or 1 
r      Radius of arcs 
w      Width of slot                                  |; 

(defun c:mslot (/ a a1 a2 ang b b1 b2 obm r w)   ;line  1 Defines run command makes the vars used local
(setq obm (getvar "blipmode"))                   ;line  2 Saves blipmode setting (prog turns it on-1/off-0)
(initget 7)                                      ;line  3 initializes getreal fn (7 means positive entry) 
(setq w (getreal "\nWidth of slot: "))           ;line  4 \n forces the prompt to appear on new line
(setq r (/ w 2))                                 ;line  5 note prefix notation. / is divide (cf local var)
(setvar "blipmode" 1)                            ;line  6 blipmode sys var turned on 
(initget 1)                                      ;line  7 initializes getreal fn (1 requires pt indicated)
(setq a (getpoint "\nLocate first center: "))    ;line  8 three coords assigned to variable a
(initget 1)                                      ;line  9 cf 7 
(setq b (getpoint a "\nLocate second center: ")) ;line 10 cf 8 but getpoint fn arg a causes rubber band   
(setvar "blipmode" 0)                            ;line 11 blipmode sys var turned off
(setq ang (angle a b))                           ;line 12 angle (rads) of a-b wrt pos x ray assigned to ang
(setq a1 (polar a (- ang (/ pi 2)) r))           ;line 13 al by polar. From a, mag r at ang(rad)-90deg(rad)
(setq a2 (polar a (+ ang (/ pi 2)) r))           ;line 14 cf 13 but 90deg(rad) added to ang(rad)
(setq b1 (polar b (- ang (/ pi 2)) r))           ;line 15 cf 13
(setq b2 (polar b (+ ang (/ pi 2)) r))           ;line 16 cf 14
(setvar "cmdecho" 0)                             ;line 17 echoing the PLINE prompts to screen turned off
(command ".pline" a1 b1 "A" b2 "L" a2 "A" "CL")  ;line 18 arguments submitted to ACad command interpreter
                                                 ;        .pline redefines pline if someone undefined it
(setvar "cmdecho" 1)                             ;line 19 turn screen echo back on
(setvar "blipmode" obm)                          ;line 20 resets the (o)rig (b)li(p)mode setting
(princ)                                          ;line 21 line 20 causes 0 or 1 to echo but princ fn echoes
                                                 ;        nothing providing a "clean exit" for the program. 
)                                                ;line 22 closes the first line opening bracket

    Source: geocities.com/wpsmoke/acadlispvba

               ( geocities.com/wpsmoke)