Files
Aislo/resources/tester/scratch/fix_ch13_all_spec_tables.py
T

90 lines
6.3 KiB
Python

import os, sys, re
sys.stdout.reconfigure(encoding='utf-8')
ch13_path = "resources/knowledge/original/원가계산/건설공사_표준품셈/04_기계설비부문/제13장_플랜트설비공사.md"
with open(ch13_path, 'r', encoding='utf-8') as f:
text = f.read()
# 1. L36: 배관용 탄소강관 KS D3507 (350 ~ 500)
old_l36 = "| 배 관 용 탄 소 강 관 KS D3507 | 350 〃 〃 400 〃 〃 450 〃 〃 500 〃 〃 〃 〃 | 355.6 〃 〃 406.4 〃 〃 457.2 〃 〃 508.0 〃 〃 〃 〃 | 6.0 6.4 7.9 6.0 6.4 7.9 6.0 6.4 7.9 6.0 6.4 7.9 8.7 9.5 | 51.7 55.1 67.7 59.2 63.1 77.6 66.8 71.1 87.5 74.3 79.2 97.4 107 117 | 19.3 18.7 16.8 19.5 19.5 16.7 19.4 19.5 16.7 19.5 19.4 16.6 16.2 13.3 | 9.7 9.3 8.4 9.3 8.4 8.4 9.3 8.3 8.3 9.2 8.3 8.3 7.6 9.5 | 9.7 9.3 8.4 9.3 8.4 8.4 9.3 8.3 8.3 9.2 8.3 8.3 7.6 9.5 | 19.3 18.7 16.8 19.5 19.5 16.7 19.4 19.5 16.7 19.5 19.4 16.6 16.2 13.3 |"
s36 = "350 〃 〃 400 〃 〃 450 〃 〃 500 〃 〃 〃 〃".split()
o36 = "355.6 〃 〃 406.4 〃 〃 457.2 〃 〃 508.0 〃 〃 〃 〃".split()
t36 = "6.0 6.4 7.9 6.0 6.4 7.9 6.0 6.4 7.9 6.0 6.4 7.9 8.7 9.5".split()
w36 = "51.7 55.1 67.7 59.2 63.1 77.6 66.8 71.1 87.5 74.3 79.2 97.4 107 117".split()
yw36 = "19.3 18.7 16.8 19.5 19.5 16.7 19.4 19.5 16.7 19.5 19.4 16.6 16.2 13.3".split()
yb36 = "9.7 9.3 8.4 9.3 8.4 8.4 9.3 8.3 8.3 9.2 8.3 8.3 7.6 9.5".split()
yi36 = "9.7 9.3 8.4 9.3 8.4 8.4 9.3 8.3 8.3 9.2 8.3 8.3 7.6 9.5".split()
nb36 = "19.3 18.7 16.8 19.5 19.5 16.7 19.4 19.5 16.7 19.5 19.4 16.6 16.2 13.3".split()
rows_36 = []
for i in range(len(s36)):
div_name = "배관용 탄소강관 KS D3507" if i == 0 else ""
row = f"| {div_name} | {s36[i]} | {o36[i]} | {t36[i]} | {w36[i]} | {yw36[i]} | {yb36[i]} | {yi36[i]} | {nb36[i]} |"
rows_36.append(row)
new_l36 = "\n".join(rows_36)
text = text.replace(old_l36, new_l36)
# 2. L45: 배관용 탄소강관 KS D3507 (550 ~ 600)
old_l45 = "| 배 관 용 탄 소 강 관 KS D3507 | 550 〃 〃 〃 600 〃 〃 〃 | 558.8 〃 〃 〃 609.6 〃 〃 〃 | 6.0 6.4 7.9 9.5 6.0 6.4 7.1 7.9 | 81.8 87.2 107 129 89.0 95.2 106 117 | 19.1 18.5 16.7 15.1 19.1 18.4 17.5 16.6 | 9.5 9.2 8.3 7.6 9.5 9.2 8.7 8.3 | 9.5 9.2 8.3 7.6 9.5 9.2 8.7 8.3 | 19.1 18.5 16.7 15.1 19.1 18.4 17.5 16.6 |"
s45 = "550 〃 〃 〃 600 〃 〃 〃".split()
o45 = "558.8 〃 〃 〃 609.6 〃 〃 〃".split()
t45 = "6.0 6.4 7.9 9.5 6.0 6.4 7.1 7.9".split()
w45 = "81.8 87.2 107 129 89.0 95.2 106 117".split()
yw45 = "19.1 18.5 16.7 15.1 19.1 18.4 17.5 16.6".split()
yb45 = "9.5 9.2 8.3 7.6 9.5 9.2 8.7 8.3".split()
yi45 = "9.5 9.2 8.3 7.6 9.5 9.2 8.7 8.3".split()
nb45 = "19.1 18.5 16.7 15.1 19.1 18.4 17.5 16.6".split()
rows_45 = []
for i in range(len(s45)):
div_name = "배관용 탄소강관 KS D3507" if i == 0 else ""
row = f"| {div_name} | {s45[i]} | {o45[i]} | {t45[i]} | {w45[i]} | {yw45[i]} | {yb45[i]} | {yi45[i]} | {nb45[i]} |"
rows_45.append(row)
new_l45 = "\n".join(rows_45)
text = text.replace(old_l45, new_l45)
# 3. L308: 13-1-2 관만곡 설치 (PDF 732쪽 대조 18행 전개)
old_l308 = "| ø25 32 40 50 65 80 90 100 125 150 200 250 300 350 400 450 500 600 | | 0.035 0.040 0.045 0.050 0.060 0.070 0.085 0.100 0.130 0.160 0.20 0.28 0.38 0.48 0.63 0.81 1.00 1.50 | 0.015 0.015 0.020 0.020 0.025 0.030 0.035 0.045 0.055 0.070 0.09 0.12 0.16 0.20 0.27 0.35 0.45 0.75 | 0.040 0.045 0.055 0.065 0.075 0.085 0.110 0.120 0.130 0.170 0.25 0.32 0.45 0.57 0.76 0.96 1.19 1.70 | 0.020 0.020 0.020 0.025 0.030 0.035 0.045 0.050 0.060 0.075 0.11 0.14 0.19 0.24 0.32 0.42 0.52 0.75 | 0.040 0.050 0.060 0.075 0.090 0.100 0.110 0.140 0.170 0.200 0.28 0.38 0.53 0.77 1.10 1.55 | 0.020 0.020 0.025 0.030 0.035 0.045 0.050 0.060 0.075 0.085 0.12 0.17 0.23 0.33 0.51 0.73 | 0.050 0.055 0.065 0.075 0.100 0.120 0.135 0.160 0.200 0.240 0.32 0.46 0.63 1.00 1.40 1.75 | 0.020 0.025 0.030 0.035 0.045 0.050 0.060 0.070 0.085 0.110 0.14 0.20 0.27 0.43 0.60 0.75 | 0.055 0.060 0.065 0.080 0.100 0.115 0.130 0.150 0.200 0.270 0.28 0.38 0.52 0.68 0.90 1.15 1.46 2.30 | 0.020 0.025 0.030 0.035 0.040 0.045 0.055 0.065 0.080 0.095 0.12 0.16 0.22 0.29 0.38 0.49 0.62 0.90 |"
cols_308 = [c.strip().split() for c in old_l308.split('|')[1:-1]]
specs_308 = cols_308[0] # 18 specs
rows_308 = []
for i in range(len(specs_308)):
r = [specs_308[i], ""]
# cols 2..5: 18 values
for c_idx in [2, 3, 4, 5]:
r.append(cols_308[c_idx][i])
# cols 6..9: 16 values (500, 600 have no U-곡관)
for c_idx in [6, 7, 8, 9]:
r.append(cols_308[c_idx][i] if i < 16 else "-")
# cols 10..11: 18 values
for c_idx in [10, 11]:
r.append(cols_308[c_idx][i])
rows_308.append("| " + " | ".join(r) + " |")
new_l308 = "\n".join(rows_308)
text = text.replace(old_l308, new_l308)
# 4. L345: 13-1-2 관만곡 U곡관 (PDF 733쪽 대조 18행 전개)
old_l345 = "| ø25 32 40 50 65 80 90 100 125 150 200 250 300 350 400 450 500 600 | | 0.075 0.090 0.110 0.130 0.160 0.190 0.230 0.260 0.320 0.380 0.540 0.740 1.000 1.450 2.170 | 0.035 0.040 0.045 0.055 0.070 0.080 0.095 0.110 0.130 0.160 0.230 0.310 0.420 0.620 0.930 | 0.100 0.120 0.140 0.170 0.200 0.230 0.270 0.310 0.380 0.440 0.560 0.860 1.200 1.660 2.200 | 0.040 0.050 0.060 0.070 0.080 0.095 0.110 0.130 0.160 0.190 0.240 0.360 0.510 0.710 0.940 | 0.100 0.110 0.130 0.150 0.180 0.220 0.270 0.320 0.380 0.480 0.590 0.840 1.330 1.830 - | 0.040 0.050 0.060 0.070 0.080 0.095 0.110 0.125 0.160 0.200 0.250 0.360 0.570 0.830 - | 0.120 0.140 0.160 0.190 0.220 0.250 0.290 0.330 0.430 0.540 0.700 0.990 1.400 - - | 0.050 0.060 0.070 0.080 0.095 0.110 0.125 0.145 0.190 0.230 0.300 0.420 0.510 - - |"
cols_345 = [c.strip().split() for c in old_l345.split('|')[1:-1]]
specs_345 = cols_345[0] # 18 specs
rows_345 = []
for i in range(len(specs_345)):
r = [specs_345[i], ""]
# cols 2..5: 15 values (25..400), 450..600 are "-"
for c_idx in [2, 3, 4, 5]:
r.append(cols_345[c_idx][i] if i < 15 else "-")
# cols 6..7: 14 values (25..350), 400..600 are "-"
for c_idx in [6, 7]:
r.append(cols_345[c_idx][i] if i < 14 else "-")
# cols 8..9: 13 values (25..300), 350..600 are "-"
for c_idx in [8, 9]:
r.append(cols_345[c_idx][i] if i < 13 else "-")
rows_345.append("| " + " | ".join(r) + " |")
new_l345 = "\n".join(rows_345)
text = text.replace(old_l345, new_l345)
with open(ch13_path, 'w', encoding='utf-8') as f:
f.write(text)
print("Updated L36, L45, L308, L345 in 제13장_플랜트설비공사.md successfully.")