Lengths of lines in a Hexagonal Grid on an A4 page

d = 1 (slider from 0 to 5, step 0.01)
m = 3 (slider from 1 to 40, step 1)
list1 = Sequence((i * d * sqrt(3) / 2, 1 / 2 * d * (1 + (-1)^(i)) / 2), i, 0, 2 * m)
n = 6 (slider from 1 to 40, step 1)
list3 = Sequence(Sequence[PolyLine[(i * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(i)) / 2 + 3 * d * j / 2), (i * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(i)) / 2 + 3 * d * j / 2 + d)], i, 0, 2 * m, 2], j, 0, n - 1)
list4 = Sequence(Sequence[PolyLine[(i * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(i)) / 2 + 3 * d * j / 2), ((i + 1) * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(i + 1)) / 2 + 3 * d * j / 2)], i, -1, -1], j, 1, n, 2)
list5 = Sequence(PolyLine[(d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d + 3 * d * j / 2), (d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 3 * d * j / 2)], j, 0, n - 1, 2)
list6 = Sequence(PolyLine[(d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 2 * d + 3 * d * j / 2), (d * sqrt(3) + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 3 * d / 2 + 3 * d * j / 2)], j, 0, n - 1, 2)
list2 = Sequence(Sequence[PolyLine[(i * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(i)) / 2 + 3 * d * j / 2), ((i + 1) * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(i + 1)) / 2 + 3 * d * j / 2)], i, 1, 2 * m - 2], j, 0, n)
list7 = Sequence(PolyLine[((2 * m - 1) * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(2 * m - 1)) / 2 + 3 * d * j / 2), (2 * m * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(2 * m)) / 2 + 3 * d * j / 2)], j, 0, n, 2)
list8 = Sequence(PolyLine[((2 * m - 1) * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(2 * m - 1)) / 2 + 3 * d * j / 2), (2 * m * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(2 * m)) / 2 + 3 * d * j / 2)], j, 1, n - 1, 2)
list9 = Sequence(PolyLine[((2 * m - 1) * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(2 * m)) / 2 + 3 * d * (j + 1) / 2), (2 * m * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(2 * m + 1)) / 2 + 3 * d * (j + 1) / 2)], j, 1, n - 1, 2)
pSum2 = Sequence(Sum[Sequence[PolyLine[(i * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(i)) / 2 + 3 * d * j / 2), ((i + 1) * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(i + 1)) / 2 + 3 * d * j / 2)], i, 1, 2 * m - 2]], j, 0, n)
pSum3 = Sequence(Sum[Sequence[PolyLine[(i * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(i)) / 2 + 3 * d * j / 2), (i * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(i)) / 2 + 3 * d * j / 2 + d)], i, 0, 2 * m, 2]], j, 0, n - 1)
pSum4 = Sequence(Sum[Sequence[PolyLine[(i * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(i)) / 2 + 3 * d * j / 2), ((i + 1) * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(i + 1)) / 2 + 3 * d * j / 2)], i, -1, -1]], j, 1, n, 2)
Sum5 = Sum(Sequence[PolyLine[(d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d + 3 * d * j / 2), (d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 3 * d * j / 2)], j, 0, n - 1, 2])
Sum6 = Sum(Sequence[PolyLine[(d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 2 * d + 3 * d * j / 2), (d * sqrt(3) + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 3 * d / 2 + 3 * d * j / 2)], j, 0, n - 1, 2])
Sum7 = Sum(Sequence[PolyLine[((2 * m - 1) * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(2 * m - 1)) / 2 + 3 * d * j / 2), (2 * m * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(2 * m)) / 2 + 3 * d * j / 2)], j, 0, n, 2])
Sum8 = Sum(Sequence[PolyLine[((2 * m - 1) * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(2 * m - 1)) / 2 + 3 * d * j / 2), (2 * m * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(2 * m)) / 2 + 3 * d * j / 2)], j, 1, n - 1, 2])
Sum9 = Sum(Sequence[PolyLine[((2 * m - 1) * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(2 * m)) / 2 + 3 * d * (j + 1) / 2), (2 * m * d * sqrt(3) / 2 + d * sqrt(3) / 2 * (1 - (-1)^(j)) / 2, 1 / 2 * d * (1 + (-1)^(2 * m + 1)) / 2 + 3 * d * (j + 1) / 2)], j, 1, n - 1, 2])
Sum2 = Sum(pSum2)
Sum3 = Sum(pSum3)
Sum4 = Sum(pSum4)
TotalLineLength: Sum2 + Sum3 + Sum4 + Sum5 + Sum6 + Sum7 + Sum8 + Sum9
A = Intersect(a, e)
B = Intersect(e, b)
C = Intersect(c, b)
D = Intersect(c, a)
poly1, a_1, b_1, c_1, d_1 = Polygon(A, B, C, D)
text1: "Length of Lines = " + TotalLineLength + ""