SetDirectory["FileName" /. NotebookInformation[
              EvaluationNotebook[]] /. FrontEnd`FileName[
              d_List, nam_, ___] :> ToFileName[d]];

Off[General::"spell1"];

f1[a_, b_, c_] := 
        Module[{x = (a/c), y = (b/c)}, 
          (2. /(Pi*x*y))*(Log[(Sqrt[(((1 + (x^2))*(1 + (y^2)))/(1 + (x^2) + (y^2)))])] + x*(Sqrt[1 + (y^2)])*ArcTan[(x/(Sqrt[1 + (y^2)]))] + 
                y*(Sqrt[1 + (x^2)])*ArcTan[(y/(Sqrt[1 + (x^2)]))] - x*ArcTan[x] - 
                y*ArcTan[y])];
f2[h_, w_, l_] := 
        Module[{H = (h/l), W = (w/l), w2, h2}, w2 = (W^2); h2 = (H^2); 
          (1. /(W*Pi))*(W*ArcTan[(W^(-1))] + 
                H*ArcTan[(H^(-1))] - (Sqrt[h2 + w2])*
                  ArcTan[(1/(Sqrt[h2 + w2]))] + (1/4) 
                  Log[(((1 + w2)*(1 + h2))/(1 + w2 + h2))*(((((w2*(1 + w2 + h2))/((1 + w2)*(w2 + h2)))))^w2)*(((((h2*(1 + w2 + h2))/((1 + h2)*(w2 + h2)))))^h2)])];

f3[c_, b_, a_] := 
        Module[{b1 = ((((c/(2  a))))^2), b2 = ((((b/(2  a))))^2)}, 
          (1. /(2  Pi))*(ArcSin[((2  b1 - (1 - b1)*(b1 + b2))/((1 + b1)*(b1 + b2)))] + 
                ArcSin[((2  b2 - (1 - b2)*(b1 + b2))/((1 + b2)*(b1 + b2)))])];
f4[c_, b_, a_, 
          dk_] := ((f3[c, b, a]*Pi*(dk^2))/(c*b));

plochy = {{a, c}, {b, c}, {a, b}, {a, b}, {b, c}, {a, 
            c}, {dk}};
ClearAll[fact];
fact[i_Integer, j_Integer] := 
        Module[{a1, b1, c1, plocha = plochy[[i]]}, 
            c1 = Complement[{a, b, c}, plocha][[1]]; 
            a1 = plocha[[1]]; b1 = plocha[[2]]; f1[a1, b1, c1]] /; 
          i + j == 7;
fact[i_Integer, j_Integer] := 
        0 /; (i == j);
fact[i_Integer, j_Integer] := 
        Module[{a1, b1, c1, plocha = plochy[[j]]}, b1 = plocha[[1]]; 
            c1 = plocha[[2]]; 
            a1 = Complement[{a, b, c}, plocha][[1]]; 
            f3[c1, b1, (1/2) a1]] /; (i == 7 && 
              j ≠ 7);
fact[i_Integer, j_Integer] := 
        Module[{a1, b1, c1, d1 = plochy[[j, 1]], 
              plocha = plochy[[i]]}, b1 = plocha[[1]]; 
            c1 = plocha[[2]]; 
            a1 = Complement[{a, b, c}, plocha][[1]]; 
            f4[c1, b1, (1/2) a1, d1]] /; (j == 7 && 
              i ≠ 7);
fact[i_Integer, j_Integer] := 
        Module[{h1, w1, l1, pli = plochy[[i]], plj = plochy[[j]]}, 
            l1 = Intersection[pli, plj][[1]]; 
            w1 = Complement[pli, {l1}][[1]]; 
            h1 = Complement[plj, {l1}][[1]]; 
            f2[h1, w1, l1]] /; (i + j ≠ 7 && i ≠ 7 && 
              j ≠ 7);