parent
2109957df1
commit
034ba492c7
376
PWFile.py
376
PWFile.py
|
|
@ -206,26 +206,55 @@ class StringImpactPlate:
|
||||||
_dwg_file_path: str
|
_dwg_file_path: str
|
||||||
_s_file_path: str
|
_s_file_path: str
|
||||||
_draw_start_tower_name: str
|
_draw_start_tower_name: str
|
||||||
|
_draw_end_tower_name: str
|
||||||
_continouse_tension_excel: str
|
_continouse_tension_excel: str
|
||||||
_string_impact_curve_excel: str
|
_string_impact_curve_excel: str
|
||||||
_cad: None
|
_cad: None
|
||||||
excel_record_list: List = [] # 记录对excel的操作
|
excel_record_list: List = [] # 记录对excel的操作
|
||||||
|
|
||||||
def _find_target_tower_index(self, start_tower_name: str, tower_dict):
|
def _find_target_tower_index(
|
||||||
|
self, start_tower_name: str, end_tower_name, tower_dict
|
||||||
|
):
|
||||||
# 从 start_tower_name开始,寻找一个耐张段
|
# 从 start_tower_name开始,寻找一个耐张段
|
||||||
index = []
|
index = []
|
||||||
tower_key_list = list(tower_dict.keys())
|
tower_key_list = list(tower_dict.keys())
|
||||||
index.append(tower_key_list.index(start_tower_name))
|
try:
|
||||||
can_start_find = False
|
index_of_first_tower = tower_key_list.index(start_tower_name)
|
||||||
for tower_key in tower_key_list:
|
index.append(index_of_first_tower)
|
||||||
tower_info = tower_dict[tower_key]
|
except ValueError: # 没找到第一个塔,就直接返回
|
||||||
if tower_info.tower_name == start_tower_name:
|
return index
|
||||||
can_start_find = True
|
try:
|
||||||
continue
|
index_of_last_tower = tower_key_list.index(end_tower_name)
|
||||||
if can_start_find and tower_info.is_tension_tower == True:
|
# 开始补充第一个和最后一个直接的耐张塔
|
||||||
found_tower_name = tower_info.tower_name
|
for index_of_tension_tower in range(
|
||||||
index.append(tower_key_list.index(found_tower_name))
|
index_of_first_tower + 1, index_of_last_tower
|
||||||
break
|
):
|
||||||
|
if (
|
||||||
|
tower_dict[tower_key_list[index_of_tension_tower]].is_tension_tower
|
||||||
|
== True
|
||||||
|
):
|
||||||
|
index.append(index_of_tension_tower)
|
||||||
|
index.append(index_of_last_tower)
|
||||||
|
except ValueError: # 没找到最后一个塔,就只画一个耐张段
|
||||||
|
for index_of_tension_tower in range(
|
||||||
|
index_of_first_tower + 1, len(tower_key_list)
|
||||||
|
):
|
||||||
|
if (
|
||||||
|
tower_dict[tower_key_list[index_of_tension_tower]].is_tension_tower
|
||||||
|
== True
|
||||||
|
):
|
||||||
|
index.append(index_of_tension_tower)
|
||||||
|
break
|
||||||
|
# can_start_find = False
|
||||||
|
# for tower_key in tower_key_list:
|
||||||
|
# tower_info = tower_dict[tower_key]
|
||||||
|
# if tower_info.tower_name == start_tower_name:
|
||||||
|
# can_start_find = True
|
||||||
|
# continue
|
||||||
|
# if can_start_find and tower_info.is_tension_tower == True:
|
||||||
|
# found_tower_name = tower_info.tower_name
|
||||||
|
# index.append(tower_key_list.index(found_tower_name))
|
||||||
|
# break
|
||||||
return index
|
return index
|
||||||
|
|
||||||
def _plot(self, cad, plot_x, plot_y):
|
def _plot(self, cad, plot_x, plot_y):
|
||||||
|
|
@ -252,8 +281,8 @@ class StringImpactPlate:
|
||||||
s_file.open(self._s_file_path)
|
s_file.open(self._s_file_path)
|
||||||
tower_dict = s_file.tower_dic
|
tower_dict = s_file.tower_dic
|
||||||
tower_key_list = list(tower_dict.keys())
|
tower_key_list = list(tower_dict.keys())
|
||||||
draw_tower_index = self._find_target_tower_index(
|
draw_tower_indexes = self._find_target_tower_index(
|
||||||
self._draw_start_tower_name, tower_dict
|
self._draw_start_tower_name, self._draw_end_tower_name, tower_dict
|
||||||
)
|
)
|
||||||
fitting_file_path = deduce_fit_db_from_cad_path(self._dwg_file_path)
|
fitting_file_path = deduce_fit_db_from_cad_path(self._dwg_file_path)
|
||||||
fitting = Fitting(fitting_file_path)
|
fitting = Fitting(fitting_file_path)
|
||||||
|
|
@ -264,113 +293,223 @@ class StringImpactPlate:
|
||||||
wb_string_impact = excel_app.books.open(self._string_impact_curve_excel)
|
wb_string_impact = excel_app.books.open(self._string_impact_curve_excel)
|
||||||
stringImpactExcel = StringImpactExcel()
|
stringImpactExcel = StringImpactExcel()
|
||||||
sleep(1)
|
sleep(1)
|
||||||
draw_first_tower_key = tower_key_list[draw_tower_index[0]]
|
for draw_tower_index in draw_tower_indexes:
|
||||||
first_tower_info: SEntry = tower_dict[draw_first_tower_key]
|
draw_tower_key = tower_key_list[draw_tower_index]
|
||||||
forth_reprtv_span = first_tower_info.forth_representive_span
|
tower_info: SEntry = tower_dict[draw_tower_key]
|
||||||
continouse_sheet.range("B69").value = forth_reprtv_span
|
if draw_tower_index != draw_tower_indexes[-1]: # 不是最后一个
|
||||||
high_temperature_tension = continouse_sheet.range("L69").value
|
# 画前侧
|
||||||
if first_tower_info.is_tension_tower:
|
forth_reprtv_span = tower_info.forth_representive_span
|
||||||
forth_tower_info: SEntry = tower_dict[
|
continouse_sheet.range("B69").value = forth_reprtv_span
|
||||||
tower_key_list[draw_tower_index[0] + 1]
|
high_temperature_tension = continouse_sheet.range("L69").value
|
||||||
]
|
forth_tower_info: SEntry = tower_dict[
|
||||||
if forth_tower_info.is_tension_tower:
|
tower_key_list[draw_tower_index + 1]
|
||||||
forth_tower_fitting_length = 0
|
|
||||||
else:
|
|
||||||
forth_tower_fitting_length = fitting.fitting_length_dic[
|
|
||||||
forth_tower_info.fitting
|
|
||||||
]
|
]
|
||||||
gaocha_of_first_tower = (
|
if forth_tower_info.is_tension_tower:
|
||||||
(
|
forth_tower_fitting_length = 0
|
||||||
forth_tower_info.tower_height
|
else:
|
||||||
- forth_tower_info.foundation_low
|
forth_tower_fitting_length = fitting.fitting_length_dic[
|
||||||
- forth_tower_fitting_length
|
forth_tower_info.fitting
|
||||||
|
]
|
||||||
|
gaocha_of_tower = (
|
||||||
|
(
|
||||||
|
forth_tower_info.tower_height
|
||||||
|
- forth_tower_info.foundation_low
|
||||||
|
- forth_tower_fitting_length
|
||||||
|
)
|
||||||
|
- (tower_info.tower_height - tower_info.foundation_low)
|
||||||
|
+ forth_tower_info.altitude_off
|
||||||
)
|
)
|
||||||
- (first_tower_info.tower_height - first_tower_info.foundation_low)
|
span_of_tower = forth_tower_info.mileage_in_s - tower_info.mileage_in_s
|
||||||
+ forth_tower_info.altitude_off
|
(x, y) = stringImpactExcel.read(
|
||||||
)
|
wb_string_impact,
|
||||||
span_of_first_tower = (
|
gaocha_of_tower,
|
||||||
forth_tower_info.mileage_in_s - first_tower_info.mileage_in_s
|
span_of_tower,
|
||||||
)
|
high_temperature_tension,
|
||||||
(x, y) = stringImpactExcel.read(
|
)
|
||||||
wb_string_impact,
|
plot_x = (
|
||||||
gaocha_of_first_tower,
|
plate_origin[0]
|
||||||
span_of_first_tower,
|
+ (
|
||||||
high_temperature_tension,
|
tower_dict[tower_key_list[draw_tower_index]].mileage_in_s
|
||||||
)
|
- tower_dict[tower_key_list[draw_tower_indexes[0]]].mileage_in_s
|
||||||
# TODO: 没有考虑断面中间有耐张塔的情况
|
)
|
||||||
plot_x = (plate_origin[0] + x / 5).reshape(len(x), 1)
|
/ 5
|
||||||
plot_y = (
|
+ x / 5
|
||||||
plate_origin[1]
|
).reshape(len(x), 1)
|
||||||
+ (first_tower_info.tower_height - first_tower_info.foundation_low + y)
|
accumulate_altitude_off = np.sum(
|
||||||
* 2
|
[
|
||||||
).reshape(len(x), 1)
|
tower_dict[tower_key_list[bar]].altitude_off
|
||||||
self._plot(cad, plot_x, plot_y)
|
for bar in range(
|
||||||
# 记录
|
draw_tower_indexes[0] + 1, draw_tower_index + 1
|
||||||
record = StringImpactExcelRecord()
|
)
|
||||||
record.from_tower_name = first_tower_info.tower_name
|
]
|
||||||
record.fo_tower_name = forth_tower_info.tower_name
|
)
|
||||||
record.span = span_of_first_tower
|
plot_y = (
|
||||||
record.representive_span = first_tower_info.forth_representive_span
|
plate_origin[1]
|
||||||
record.gaocha = gaocha_of_first_tower
|
+ accumulate_altitude_off * 2
|
||||||
record.tension = high_temperature_tension
|
+ (tower_info.tower_height - tower_info.foundation_low + y) * 2
|
||||||
self.excel_record_list.append(record)
|
).reshape(len(x), 1)
|
||||||
# 画右侧耐张塔的弧垂
|
self._plot(cad, plot_x, plot_y)
|
||||||
draw_last_tower_key = tower_key_list[draw_tower_index[-1]]
|
if draw_tower_index != draw_tower_indexes[0]: # 不是第一个
|
||||||
last_tower_info: SEntry = tower_dict[draw_last_tower_key] # 最后一个塔位
|
# 画后侧
|
||||||
if last_tower_info.is_tension_tower:
|
back_reprtv_span = tower_info.back_representive_span
|
||||||
back_reprtv_span = last_tower_info.back_representive_span
|
continouse_sheet.range("B69").value = back_reprtv_span
|
||||||
back_tower_info: SEntry = tower_dict[
|
high_temperature_tension = continouse_sheet.range("L69").value
|
||||||
tower_key_list[draw_tower_index[-1] - 1]
|
back_tower_info: SEntry = tower_dict[
|
||||||
]
|
tower_key_list[draw_tower_index - 1]
|
||||||
if back_tower_info.is_tension_tower:
|
|
||||||
back_tower_fitting_length = 0
|
|
||||||
else:
|
|
||||||
back_tower_fitting_length = fitting.fitting_length_dic[
|
|
||||||
back_tower_info.fitting
|
|
||||||
]
|
]
|
||||||
gaocha_of_last_tower = (
|
if back_tower_info.is_tension_tower:
|
||||||
(
|
back_tower_fitting_length = 0
|
||||||
back_tower_info.tower_height
|
else:
|
||||||
- back_tower_info.foundation_low
|
back_tower_fitting_length = fitting.fitting_length_dic[
|
||||||
- back_tower_fitting_length
|
back_tower_info.fitting
|
||||||
|
]
|
||||||
|
gaocha_of_tower = (
|
||||||
|
(
|
||||||
|
back_tower_info.tower_height
|
||||||
|
- back_tower_info.foundation_low
|
||||||
|
- back_tower_fitting_length
|
||||||
|
)
|
||||||
|
- (tower_info.tower_height - tower_info.foundation_low)
|
||||||
|
- tower_info.altitude_off
|
||||||
)
|
)
|
||||||
- (last_tower_info.tower_height - last_tower_info.foundation_low)
|
span_of_tower = tower_info.mileage_in_s - back_tower_info.mileage_in_s
|
||||||
- last_tower_info.altitude_off
|
(x, y) = stringImpactExcel.read(
|
||||||
)
|
wb_string_impact,
|
||||||
span_of_last_tower = (
|
gaocha_of_tower,
|
||||||
last_tower_info.mileage_in_s - back_tower_info.mileage_in_s
|
span_of_tower,
|
||||||
)
|
high_temperature_tension,
|
||||||
(x, y) = stringImpactExcel.read(
|
|
||||||
wb_string_impact,
|
|
||||||
gaocha_of_last_tower,
|
|
||||||
span_of_last_tower,
|
|
||||||
high_temperature_tension,
|
|
||||||
)
|
|
||||||
plot_last_tower_x = (
|
|
||||||
plate_origin[0]
|
|
||||||
+ (
|
|
||||||
tower_dict[tower_key_list[draw_tower_index[-1]]].mileage_in_s
|
|
||||||
- tower_dict[tower_key_list[draw_tower_index[0]]].mileage_in_s
|
|
||||||
)
|
)
|
||||||
/ 5
|
plot_tower_x = (
|
||||||
- x / 5 # 从右往左画
|
plate_origin[0]
|
||||||
).reshape(len(x), 1)
|
+ (
|
||||||
accumulate_altitude_off = np.sum(
|
tower_dict[tower_key_list[draw_tower_index]].mileage_in_s
|
||||||
[
|
- tower_dict[tower_key_list[draw_tower_indexes[0]]].mileage_in_s
|
||||||
tower_dict[tower_key_list[bar]].altitude_off
|
)
|
||||||
for bar in range(draw_tower_index[0] + 1, draw_tower_index[-1] + 1)
|
/ 5
|
||||||
]
|
- x / 5 # 从右往左画
|
||||||
)
|
).reshape(len(x), 1)
|
||||||
plot_last_tower_y = (
|
accumulate_altitude_off = np.sum(
|
||||||
plate_origin[1]
|
[
|
||||||
+ accumulate_altitude_off * 2
|
tower_dict[tower_key_list[bar]].altitude_off
|
||||||
+ (last_tower_info.tower_height - last_tower_info.foundation_low + y)
|
for bar in range(
|
||||||
* 2
|
draw_tower_indexes[0] + 1, draw_tower_index + 1
|
||||||
).reshape(len(x), 1)
|
)
|
||||||
plot_last_tower_vector = np2d_to_array(
|
]
|
||||||
np.hstack((plot_last_tower_x, plot_last_tower_y))
|
)
|
||||||
)
|
plot_tower_y = (
|
||||||
self._plot(cad, plot_last_tower_x, plot_last_tower_y)
|
plate_origin[1]
|
||||||
|
+ accumulate_altitude_off * 2
|
||||||
|
+ (tower_info.tower_height - tower_info.foundation_low + y) * 2
|
||||||
|
).reshape(len(x), 1)
|
||||||
|
self._plot(cad, plot_tower_x, plot_tower_y)
|
||||||
|
# draw_first_tower_key = tower_key_list[draw_tower_indexes[0]]
|
||||||
|
# first_tower_info: SEntry = tower_dict[draw_first_tower_key]
|
||||||
|
# forth_reprtv_span = first_tower_info.forth_representive_span
|
||||||
|
# continouse_sheet.range("B69").value = forth_reprtv_span
|
||||||
|
# high_temperature_tension = continouse_sheet.range("L69").value
|
||||||
|
# if first_tower_info.is_tension_tower:
|
||||||
|
# forth_tower_info: SEntry = tower_dict[
|
||||||
|
# tower_key_list[draw_tower_indexes[0] + 1]
|
||||||
|
# ]
|
||||||
|
# if forth_tower_info.is_tension_tower:
|
||||||
|
# forth_tower_fitting_length = 0
|
||||||
|
# else:
|
||||||
|
# forth_tower_fitting_length = fitting.fitting_length_dic[
|
||||||
|
# forth_tower_info.fitting
|
||||||
|
# ]
|
||||||
|
# gaocha_of_first_tower = (
|
||||||
|
# (
|
||||||
|
# forth_tower_info.tower_height
|
||||||
|
# - forth_tower_info.foundation_low
|
||||||
|
# - forth_tower_fitting_length
|
||||||
|
# )
|
||||||
|
# - (first_tower_info.tower_height - first_tower_info.foundation_low)
|
||||||
|
# + forth_tower_info.altitude_off
|
||||||
|
# )
|
||||||
|
# span_of_first_tower = (
|
||||||
|
# forth_tower_info.mileage_in_s - first_tower_info.mileage_in_s
|
||||||
|
# )
|
||||||
|
# (x, y) = stringImpactExcel.read(
|
||||||
|
# wb_string_impact,
|
||||||
|
# gaocha_of_first_tower,
|
||||||
|
# span_of_first_tower,
|
||||||
|
# high_temperature_tension,
|
||||||
|
# )
|
||||||
|
# # TODO: 没有考虑断面中间有耐张塔的情况
|
||||||
|
# plot_x = (plate_origin[0] + x / 5).reshape(len(x), 1)
|
||||||
|
# plot_y = (
|
||||||
|
# plate_origin[1]
|
||||||
|
# + (first_tower_info.tower_height - first_tower_info.foundation_low + y)
|
||||||
|
# * 2
|
||||||
|
# ).reshape(len(x), 1)
|
||||||
|
# self._plot(cad, plot_x, plot_y)
|
||||||
|
# # 记录
|
||||||
|
# # TODO:记录还没有用
|
||||||
|
# record = StringImpactExcelRecord()
|
||||||
|
# record.from_tower_name = first_tower_info.tower_name
|
||||||
|
# record.fo_tower_name = forth_tower_info.tower_name
|
||||||
|
# record.span = span_of_first_tower
|
||||||
|
# record.representive_span = first_tower_info.forth_representive_span
|
||||||
|
# record.gaocha = gaocha_of_first_tower
|
||||||
|
# record.tension = high_temperature_tension
|
||||||
|
# self.excel_record_list.append(record)
|
||||||
|
# # 画右侧耐张塔的弧垂
|
||||||
|
# draw_last_tower_key = tower_key_list[draw_tower_indexes[-1]]
|
||||||
|
# last_tower_info: SEntry = tower_dict[draw_last_tower_key] # 最后一个塔位
|
||||||
|
# if last_tower_info.is_tension_tower:
|
||||||
|
# back_reprtv_span = last_tower_info.back_representive_span
|
||||||
|
# back_tower_info: SEntry = tower_dict[
|
||||||
|
# tower_key_list[draw_tower_indexes[-1] - 1]
|
||||||
|
# ]
|
||||||
|
# if back_tower_info.is_tension_tower:
|
||||||
|
# back_tower_fitting_length = 0
|
||||||
|
# else:
|
||||||
|
# back_tower_fitting_length = fitting.fitting_length_dic[
|
||||||
|
# back_tower_info.fitting
|
||||||
|
# ]
|
||||||
|
# gaocha_of_last_tower = (
|
||||||
|
# (
|
||||||
|
# back_tower_info.tower_height
|
||||||
|
# - back_tower_info.foundation_low
|
||||||
|
# - back_tower_fitting_length
|
||||||
|
# )
|
||||||
|
# - (last_tower_info.tower_height - last_tower_info.foundation_low)
|
||||||
|
# - last_tower_info.altitude_off
|
||||||
|
# )
|
||||||
|
# span_of_last_tower = (
|
||||||
|
# last_tower_info.mileage_in_s - back_tower_info.mileage_in_s
|
||||||
|
# )
|
||||||
|
# (x, y) = stringImpactExcel.read(
|
||||||
|
# wb_string_impact,
|
||||||
|
# gaocha_of_last_tower,
|
||||||
|
# span_of_last_tower,
|
||||||
|
# high_temperature_tension,
|
||||||
|
# )
|
||||||
|
# plot_last_tower_x = (
|
||||||
|
# plate_origin[0]
|
||||||
|
# + (
|
||||||
|
# tower_dict[tower_key_list[draw_tower_indexes[-1]]].mileage_in_s
|
||||||
|
# - tower_dict[tower_key_list[draw_tower_indexes[0]]].mileage_in_s
|
||||||
|
# )
|
||||||
|
# / 5
|
||||||
|
# - x / 5 # 从右往左画
|
||||||
|
# ).reshape(len(x), 1)
|
||||||
|
# accumulate_altitude_off = np.sum(
|
||||||
|
# [
|
||||||
|
# tower_dict[tower_key_list[bar]].altitude_off
|
||||||
|
# for bar in range(draw_tower_indexes[0] + 1, draw_tower_indexes[-1] + 1)
|
||||||
|
# ]
|
||||||
|
# )
|
||||||
|
# plot_last_tower_y = (
|
||||||
|
# plate_origin[1]
|
||||||
|
# + accumulate_altitude_off * 2
|
||||||
|
# + (last_tower_info.tower_height - last_tower_info.foundation_low + y)
|
||||||
|
# * 2
|
||||||
|
# ).reshape(len(x), 1)
|
||||||
|
# plot_last_tower_vector = np2d_to_array(
|
||||||
|
# np.hstack((plot_last_tower_x, plot_last_tower_y))
|
||||||
|
# )
|
||||||
|
# self._plot(cad, plot_last_tower_x, plot_last_tower_y)
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
if self._cad:
|
if self._cad:
|
||||||
|
|
@ -616,10 +755,10 @@ class ContinuousPlate:
|
||||||
array(
|
array(
|
||||||
"d",
|
"d",
|
||||||
[
|
[
|
||||||
(accu_mileage ) / 5 + 50,
|
(accu_mileage) / 5 + 50,
|
||||||
5,
|
5,
|
||||||
0,
|
0,
|
||||||
(accu_mileage ) / 5 + 50,
|
(accu_mileage) / 5 + 50,
|
||||||
10,
|
10,
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
|
|
@ -687,6 +826,7 @@ class ControlFile:
|
||||||
self._dwg_file_path,
|
self._dwg_file_path,
|
||||||
self._s_file_path,
|
self._s_file_path,
|
||||||
self._from_tower_name,
|
self._from_tower_name,
|
||||||
|
self._end_tower_name,
|
||||||
self._excel_continuous_path,
|
self._excel_continuous_path,
|
||||||
self._excel_string_weight_path,
|
self._excel_string_weight_path,
|
||||||
continuous_plate.cad,
|
continuous_plate.cad,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue