(defun C:CCR()
   (if (<= R 0)
      (progn
         (setq c (> R2 R1))
         (if (or (and a (null b)) (and (null a) b))
            (setq AA (atan (/ 1 (sqrt (1- (/ (* L L)
                       (* (+ R1 R2) (+ R1 R2)))))))
            )
            (if (= R1 R2)
               (setq AA 0)
               (setq AA (atan (/ 1 (sqrt (1- (/ (* L L)
                          (* (- R1 R2) (- R1 R2)))))))
               )
            )
         )
         (if (or (and a (null c)) (and (null b) c))
            (setq AA (- 0 AA))
         )
         (if A
            (setq E1 (polar C1 (+ A0 (* 0.5 pi) AA) R1))
            (setq E1 (polar C1 (+ A0 (* -0.5 pi) AA) R1))
         )
         (if (null b)
            (setq E2 (polar C2 (+ A0 (* -0.5 pi) AA) R2))
            (setq E2 (polar C2 (+ A0 (* 0.5 pi) AA) R2))
         )
         (command "erase" P1 P2 "")
         (if (= En1 "ARC")
            (progn
               (setq A3 (cdr (assoc 50 l1))
                     A4 (cdr (assoc 51 l1))
                     R1 (abs R1)
               )
               (if A
                  (command "arc" E1 "c" C1 (polar C1 A4 R1))
                  (command "arc" (polar C1 A3 R1) "c" C1 E1)
               )
            )
            (if A
               (command "arc" E1 "c" C1 "a" 180)
               (command "arc" E1 "c" C1 "a" -180)
            )
         )
         (command "line" E1 E2 "")
         (if (= En2 "ARC")
            (progn
               (setq A3 (cdr (assoc 50 l2))
                     A4 (cdr (assoc 51 l2))
                     R2 (abs R2)
               )
               (if (null b)
                  (command "arc" E2 "c" C2 (polar C2 A4 R2))
                  (command "arc" (polar C2 A3 R2) "c" C2 E2)
               )
            )
            (if (null b)
               (command "arc" E2 "c" C2 "a" 180)
               (command "arc" E2 "c" C2 "a" -180)
            )
         )
      )
      (progn
         (setq c (and (> 0 (cos A1)) (< 0 (cos A2)))
               d (> R1 (distance C1 P2))
               e (> R2 (distance C2 P1))
               f (> L (+ R1 R2))
               h (< L (abs (- R1 R2)))
               g (and (null f) (null h))
               i (< R1 R2)
         )
         (if (or (and (null c) (null d) g) (and a (null b) f)
                 (and (null b) (null c) f) (and a (null c) f)
                 (and h i (null a) (null b))
                 (and h i a b)
             )
            nil (setq R1 (- 0 R1))
         )
         (if (or (and (null c) (null e) g) (and (null a) b f)
                 (and (null a) (null c) f) (and b (null c) f)
                 (and h (null i) (null a) (null b))
                 (and h (null i) a b)
             )
            nil (setq R2 (- 0 R2))
         )
         (setq X (/ (- (+ (* R1 R1) (* L L) (* 2. R (- R1 R2)))
                       (* R2 R2)) 2. L)
         )
         (if (or (and (null a) (null c) g) (and a c g) (and f a b c)
                 (and f (null a) (null b) (null c))
                 (and h i (null b)) (and h (null i) (null a))
             )
             (setq Y (- 0 (sqrt (* (+ R1 R X) (- (+ R1 R) X)))))
             (setq Y (sqrt (* (+ R1 R X) (- (+ R1 R) X))))
         )
         (setq A3 (+ (atan Y X) A0)
               Len (ABS (+ R1 R))
               C3 (polar C1 A3 Len)
         )
         (if (or (and c g) (and (null d) g) f (and h i))
            (setq A3 (angle C3 C1)) (setq A3 (angle C1 C3))
         )
         (if (or (and c g) (and (null e) g) f (and h (null i)))
            (setq A4 (angle C3 C2)) (setq A4 (angle C2 C3))
         )
         (if (and h i) (setq A4 (angle C2 C3)))
         (setq E1 (polar C3 A3 R)
               E2 (polar C3 A4 R)
         )
         (command "erase" P1 P2 "")
         (setq j (or (and g (null c) (null d)) (and g a c)
                     (and f a (null c)) (and f (null b) (null c))
                     (and a (null b) f) (and h i (null a) (null b))
                     (and h i a b)
                 )
               k (or (and g (null c) e) (and g (null a) c) (and h i)
                     (and f a (null b)) (and f a c) (and f (null b) c)
                     (and h (null i) a (null b)) (and h (null i) (null a) b)
                 )
         )
         (if (= En1 "ARC")
            (progn
               (setq A3 (cdr (assoc 50 l1))
                     A4 (cdr (assoc 51 l1))
                     R1 (abs R1)
               )
               (if j
                  (command "arc" E1 "c" C1 (polar C1 A4 R1))
                  (command "arc" (polar C1 A3 R1) "c" C1 E1)
               )
            )
            (if j
               (command "arc" E1 "c" C1 "a" 180)
               (command "arc" E1 "c" C1 "a" -180)
            )
         )
         (if (= En2 "ARC")
            (progn
               (setq A3 (cdr (assoc 50 l2))
                     A4 (cdr (assoc 51 l2))
                     R2 (abs R2)
               )
               (if k
                  (command "arc" E2 "c" C2 (polar C2 A4 R2))
                  (command "arc" (polar C2 A3 R2) "c" C2 E2)
               )
            )
            (if k
               (command "arc" E2 "c" C2 "a" 180)
               (command "arc" E2 "c" C2 "a" -180)
            )
         )
         (command "arc" E1 "c" C3 E2)
      )
   )
   (setvar "menuecho" 0)
   (setvar "cmdecho" 1)
)
