60 lines
1.4 KiB
Python
60 lines
1.4 KiB
Python
|
|
# 生成桩号
|
||
|
|
|
||
|
|
import re
|
||
|
|
import color
|
||
|
|
|
||
|
|
line_gap = int(param("line_gap"))
|
||
|
|
curve_gap = int(param("curve_gap"))
|
||
|
|
|
||
|
|
with sheet("alignment_table"):
|
||
|
|
if cell(3, 2).empty():
|
||
|
|
print(f"{color.red}错误{color.nc}:缺少数据")
|
||
|
|
start = cell(3, 3).value
|
||
|
|
j = 4
|
||
|
|
while not cell(j, 3).empty():
|
||
|
|
j += 1
|
||
|
|
end = cell(j - 1, 3).value
|
||
|
|
|
||
|
|
align_table = [0] * 5
|
||
|
|
list_label = ["ZH", "HY", "QZ", "YH", "HZ", ""]
|
||
|
|
list_stake = []
|
||
|
|
pos = start - (start % line_gap)
|
||
|
|
with sheet("alignment_table"):
|
||
|
|
row = 5
|
||
|
|
while not cell(row, 13).empty():
|
||
|
|
for k in range(13, 18):
|
||
|
|
align_table[k - 13] = cell(row, k).value
|
||
|
|
|
||
|
|
while pos + line_gap < align_table[0]:
|
||
|
|
pos += line_gap
|
||
|
|
list_stake.append([row, pos, 5])
|
||
|
|
|
||
|
|
pos = align_table[0] - (align_table[0] % curve_gap)
|
||
|
|
while pos + curve_gap < align_table[4]:
|
||
|
|
pos += curve_gap
|
||
|
|
list_stake.append([row, pos, 5])
|
||
|
|
pos = align_table[4] - (align_table[4] % line_gap)
|
||
|
|
|
||
|
|
for k in range(5):
|
||
|
|
list_stake.append([row, align_table[k], k])
|
||
|
|
|
||
|
|
row += 1
|
||
|
|
|
||
|
|
while pos + line_gap < end:
|
||
|
|
pos += line_gap
|
||
|
|
list_stake.append([row, pos, 5])
|
||
|
|
|
||
|
|
list_stake.append([row, end, 5])
|
||
|
|
|
||
|
|
with sheet("coord_calc") as sheet_coord:
|
||
|
|
for row in range(2, sheet_coord.row):
|
||
|
|
for col in range(6):
|
||
|
|
cell(row, col).clear()
|
||
|
|
list_stake.sort()
|
||
|
|
for row, stake in enumerate(list_stake):
|
||
|
|
row += 2
|
||
|
|
cell(row, 0).text = list_label[stake[2]]
|
||
|
|
cell(row, 1).value = stake[1]
|
||
|
|
|
||
|
|
sheet_coord.fit_content()
|