1.修复了耐张段代表档距更新的bug。
This commit is contained in:
parent
8ae1499114
commit
bd43894598
47
PWFile.py
47
PWFile.py
|
|
@ -63,6 +63,9 @@ class SFile:
|
|||
tower_name = sep_entry[0]
|
||||
if tower_name in tower_dic:
|
||||
tower_dic[tower_name].forth_k = new_k # 更新耐张塔前侧k值。
|
||||
tower_dic[tower_name].forth_representive_span = new_reprtv_span # 更新耐张塔前侧k值。
|
||||
last_k = tower_dic[tower_name].forth_k
|
||||
last_reprtv_span = tower_dic[tower_name].forth_representive_span
|
||||
continue
|
||||
s_entry = SEntry()
|
||||
s_entry.tower_name = tower_name
|
||||
|
|
@ -110,7 +113,7 @@ class ColorEnume:
|
|||
wire_color_rgb = [122, 219, 245]
|
||||
tree_color_rgb = [240, 226, 81]
|
||||
ground_color_rgb = [82, 79, 254]
|
||||
span_text_color_rgb=[140,245,236]
|
||||
span_text_color_rgb = [140, 245, 236]
|
||||
|
||||
|
||||
# 读取Z文件,找到Z断面第一个点的坐标
|
||||
|
|
@ -142,11 +145,8 @@ def np2d_to_array(np2d): # 把2维numpy数组转换成cad可以用的数组
|
|||
t = np.hstack((np2d, np.zeros((np2d.shape[0], 1)))).reshape(1, np2d.shape[0] * 3)
|
||||
return t[0]
|
||||
|
||||
|
||||
@define
|
||||
class StringImpactExcel:
|
||||
def __init__(self) -> None:
|
||||
# self._wb=None
|
||||
pass
|
||||
|
||||
def read(self, wb, gaocha, span, tension):
|
||||
pos代表档距 = "F13"
|
||||
|
|
@ -172,12 +172,20 @@ class StringImpactExcel:
|
|||
|
||||
def set_true_color(object, r_or_rgb_list, g, b):
|
||||
true_color = object.TrueColor
|
||||
if type(r_or_rgb_list)==List:
|
||||
if type(r_or_rgb_list) == List:
|
||||
true_color.SetRGB(*r_or_rgb_list)
|
||||
else:
|
||||
true_color.SetRGB(r_or_rgb_list, g, b)
|
||||
object.TrueColor = true_color
|
||||
|
||||
@define
|
||||
class StringImpactExcelRecord:
|
||||
from_tower_name:str=""
|
||||
fo_tower_name:str=""
|
||||
representive_span:float=0#代表档距
|
||||
span:float=0
|
||||
tension:float=0
|
||||
gaocha:float=0
|
||||
|
||||
@define
|
||||
class StringImpactPlate:
|
||||
|
|
@ -187,8 +195,11 @@ class StringImpactPlate:
|
|||
_continouse_tension_excel: str
|
||||
_string_impact_curve_excel: str
|
||||
_cad: None
|
||||
excel_record_list:List=[]#记录对excel的操作
|
||||
|
||||
|
||||
def _find_target_tower_index(self, start_tower_name: str, tower_dict):
|
||||
# 从 start_tower_name开始,寻找一个耐张段
|
||||
index = []
|
||||
tower_key_list = list(tower_dict.keys())
|
||||
index.append(tower_key_list.index(start_tower_name))
|
||||
|
|
@ -267,9 +278,18 @@ class StringImpactPlate:
|
|||
+ (first_tower_info.tower_height - first_tower_info.foundation_low + y) * 2
|
||||
).reshape(len(x), 1)
|
||||
self._plot(cad, plot_x, plot_y)
|
||||
# 记录
|
||||
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_index[-1]]
|
||||
last_tower_info = tower_dict[draw_last_tower_key]
|
||||
last_tower_info = tower_dict[draw_last_tower_key]#最后一个塔位
|
||||
back_reprtv_span = last_tower_info.back_representive_span
|
||||
back_tower_info = tower_dict[tower_key_list[draw_tower_index[-1] - 1]]
|
||||
gaocha_of_last_tower = (
|
||||
|
|
@ -503,10 +523,14 @@ class ContinuousPlate:
|
|||
)[0]
|
||||
)
|
||||
set_true_color(added_tree_curve, *ColorEnume.tree_color_rgb)
|
||||
#画档距
|
||||
span_text_insert_point=np.array([(accu_mileage-span/2)/5+50,6])
|
||||
added_span_text=cad.model.AddText(f'{span:.0f}',APoint(*span_text_insert_point.tolist()),3)
|
||||
set_true_color(added_span_text,*ColorEnume.span_text_color_rgb)
|
||||
# 画档距
|
||||
span_text_insert_point = np.array(
|
||||
[(accu_mileage - span / 2) / 5 + 50, 6]
|
||||
)
|
||||
added_span_text = cad.model.AddText(
|
||||
f"{span:.0f}", APoint(*span_text_insert_point.tolist()), 3
|
||||
)
|
||||
set_true_color(added_span_text, *ColorEnume.span_text_color_rgb)
|
||||
is_first_tower = False
|
||||
last_tower_info = tower_info
|
||||
|
||||
|
|
@ -529,6 +553,7 @@ class ControlFile:
|
|||
_dir_prefix: str = ""
|
||||
_z_file_name: str = ""
|
||||
_close_cad_document: bool = attrs.field(init=True, kw_only=False, default=True)
|
||||
|
||||
def __attrs_post_init__(self):
|
||||
z_excel_file_path = self._z_excel_file_path
|
||||
excel_pf = pd.read_excel(z_excel_file_path)
|
||||
|
|
|
|||
15
gui.py
15
gui.py
|
|
@ -29,7 +29,10 @@ class MainWindow(QMainWindow, Ui_mainWindow):
|
|||
)[0]
|
||||
for z_control_file_path in z_control_file_paths:
|
||||
if z_control_file_path != "":
|
||||
cf = ControlFile(z_control_file_path,close_cad_document=self.cBCloseCadDoc.isChecked())
|
||||
cf = ControlFile(
|
||||
z_control_file_path,
|
||||
close_cad_document=self.cBCloseCadDoc.isChecked(),
|
||||
)
|
||||
if self._test_if_file_occupied(cf.get_zt_dwg_file_path()):
|
||||
QMessageBox.warning(
|
||||
self, "注意", f"{cf.get_zt_dwg_file_path()}被占用,请先关闭。"
|
||||
|
|
@ -39,20 +42,24 @@ class MainWindow(QMainWindow, Ui_mainWindow):
|
|||
self.statusBar().showMessage(
|
||||
f"{datetime.datetime.now()} Finished.", 8000
|
||||
)
|
||||
QMessageBox.information(self, "提示", "断面图已生成。")
|
||||
|
||||
file_info = QFileInfo(z_control_file_path)
|
||||
self._setting.setValue(
|
||||
"last_working_directory", file_info.absoluteDir().absolutePath()
|
||||
)
|
||||
|
||||
def _cBCloseCadDocClicked(self):
|
||||
self._setting.setValue('close_cad',self.cBCloseCadDoc.isChecked())
|
||||
self._setting.setValue("close_cad", self.cBCloseCadDoc.isChecked())
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.pBOpenControlZFile.clicked.connect(self.open_dialog)
|
||||
self._setting = QSettings("NWEPDI", "Plate", self)
|
||||
if not self._setting.value('close_cad'):
|
||||
if not self._setting.value("close_cad"):
|
||||
self.cBCloseCadDoc.setChecked(False)
|
||||
else:
|
||||
self.cBCloseCadDoc.setChecked(self._setting.value('close_cad',type=bool))
|
||||
self.cBCloseCadDoc.setChecked(self._setting.value("close_cad", type=bool))
|
||||
self.cBCloseCadDoc.clicked.connect(self._cBCloseCadDocClicked)
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in New Issue