pyCreateTh.py

This commit is contained in:
Alex38Lyon
2025-06-27 18:21:00 +02:00
parent 7ef9405aed
commit 318dbad6ca
11 changed files with 598 additions and 229 deletions
+10 -12
View File
@@ -196,18 +196,16 @@ def read_config(config_file):
if 'Application_Data' in config and 'therion_path' in config['Application_Data']:
global_data.SurveyPrefixName = config['Application_Data']['survey_prefix_name']
if global_data.linesInTh2 == -1 :
if 'Application_Data' in config and 'shot_lines_in_th2_files' in config['Application_Data']:
global_data.linesInTh2 = 0 if config['Application_Data']['shot_lines_in_th2_files'] == "False" else 1
if global_data.stationNamesInTh2 == -1 :
if 'Application_Data' in config and 'station_name_in_th2_files' in config['Application_Data']:
global_data.stationNamesInTh2 = 0 if config['Application_Data']['station_name_in_th2_files'] == "False" else 1
if global_data.wallLineInTh2 == -1 :
if 'Application_Data' in config and 'wall_lines_in_th2_files' in config['Application_Data']:
global_data.wallLineInTh2 = 0 if config['Application_Data']['wall_lines_in_th2_files'] == "False" else 1
if 'Application_Data' in config and 'shot_lines_in_th2_files' in config['Application_Data']:
global_data.linesInTh2 = bool(config['Application_Data']['shot_lines_in_th2_files'])
if 'Application_Data' in config and 'station_name_in_th2_files' in config['Application_Data']:
global_data.stationNamesInTh2 = bool(config['Application_Data']['station_name_in_th2_files'])
if 'Application_Data' in config and 'kSmooth' in config['Application_Data']:
global_data.therionPath = float(config['Application_Data']['kSmooth'])
#################################################################################################
+9 -8
View File
@@ -26,23 +26,24 @@ stationByScrap = 20
finalTherion_exe = True
therionPath = "C:/Therion/therion.exe"
SurveyPrefixName = f"Survey_"
linesInTh2 = -1
stationNamesInTh2 = -1
wallLineInTh2 = -1
linesInTh2 = True
stationNamesInTh2 = True
wallLineInTh2 = True
kSmooth = 0.5
XVIScale = 100
#################################################################################################
totfile = """\t## Survey file:
\tinput Data/{TH_NAME}.th
\t## Plan file:
\t{ERR}input Data/{TH_NAME}-Plan.th2
\t{ERR}{Plan}input Data/{TH_NAME}-Plan.th2
\t## Extended file:
\t{ERR}input Data/{TH_NAME}-Extended.th2
\t{ERR}{Extended}input Data/{TH_NAME}-Extended.th2
\t## Maps file:
\t{ERR}input {TH_NAME}-maps.th
\t{ERR}{Maps}input {TH_NAME}-maps.th
"""
@@ -79,7 +80,7 @@ endsurvey
thconfigTemplate = """
source "{th_file}"
layout minimal
scale 1 100
scale 1 {XVIscale}
endlayout
select {selector}
+10 -4
View File
@@ -112,13 +112,19 @@ def compile_file(filename, **kwargs):
line = line.rstrip()
lower_line = line.lower()
if "average loop error" in lower_line:
log.warning(f"[Therion Compile {Colors.WHITE}{os.path.basename(filename)[:-9]}{Colors.WARNING}] {Colors.ENDC}{line}")
None
# log.warning(f"[Therion Compile {Colors.WHITE}{os.path.basename(filename)[:-9]}{Colors.WARNING}] {Colors.ENDC}{line}")
elif "error" in lower_line:
log.error(f"[Therion_Compile {Colors.WHITE}{os.path.basename(filename)[:-9]}{Colors.ERROR}] {Colors.ENDC}{line}")
elif "warning" in lower_line:
log.warning(f"[Therion Compile {Colors.WHITE}{os.path.basename(filename)[:-9]}{Colors.WARNING}] {Colors.ENDC}{line}")
elif "warning" in lower_line :
if not any( msg in line for msg in [
"invalid scrap outline",
"average loop error",
"multiple scrap outer outlines not supported yet"
]):
log.warning(f"[Therion compile {Colors.WHITE}{os.path.basename(filename)[:-9]}{Colors.WARNING}] {Colors.ENDC}{line}")
else:
log.debug(f"[Therion Compile {Colors.WHITE}{os.path.basename(filename)[:-9]}{Colors.DEBUG}] {Colors.ENDC}{line}")
log.debug(f"[Therion compile {Colors.WHITE}{os.path.basename(filename)[:-9]}{Colors.DEBUG}] {Colors.ENDC}{line}")
except Exception as e:
log.warning(f"Reading Therion [Therion_Compile {Colors.WHITE}{os.path.basename(filename)[:-9]}{Colors.WARNING}], output: {Colors.ENDC}{e}")