修复了file_object.py的一个bug。

This commit is contained in:
facat 2020-02-04 22:18:42 +08:00
parent 610d196009
commit 65ef2f5685
4 changed files with 25 additions and 23 deletions

View File

@ -176,7 +176,7 @@ class TaFileObject:
s_as_single.update_height(result, new_tower_height) s_as_single.update_height(result, new_tower_height)
# 将S文件中的塔高同步到TA文件中。 # 将S文件中的塔高同步到TA文件中。
def sync_tower_height_from_S(self): def sync_all_tower_height_from_S(self):
enter_string = input( enter_string = input(
"Will synchronize height in S to Ta. Enter S2T to proceed.\n" "Will synchronize height in S to Ta. Enter S2T to proceed.\n"
) )
@ -191,6 +191,8 @@ class TaFileObject:
continue continue
tower_number = s_entry[0] tower_number = s_entry[0]
tower_height = s_entry[7] tower_height = s_entry[7]
if tower_number in s_tower_height_dic:
continue# 只取第一次出现的。避免耐张段末端和首端不一致的问题。
s_tower_height_dic[tower_number] = tower_height s_tower_height_dic[tower_number] = tower_height
ta_content = self._read(self._file_path) ta_content = self._read(self._file_path)
new_ta_content = list(ta_content) new_ta_content = list(ta_content)

View File

@ -3,10 +3,10 @@ from file_object import SFileObject,CordinationObject
TA_ENTRY_TEMPLATE = "{tower_number},{suspend_or_tension},{mileage}, {conductor_suspension_poit},0.3212,0.000,{altitude},{pile_number},{tower_name}_{tower_height},{tower_height},{string_name},{string_length}, 0.000,0.1142,0.000000,0.000000,,15,15.500000,,{angel},2.5,15.5,2.500,3.000,1,610.4,2.000,0,2,0,2,{conductor_type},GJ-50,0,0,0,0.000,,0,0.000,9,750,1.000,,0,0.000,0,750,1.000,ZHCH_1,28,1.000,9.5,750,1.000,9.5,750,1.000,{string_name},1,{string_length},{string_name},1,{string_length},,0,0.000,,0,0.000,0,0,0.000, 0.000,0,0,0.000,0,0,4.000,0,1,1.000,,0,0.000,,0,0.000,,0,0.000,1,1,0.000,0,0,0.000, 0.000,0,0, 0.000,1.000,1.000,0.000,0.000,0.000,,0,\n" TA_ENTRY_TEMPLATE = "{tower_number},{suspend_or_tension},{mileage}, {conductor_suspension_poit},0.3212,0.000,{altitude},{pile_number},{tower_name}_{tower_height},{tower_height},{string_name},{string_length}, 0.000,0.1142,0.000000,0.000000,,15,15.500000,,{angel},2.5,15.5,2.500,3.000,1,610.4,2.000,0,2,0,2,{conductor_type},GJ-50,0,0,0,0.000,,0,0.000,9,750,1.000,,0,0.000,0,750,1.000,ZHCH_1,28,1.000,9.5,750,1.000,9.5,750,1.000,{string_name},1,{string_length},{string_name},1,{string_length},,0,0.000,,0,0.000,0,0,0.000, 0.000,0,0,0.000,0,0,4.000,0,1,1.000,,0,0.000,,0,0.000,,0,0.000,1,1,0.000,0,0,0.000, 0.000,0,0, 0.000,1.000,1.000,0.000,0.000,0.000,,0,\n"
TA_NC_STRING_NAME = "750-NC" TA_NC_STRING_NAME = "750-NC"
TA_NC_STRING_LENGTH = 14 TA_NC_STRING_LENGTH = 14
TA_NC_TOWER_NAME = 'WNSJ' TA_NC_TOWER_NAME = "WNSJ"
TA_XC_STRING_NAME = "750-FXBW" TA_XC_STRING_NAME = "750-FXBW"
TA_XC_STRING_LENGTH = 9.5 TA_XC_STRING_LENGTH = 9.5
TA_XC_TOWER_NAME = 'WNSZ' TA_XC_TOWER_NAME = "WNSZ"
TA_CONDUCTOR_TYPE = "LGJ-400/50" TA_CONDUCTOR_TYPE = "LGJ-400/50"
S_NC_STRING_NAME = "2*42-50" S_NC_STRING_NAME = "2*42-50"
# 通过串型来判别是不是耐张塔 # 通过串型来判别是不是耐张塔
@ -71,5 +71,3 @@ def generate_ta(TA_file, SFiles,cordination_file_path):
) )
) )
last_S_mileage = float(S_content[-1][1]) + last_S_mileage last_S_mileage = float(S_content[-1][1]) + last_S_mileage

17
main.py
View File

@ -3,15 +3,16 @@ from file_object import TaFileObject
if __name__ == "__main__": if __name__ == "__main__":
SFile = [ SFile = [
r"d:\工程\灵州-青山\排位\0-21\S000.DAT", r"d:\工程\灵州-青山\排位\0-20\S000.DAT",
# r"d:\工程\灵州-青山\排位\21-52\S021.DAT", r"d:\工程\灵州-青山\排位\20-72\S020.DAT",
# r"d:\工程\灵州-青山\排位\52-68\S052.DAT", r"d:\工程\灵州-青山\排位\72-BMX\S072.DAT",
# r"d:\工程\灵州-青山\排位\68-72\S068.DAT",
# r"d:\工程\灵州-青山\排位\72-169\S072.DAT",
] ]
ta_object = TaFileObject(r"d:\工程\灵州-青山\排位\道亨\最终排位\最终排位.TA", SFile) ta_object = TaFileObject(r"d:\工程\灵州-青山\排位\道亨\最终排位\最终排位.TA", SFile)
# ta_object.sync_tower_height_from_S() ta_object.sync_all_tower_height_from_S()
# ta_object.start() ta_object.start()
ta_object.sync_all_tower_height_from_TA_to_S() # ta_object.sync_all_tower_height_from_TA_to_S()
# generate_ta_from_csv.generate_ta(r"d:\工程\灵州-青山\排位\道亨\最终排位\最终排位.TA",SFile,r'd:\工程\灵州-青山\排位\道亨\成果表.csv') # generate_ta_from_csv.generate_ta(r"d:\工程\灵州-青山\排位\道亨\最终排位\最终排位.TA",SFile,r'd:\工程\灵州-青山\排位\道亨\成果表.csv')
# generate_ta_from_csv.generate_ta(
# r"d:\工程\灵州-青山\排位\道亨\最终排位\最终排位.TA", SFile, r"d:\工程\灵州-青山\排位\道亨\最终排位\成果表-0120.csv"
# )
print("Finished.") print("Finished.")

View File

@ -15,5 +15,6 @@ def output_pile(cordination_file, output_file):
if __name__ == "__main__": if __name__ == "__main__":
output_pile(r"d:\工程\灵州-青山\排位\道亨\成果表.csv", r"d:\工程\灵州-青山\排位\道亨\最终排位\org_append.TA") # output_pile(r"d:\工程\灵州-青山\排位\道亨\成果表.csv", r"d:\工程\灵州-青山\排位\道亨\最终排位\org_append.TA")
output_pile(r"d:\工程\灵州-青山\排位\道亨\最终排位\成果表-0120.csv", r"d:\工程\灵州-青山\排位\道亨\最终排位\org_append.txt")
print("survey. Finished.") print("survey. Finished.")