6. As shown in the figure, a line segment $AB$ of length 9 is divided into 9 equal parts. The total length of all line segments in the figure is ( ).
A. 132
B. 144
C. 156
D. 165
Analysis: Counting line segments.
There are 9 line segments of length 1, 8 line segments of length 2, 7 line segments of length 3, 6 line segments of length 4, 5 line segments of length 5, 4 line segments of length 6, 3 line segments of length 7, 2 line segments of length 8, and 1 line segment of length 9. The total sum of the lengths of all line segments in the figure is:
$$
1 \times 9 \times 2 + 2 \times 8 \times 2 + 3 \times 7 \times 2 + 4 \times 6 \times 2 + 5 \times 5 = 165 \text{.}
$$