6. As shown in Figure 1, in the acute triangle $\triangle ABC$, the three altitudes $AD$, $BE$, and $CF$ intersect at $H$. Connect $DE$, $EF$, and $FD$. Then the number of triangles in the figure is ( ).
(A) 63
(B) 47
(C) 45
(D) 40
6. (B).

The number of triangles with $A$ as a vertex is 13 (excluding $\triangle A B C$); similarly, the number of triangles with $B, C$ as vertices is also 13 each. In total, there are 39.

In $\triangle D E F$, the number of triangles with $D$ as a vertex is 8 (excluding $\triangle D E F$); similarly, the number of triangles with $E, F$ as vertices is also 8 each. In total, there are 24.

Among them, the number of triangles with $A B$ as a side is 3; the number of triangles with $B C, C D$ as sides is also 3 each, totaling 9. In $\triangle D E F$, the number of triangles with $D E, E F, F D$ as sides is 9. These triangles are counted twice and should be subtracted.
Add $\triangle A B C, \triangle D E F$.
The total number of triangles in the figure is
$$
39+24-9 \times 2+2=47 \text { (triangles). }
$$