(defun Lp (E1 E2 C1 / Pm X Y B)
;(IF (= (TYPE F1) 'FILE ) "YES"  (STOP))
;(IF (= (TYPE F2) 'FILE ) "YES" (STOP))
   (if (> 0.001 (abs (- (car E2) (car E1))))
      (setq X (car E1) Y (cadr C1))
      (setq M (/ (- (cadr E2) (cadr E1)) (- (car E2) (car E1)))
            B (- (cadr E1) (* M (car E1)))
            X (/ (- (+ (* M (cadr C1)) (car C1)) (* M B)) (+ 1. (* M M)))
            Y (+ (* M X) B)
      )
   )
   (setq Pm (list X Y))
)
(defun C:CCC()
   (setq S1 (entsel "\nObject 1:")
         S2 (entsel "\nObject 2:")
         S3 (entsel "\nObject 3:")
         l1 (entget (car S1))
         l2 (entget (car S2))
         l3 (entget (car S3))
         P1 (cadr S1)
         P2 (cadr S2)
         P3 (cadr S3)
         En1 (cdr (assoc 0 l1))
         En2 (cdr (assoc 0 l2))
         En3 (cdr (assoc 0 l3))
   )
   (command "color" 8 "circle" "3p" "tan" P1 "tan" P2 "tan" P3)
   (setq ss (entget (entlast))
         Pc (cdr (assoc 10 ss))
          R (cdr (assoc 40 ss))
   )
   (command "erase" (ssget "l") "" "color" "bylayer")
   (if (= En1 "LINE")
      (progn
         (setq P11 (lp (cdr (assoc 10 l1)) (cdr (assoc 11 l1)) Pc))
         (command "break" P1 "f" P11 "@")
      )
      (progn
         (setq C1 (cdr (assoc 10 l1))
               P11 (polar Pc (angle Pc C1) R)
         )
         (if (= En1 "CIRCLE")
            (command "erase" P1 ""
                     "arc" P11 "c" C1 "a" 180
                     "arc" "" P11
            )
            (command "break" P1 "f" P11 "@")
         )
      )
   )
   (if (= En2 "LINE")
      (progn
         (setq P22 (lp (cdr (assoc 10 l2)) (cdr (assoc 11 l2)) Pc))
         (command "break" P2 "f" P22 "@")
      )
      (progn
         (setq C2 (cdr (assoc 10 l2))
               P22 (polar Pc (angle Pc C2) R)
         )
         (if (= En2 "CIRCLE")
            (command "erase" P2 ""
                     "arc" P22 "c" C2 "a" 180
                     "arc" "" P22
            )
            (command "break" P2 "f" P22 "@")
         )
      )
   )
   (if (= En3 "LINE")
      (progn
         (setq P33 (lp (cdr (assoc 10 l3)) (cdr (assoc 11 l3)) Pc))
         (command "break" P3 "f" P33 "@")
      )
      (progn
         (setq C3 (cdr (assoc 10 l3))
               P33 (polar Pc (angle Pc C3) R)
         )
         (if (= En3 "CIRCLE")
            (command "erase" P3 ""
                     "arc" P33 "c" C3 "a" 180
                     "arc" "" P33
            )
            (command "break" P3 "f" P33 "@")
         )
      )
   )
   (command "arc" P11 "c" Pc P22 "arc" "" P33 "arc" "" P11)
)
