(Defun C:CTC ()
(Setvar "Cmdecho" 0)
(Setq BLIP (Getvar "Blipmode"))
(Setq R3 (Getreal "\nEnter arc radius: "))
(Setq C1 (Osnap (Setq E1 (Osnap (Getpoint
"\nTouch 1st circle: ")"Nea"))"Cen"))
(Setq C2 (Osnap (Setq E2 (Osnap (Getpoint
"\nTouch 2nd circle: ")"Nea"))"Cen"))
(Setq CC (Distance C1 C2))
(Setq EE (Distance E1 E2))
(Setq A1 (Angle C1 C2))
(Setq R1 (Distance C1 E1))
(Setq R2 (Distance C2 E2))
(Setq Q (- CC (+ R1 R2)))
(If (< R3 Q)(Progn
(Prompt "\nFillet radius must be at least ")
(Princ Q)(Setq R3 (Getreal ", new radius: "))))
(Setq X (if (> EE CC) (- R3 R1) (+ R3 R1)))
(Setq Y (IF (< EE CC) (+ R3 R2) (- R3 R2)))
(Setq COSA (/ (- (+ (* X X)(* CC CC))
(* Y Y))(* 2 X CC)))
(Setq B (* COSA X))
(Setq Z (- CC B))
(Setq B1 (Abs Z))
(Setq A (Sqrt (- (* X X) (* B B))))
(Setq A2 (Abs (Atan (/ A B))))
(Setq A3 (Atan (/ A B1)))
(Setq A4 (If (< EE CC)(+ A1 A2)
(If (> Z 0)(+ A1 Pi A3)(- A1 A3))))
(Command "Arc" "C" (If (< EE CC)
(Polar C1 A4 X)(Polar C2 A4 Y))
(If (< EE CC)(Polar C1 A4 R1)
(Polar C2 (+ A4 Pi) R2))(If (< EE CC) C2 C1))
(Setvar "Blipmode" BLIP))
