1.塔呼高可以有小数。
This commit is contained in:
parent
0dc1f3e153
commit
2c0c013b73
65
PWFile.py
65
PWFile.py
|
|
@ -1,3 +1,4 @@
|
||||||
|
import math
|
||||||
import os.path
|
import os.path
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
import re
|
import re
|
||||||
|
|
@ -20,14 +21,14 @@ class SEntry:
|
||||||
tower_height: float = 0
|
tower_height: float = 0
|
||||||
tower_type: str = ""
|
tower_type: str = ""
|
||||||
mileage_in_s: int = 0
|
mileage_in_s: int = 0
|
||||||
back_k: float = 0
|
back_k: float = 0 # 杆塔后侧的k值
|
||||||
forth_k: float = 0
|
forth_k: float = 0 # 杆塔前侧的k值
|
||||||
altitude_off: float = 0 # 中心桩高差
|
altitude_off: float = 0 # 中心桩高差
|
||||||
foundation_low: float = 0 # 基降
|
foundation_low: float = 0 # 基降
|
||||||
fitting: str = "" # 金具
|
fitting: str = "" # 金具
|
||||||
is_tension_tower: bool = False
|
is_tension_tower: bool = False # 是否为耐张塔
|
||||||
back_representive_span: float = 0 # 代表档距
|
back_representive_span: float = 0 # 后侧代表档距
|
||||||
forth_representive_span: float = 0 # 代表档距
|
forth_representive_span: float = 0 # 前侧代表档距
|
||||||
|
|
||||||
|
|
||||||
class SFile:
|
class SFile:
|
||||||
|
|
@ -65,7 +66,7 @@ class SFile:
|
||||||
tower_dic[tower_name].forth_k = new_k # 更新耐张塔前侧k值。
|
tower_dic[tower_name].forth_k = new_k # 更新耐张塔前侧k值。
|
||||||
tower_dic[
|
tower_dic[
|
||||||
tower_name
|
tower_name
|
||||||
].forth_representive_span = new_reprtv_span # 更新耐张塔前侧k值。
|
].forth_representive_span = new_reprtv_span # 更新耐张塔前侧代表档距。
|
||||||
last_k = tower_dic[tower_name].forth_k
|
last_k = tower_dic[tower_name].forth_k
|
||||||
last_reprtv_span = tower_dic[tower_name].forth_representive_span
|
last_reprtv_span = tower_dic[tower_name].forth_representive_span
|
||||||
continue
|
continue
|
||||||
|
|
@ -91,7 +92,7 @@ class SFile:
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
class Fitting:
|
class Fitting: # 金具
|
||||||
fitting_length_dic = {}
|
fitting_length_dic = {}
|
||||||
|
|
||||||
def __init__(self, fitting_file_path):
|
def __init__(self, fitting_file_path):
|
||||||
|
|
@ -140,7 +141,7 @@ def deduce_fit_db_from_cad_path(cad_file_path):
|
||||||
return os.path.join(dwg_file_name[0], "Fit.db")
|
return os.path.join(dwg_file_name[0], "Fit.db")
|
||||||
|
|
||||||
|
|
||||||
def curve_fun(x, span, k, gaocha):
|
def curve_fun(x, span, k, gaocha): # 弧垂公式
|
||||||
return x * gaocha / span - x * (span - x) * k
|
return x * gaocha / span - x * (span - x) * k
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -250,10 +251,11 @@ class StringImpactPlate:
|
||||||
stringImpactExcel = StringImpactExcel()
|
stringImpactExcel = StringImpactExcel()
|
||||||
sleep(1)
|
sleep(1)
|
||||||
draw_first_tower_key = tower_key_list[draw_tower_index[0]]
|
draw_first_tower_key = tower_key_list[draw_tower_index[0]]
|
||||||
first_tower_info = tower_dict[draw_first_tower_key]
|
first_tower_info: SEntry = tower_dict[draw_first_tower_key]
|
||||||
forth_reprtv_span = first_tower_info.forth_representive_span
|
forth_reprtv_span = first_tower_info.forth_representive_span
|
||||||
continouse_sheet.range("B69").value = forth_reprtv_span
|
continouse_sheet.range("B69").value = forth_reprtv_span
|
||||||
high_temperature_tension = continouse_sheet.range("L69").value
|
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_index[0] + 1]]
|
forth_tower_info: SEntry = tower_dict[tower_key_list[draw_tower_index[0] + 1]]
|
||||||
if forth_tower_info.is_tension_tower:
|
if forth_tower_info.is_tension_tower:
|
||||||
forth_tower_fitting_length = 0
|
forth_tower_fitting_length = 0
|
||||||
|
|
@ -297,7 +299,8 @@ class StringImpactPlate:
|
||||||
self.excel_record_list.append(record)
|
self.excel_record_list.append(record)
|
||||||
# 画右侧耐张塔的弧垂
|
# 画右侧耐张塔的弧垂
|
||||||
draw_last_tower_key = tower_key_list[draw_tower_index[-1]]
|
draw_last_tower_key = tower_key_list[draw_tower_index[-1]]
|
||||||
last_tower_info = tower_dict[draw_last_tower_key] # 最后一个塔位
|
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_reprtv_span = last_tower_info.back_representive_span
|
||||||
back_tower_info: SEntry = tower_dict[tower_key_list[draw_tower_index[-1] - 1]]
|
back_tower_info: SEntry = tower_dict[tower_key_list[draw_tower_index[-1] - 1]]
|
||||||
if back_tower_info.is_tension_tower:
|
if back_tower_info.is_tension_tower:
|
||||||
|
|
@ -376,7 +379,7 @@ class ContinuousPlate:
|
||||||
s_file.open(s_file_path)
|
s_file.open(s_file_path)
|
||||||
dwg_file_path = self._dwg_file_path
|
dwg_file_path = self._dwg_file_path
|
||||||
with Apyautocad(
|
with Apyautocad(
|
||||||
create_if_not_exists=True, visible=False, auto_close=False
|
create_if_not_exists=True, visible=True, auto_close=False
|
||||||
) as cad:
|
) as cad:
|
||||||
self.cad = cad
|
self.cad = cad
|
||||||
doc = cad.app.Documents.Open(dwg_file_path)
|
doc = cad.app.Documents.Open(dwg_file_path)
|
||||||
|
|
@ -409,6 +412,14 @@ class ContinuousPlate:
|
||||||
continue
|
continue
|
||||||
if not last_tower_info:
|
if not last_tower_info:
|
||||||
last_tower_info = tower_info
|
last_tower_info = tower_info
|
||||||
|
if draw_count > draw_count_limit - 1:
|
||||||
|
break
|
||||||
|
foundation_low = tower_info.foundation_low
|
||||||
|
accu_mileage = (
|
||||||
|
accu_mileage
|
||||||
|
+ tower_info.mileage_in_s
|
||||||
|
- last_tower_info.mileage_in_s
|
||||||
|
)
|
||||||
if draw_count == draw_count_limit - 1:
|
if draw_count == draw_count_limit - 1:
|
||||||
# 画代表档距
|
# 画代表档距
|
||||||
representive_span_text = f"{tower_info.back_representive_span:.0f}"
|
representive_span_text = f"{tower_info.back_representive_span:.0f}"
|
||||||
|
|
@ -424,15 +435,7 @@ class ContinuousPlate:
|
||||||
added_representive_span_text,
|
added_representive_span_text,
|
||||||
ColorEnume.representive_span_text_color_rgb,
|
ColorEnume.representive_span_text_color_rgb,
|
||||||
)
|
)
|
||||||
if draw_count > draw_count_limit - 1:
|
if is_first_tower: # 是否是开始画的第一个塔。
|
||||||
break
|
|
||||||
foundation_low = tower_info.foundation_low
|
|
||||||
accu_mileage = (
|
|
||||||
accu_mileage
|
|
||||||
+ tower_info.mileage_in_s
|
|
||||||
- last_tower_info.mileage_in_s
|
|
||||||
)
|
|
||||||
if is_first_tower:
|
|
||||||
accu_altitude_off = 0
|
accu_altitude_off = 0
|
||||||
else:
|
else:
|
||||||
accu_altitude_off = (
|
accu_altitude_off = (
|
||||||
|
|
@ -452,12 +455,21 @@ class ContinuousPlate:
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
tower_height = tower_info.tower_height
|
tower_height = tower_info.tower_height
|
||||||
|
if tower_info.is_tension_tower:
|
||||||
np_tower_end = first_tower_point + np.array(
|
np_tower_end = first_tower_point + np.array(
|
||||||
[
|
[
|
||||||
accu_mileage / 5,
|
accu_mileage / 5,
|
||||||
(accu_altitude_off + tower_height - foundation_low) * 2,
|
(accu_altitude_off + tower_height - foundation_low) * 2,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
np_tower_end = first_tower_point + np.array(
|
||||||
|
[
|
||||||
|
accu_mileage / 5,
|
||||||
|
(accu_altitude_off + tower_height - foundation_low-fitting_length_dict[tower_info.fitting]+3) * 2,
|
||||||
|
]
|
||||||
|
)#直线塔杆高只比悬垂挂点高3米
|
||||||
|
|
||||||
tower_end = APoint(*np_tower_end.tolist())
|
tower_end = APoint(*np_tower_end.tolist())
|
||||||
# 画杆高
|
# 画杆高
|
||||||
cad.model.AddLine(tower_start, tower_end)
|
cad.model.AddLine(tower_start, tower_end)
|
||||||
|
|
@ -467,8 +479,12 @@ class ContinuousPlate:
|
||||||
APoint(*(np_tower_end + np.array([-5, 13])).tolist()),
|
APoint(*(np_tower_end + np.array([-5, 13])).tolist()),
|
||||||
5,
|
5,
|
||||||
)
|
)
|
||||||
|
if abs(math.floor(tower_info.tower_height)-tower_info.tower_height)<0.1:#考虑了半米呼高的情况
|
||||||
|
draw_tower_height_str=f'{tower_info.tower_height:.0f}'
|
||||||
|
else:
|
||||||
|
draw_tower_height_str = f'{tower_info.tower_height:.1f}'
|
||||||
cad.model.AddText(
|
cad.model.AddText(
|
||||||
f"{tower_info.tower_type}-{tower_info.tower_height}",
|
f"{tower_info.tower_type}-{draw_tower_height_str}",
|
||||||
APoint(*(np_tower_end + np.array([-5, 5])).tolist()),
|
APoint(*(np_tower_end + np.array([-5, 5])).tolist()),
|
||||||
5,
|
5,
|
||||||
)
|
)
|
||||||
|
|
@ -623,5 +639,12 @@ class ControlFile:
|
||||||
string_impact_plate.draw()
|
string_impact_plate.draw()
|
||||||
cad = continousePlate.cad
|
cad = continousePlate.cad
|
||||||
cad.doc.SaveAs(self.get_zt_dwg_file_path())
|
cad.doc.SaveAs(self.get_zt_dwg_file_path())
|
||||||
|
# # 画完后再打开
|
||||||
|
# cad = None
|
||||||
|
# continousePlate = None
|
||||||
|
# with Apyautocad(
|
||||||
|
# create_if_not_exists=True, visible=True, auto_close=False
|
||||||
|
# ) as cad:
|
||||||
|
# cad.app.Documents.Open(self.get_zt_dwg_file_path())
|
||||||
if self._close_cad_document:
|
if self._close_cad_document:
|
||||||
cad.doc.Close(False)
|
cad.doc.Close(False)
|
||||||
|
|
|
||||||
4
gui.py
4
gui.py
|
|
@ -42,12 +42,12 @@ class MainWindow(QMainWindow, Ui_mainWindow):
|
||||||
self.statusBar().showMessage(
|
self.statusBar().showMessage(
|
||||||
f"{datetime.datetime.now()} Finished.", 8000
|
f"{datetime.datetime.now()} Finished.", 8000
|
||||||
)
|
)
|
||||||
QMessageBox.information(self, "提示", "断面图已生成。")
|
|
||||||
|
|
||||||
file_info = QFileInfo(z_control_file_path)
|
file_info = QFileInfo(z_control_file_path)
|
||||||
self._setting.setValue(
|
self._setting.setValue(
|
||||||
"last_working_directory", file_info.absoluteDir().absolutePath()
|
"last_working_directory", file_info.absoluteDir().absolutePath()
|
||||||
)
|
)
|
||||||
|
zfile_name = file_info.baseName()
|
||||||
|
QMessageBox.information(self, "提示", zfile_name + "断面图已生成。")
|
||||||
|
|
||||||
def _cBCloseCadDocClicked(self):
|
def _cBCloseCadDocClicked(self):
|
||||||
self._setting.setValue("close_cad", self.cBCloseCadDoc.isChecked())
|
self._setting.setValue("close_cad", self.cBCloseCadDoc.isChecked())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue