From 475ce6c3673fb5d67cbc9afc3e0c254a0ee8c957 Mon Sep 17 00:00:00 2001 From: n3040 Date: Thu, 26 Jan 2023 03:43:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=A1=94=E4=B8=8D=E6=98=AF=E8=80=90=E5=BC=A0=E5=A1=94?= =?UTF-8?q?=E6=97=B6=E8=AE=A1=E7=AE=97=E7=B4=AF=E5=8A=A0=E9=AB=98=E5=B7=AE?= =?UTF-8?q?=E5=92=8C=E6=A1=A3=E8=B7=9D=E7=9A=84bug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PWFile.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/PWFile.py b/PWFile.py index 9798e3d..691b542 100644 --- a/PWFile.py +++ b/PWFile.py @@ -220,7 +220,11 @@ class StringImpactPlate: tower_key_list = list(tower_dict.keys()) try: index_of_first_tower = tower_key_list.index(start_tower_name) - index.append(index_of_first_tower) + if ( + tower_dict[tower_key_list[index_of_first_tower]].is_tension_tower + == True + ): + index.append(index_of_first_tower) except ValueError: # 没找到第一个塔,就直接返回 return index try: @@ -234,7 +238,8 @@ class StringImpactPlate: == True ): index.append(index_of_tension_tower) - index.append(index_of_last_tower) + if tower_dict[tower_key_list[index_of_last_tower]].is_tension_tower == True: + index.append(index_of_last_tower) except ValueError: # 没找到最后一个塔,就只画一个耐张段 for index_of_tension_tower in range( index_of_first_tower + 1, len(tower_key_list) @@ -296,7 +301,9 @@ class StringImpactPlate: for draw_tower_index in draw_tower_indexes: draw_tower_key = tower_key_list[draw_tower_index] tower_info: SEntry = tower_dict[draw_tower_key] - if draw_tower_index != draw_tower_indexes[-1]: # 不是最后一个 + if draw_tower_index < tower_key_list.index( + self._draw_end_tower_name + ): # 不是最后一个,或者只有第一个。 # 画前侧 forth_reprtv_span = tower_info.forth_representive_span continouse_sheet.range("B69").value = forth_reprtv_span @@ -330,7 +337,7 @@ class StringImpactPlate: plate_origin[0] + ( 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[self._draw_start_tower_name].mileage_in_s ) / 5 + x / 5 @@ -339,7 +346,7 @@ class StringImpactPlate: [ tower_dict[tower_key_list[bar]].altitude_off for bar in range( - draw_tower_indexes[0] + 1, draw_tower_index + 1 + tower_key_list.index(self._draw_start_tower_name) + 1, draw_tower_index + 1 ) ] ) @@ -349,7 +356,9 @@ class StringImpactPlate: + (tower_info.tower_height - tower_info.foundation_low + y) * 2 ).reshape(len(x), 1) self._plot(cad, plot_x, plot_y) - if draw_tower_index != draw_tower_indexes[0]: # 不是第一个 + if draw_tower_index > tower_key_list.index( + self._draw_start_tower_name + ): # 不是第一个,或者只有最后一个 # 画后侧 back_reprtv_span = tower_info.back_representive_span continouse_sheet.range("B69").value = back_reprtv_span @@ -383,7 +392,7 @@ class StringImpactPlate: plate_origin[0] + ( 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[self._draw_start_tower_name].mileage_in_s ) / 5 - x / 5 # 从右往左画 @@ -392,7 +401,7 @@ class StringImpactPlate: [ tower_dict[tower_key_list[bar]].altitude_off for bar in range( - draw_tower_indexes[0] + 1, draw_tower_index + 1 + tower_key_list.index(self._draw_start_tower_name) + 1, draw_tower_index + 1 ) ] )