1.增加了画代表档距。
This commit is contained in:
parent
bd43894598
commit
462599b41d
28
PWFile.py
28
PWFile.py
|
|
@ -63,7 +63,9 @@ class SFile:
|
||||||
tower_name = sep_entry[0]
|
tower_name = sep_entry[0]
|
||||||
if tower_name in tower_dic:
|
if tower_name in tower_dic:
|
||||||
tower_dic[tower_name].forth_k = new_k # 更新耐张塔前侧k值。
|
tower_dic[tower_name].forth_k = new_k # 更新耐张塔前侧k值。
|
||||||
tower_dic[tower_name].forth_representive_span = new_reprtv_span # 更新耐张塔前侧k值。
|
tower_dic[
|
||||||
|
tower_name
|
||||||
|
].forth_representive_span = new_reprtv_span # 更新耐张塔前侧k值。
|
||||||
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
|
||||||
|
|
@ -114,6 +116,7 @@ class ColorEnume:
|
||||||
tree_color_rgb = [240, 226, 81]
|
tree_color_rgb = [240, 226, 81]
|
||||||
ground_color_rgb = [82, 79, 254]
|
ground_color_rgb = [82, 79, 254]
|
||||||
span_text_color_rgb = [140, 245, 236]
|
span_text_color_rgb = [140, 245, 236]
|
||||||
|
representive_span_text_color_rgb = [255, 172, 75]
|
||||||
|
|
||||||
|
|
||||||
# 读取Z文件,找到Z断面第一个点的坐标
|
# 读取Z文件,找到Z断面第一个点的坐标
|
||||||
|
|
@ -145,9 +148,9 @@ def np2d_to_array(np2d): # 把2维numpy数组转换成cad可以用的数组
|
||||||
t = np.hstack((np2d, np.zeros((np2d.shape[0], 1)))).reshape(1, np2d.shape[0] * 3)
|
t = np.hstack((np2d, np.zeros((np2d.shape[0], 1)))).reshape(1, np2d.shape[0] * 3)
|
||||||
return t[0]
|
return t[0]
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
class StringImpactExcel:
|
class StringImpactExcel:
|
||||||
|
|
||||||
def read(self, wb, gaocha, span, tension):
|
def read(self, wb, gaocha, span, tension):
|
||||||
pos代表档距 = "F13"
|
pos代表档距 = "F13"
|
||||||
pos档距 = "L13"
|
pos档距 = "L13"
|
||||||
|
|
@ -159,7 +162,6 @@ class StringImpactExcel:
|
||||||
sheet.range(pos档距).value = span
|
sheet.range(pos档距).value = span
|
||||||
sheet.range(pos张力).value = tension
|
sheet.range(pos张力).value = tension
|
||||||
string_length = sheet.range(pos总串长).value
|
string_length = sheet.range(pos总串长).value
|
||||||
# print(sheet.range("V25:V46").value)
|
|
||||||
x = np.linspace(string_length, span, int(span / 5), endpoint=True)
|
x = np.linspace(string_length, span, int(span / 5), endpoint=True)
|
||||||
x[0] = sheet.range("E23").value
|
x[0] = sheet.range("E23").value
|
||||||
x[1] = sheet.range("E24").value
|
x[1] = sheet.range("E24").value
|
||||||
|
|
@ -170,14 +172,15 @@ class StringImpactExcel:
|
||||||
return (x, y)
|
return (x, y)
|
||||||
|
|
||||||
|
|
||||||
def set_true_color(object, r_or_rgb_list, g, b):
|
def set_true_color(object, r_or_rgb_list, g=0, b=0):
|
||||||
true_color = object.TrueColor
|
true_color = object.TrueColor
|
||||||
if type(r_or_rgb_list) == List:
|
if type(r_or_rgb_list) == List or type(r_or_rgb_list)==list:
|
||||||
true_color.SetRGB(*r_or_rgb_list)
|
true_color.SetRGB(*r_or_rgb_list)
|
||||||
else:
|
else:
|
||||||
true_color.SetRGB(r_or_rgb_list, g, b)
|
true_color.SetRGB(r_or_rgb_list, g, b)
|
||||||
object.TrueColor = true_color
|
object.TrueColor = true_color
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
class StringImpactExcelRecord:
|
class StringImpactExcelRecord:
|
||||||
from_tower_name: str = ""
|
from_tower_name: str = ""
|
||||||
|
|
@ -187,6 +190,7 @@ class StringImpactExcelRecord:
|
||||||
tension: float = 0
|
tension: float = 0
|
||||||
gaocha: float = 0
|
gaocha: float = 0
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
class StringImpactPlate:
|
class StringImpactPlate:
|
||||||
_dwg_file_path: str
|
_dwg_file_path: str
|
||||||
|
|
@ -197,7 +201,6 @@ class StringImpactPlate:
|
||||||
_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, tower_dict):
|
||||||
# 从 start_tower_name开始,寻找一个耐张段
|
# 从 start_tower_name开始,寻找一个耐张段
|
||||||
index = []
|
index = []
|
||||||
|
|
@ -205,7 +208,6 @@ class StringImpactPlate:
|
||||||
index.append(tower_key_list.index(start_tower_name))
|
index.append(tower_key_list.index(start_tower_name))
|
||||||
can_start_find = False
|
can_start_find = False
|
||||||
for tower_key in tower_key_list:
|
for tower_key in tower_key_list:
|
||||||
# index.append(start_tower_name.index(foo))
|
|
||||||
tower_info = tower_dict[tower_key]
|
tower_info = tower_dict[tower_key]
|
||||||
if tower_info.tower_name == start_tower_name:
|
if tower_info.tower_name == start_tower_name:
|
||||||
can_start_find = True
|
can_start_find = True
|
||||||
|
|
@ -395,6 +397,18 @@ 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:
|
||||||
|
# 画代表档距
|
||||||
|
representive_span_text = f"{tower_info.back_representive_span:.0f}"
|
||||||
|
representive_span_text_point = np.array(
|
||||||
|
[(accu_mileage / 2) / 5 + 50, 1]
|
||||||
|
)
|
||||||
|
added_representive_span_text = cad.model.AddText(
|
||||||
|
representive_span_text,
|
||||||
|
APoint(*representive_span_text_point.tolist()),
|
||||||
|
3,
|
||||||
|
)
|
||||||
|
set_true_color(added_representive_span_text,ColorEnume.representive_span_text_color_rgb)
|
||||||
if draw_count > draw_count_limit - 1:
|
if draw_count > draw_count_limit - 1:
|
||||||
break
|
break
|
||||||
foundation_low = tower_info.foundation_low
|
foundation_low = tower_info.foundation_low
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue