pyCreateTh

This commit is contained in:
Alex38Lyon
2025-06-16 19:16:18 +02:00
parent 6882d52675
commit 66ba353456
11 changed files with 2727 additions and 1147 deletions
+52
View File
@@ -0,0 +1,52 @@
2025-06-16 10:43:06,687 - INFO - ********************************************************************************************************************************************
2025-06-16 10:43:06,687 - INFO - * Conversion Th, Dat, Mak files to Therion files and folders
2025-06-16 10:43:06,687 - INFO - * Script pyCreateTh by : alexandre.pont@yahoo.fr
2025-06-16 10:43:06,687 - INFO - * Version : 2025.06.16
2025-06-16 10:43:06,687 - INFO - * Input file :
2025-06-16 10:43:06,688 - INFO - * Output file : ~\.
2025-06-16 10:43:06,688 - INFO - * Log file : ~\..\pyCreateTh.log
2025-06-16 10:43:06,688 - INFO - *
2025-06-16 10:43:06,688 - INFO - *
2025-06-16 10:43:06,689 - INFO - *
2025-06-16 10:43:06,692 - INFO - ********************************************************************************************************************************************
2025-06-16 10:43:06,694 - ERROR - !!! file not yet supported
2025-06-16 10:43:06,694 - ERROR - !!! There were 1 errors during 3.66 secondes, check the log file ~\..\pyCreateTh.log
2025-06-16 15:49:29,787 - INFO - ********************************************************************************************************************************************
2025-06-16 15:49:29,788 - INFO - * Conversion Th, Dat, Mak files to Therion files and folders
2025-06-16 15:49:29,789 - INFO - * Script pyCreateTh by : alexandre.pont@yahoo.fr
2025-06-16 15:49:29,789 - INFO - * Version : 2025.06.16
2025-06-16 15:49:29,789 - INFO - * Input file :
2025-06-16 15:49:29,789 - INFO - * Output file : ~\.
2025-06-16 15:49:29,789 - INFO - * Log file : ~\..\pyCreateTh.log
2025-06-16 15:49:29,790 - INFO - *
2025-06-16 15:49:29,790 - INFO - *
2025-06-16 15:49:29,790 - INFO - *
2025-06-16 15:49:29,790 - INFO - ********************************************************************************************************************************************
2025-06-16 15:49:29,791 - ERROR - !!! file not yet supported
2025-06-16 15:49:29,792 - ERROR - !!! There were 1 errors during 8.04 secondes, check the log file ~\..\pyCreateTh.log
2025-06-16 16:18:18,921 - INFO - ********************************************************************************************************************************************
2025-06-16 16:18:18,922 - INFO - * Conversion Th, Dat, Mak files to Therion files and folders
2025-06-16 16:18:18,922 - INFO - * Script pyCreateTh by : alexandre.pont@yahoo.fr
2025-06-16 16:18:18,922 - INFO - * Version : 2025.06.16
2025-06-16 16:18:18,923 - INFO - * Input file :
2025-06-16 16:18:18,923 - INFO - * Output file : ~\.
2025-06-16 16:18:18,923 - INFO - * Log file : ~\..\pyCreateTh.log
2025-06-16 16:18:18,923 - INFO - *
2025-06-16 16:18:18,924 - INFO - *
2025-06-16 16:18:18,924 - INFO - *
2025-06-16 16:18:18,924 - INFO - ********************************************************************************************************************************************
2025-06-16 16:18:18,925 - ERROR - !!! file not yet supported
2025-06-16 16:18:18,926 - ERROR - !!! There were 1 errors during 2.39 secondes, check the log file ~\..\pyCreateTh.log
2025-06-16 19:05:25,443 - INFO - ********************************************************************************************************************************************
2025-06-16 19:05:25,445 - INFO - * Conversion Th, Dat, Mak files to Therion files and folders
2025-06-16 19:05:25,445 - INFO - * Script pyCreateTh by : alexandre.pont@yahoo.fr
2025-06-16 19:05:25,445 - INFO - * Version : 2025.06.16
2025-06-16 19:05:25,445 - INFO - * Input file :
2025-06-16 19:05:25,446 - INFO - * Output file : ~\.
2025-06-16 19:05:25,446 - INFO - * Log file : ~\..\pyCreateTh.log
2025-06-16 19:05:25,446 - INFO - *
2025-06-16 19:05:25,446 - INFO - *
2025-06-16 19:05:25,446 - INFO - *
2025-06-16 19:05:25,447 - INFO - ********************************************************************************************************************************************
2025-06-16 19:05:25,448 - ERROR - !!! file not yet supported
2025-06-16 19:05:25,448 - ERROR - !!! There were 1 errors during 13.29 secondes, check the log file ~\..\pyCreateTh.log
+41 -8
View File
@@ -32,6 +32,40 @@ class Colors:
BOLD = '\033[1m' BOLD = '\033[1m'
UNDERLINE = '\033[4m' UNDERLINE = '\033[4m'
#################################################################################################
def safe_relpath(path):
"""
Renvoie un chemin relatif si possible, sinon un chemin partiel à partir du dossier de référence.
"""
abs_path = os.path.abspath(path)
ref_path = os.path.abspath(os.getcwd())
try:
valeur = "~\\" + os.path.relpath(path, ref_path)
return valeur
except ValueError:
max_depth = 7
# Disques différents, afficher le chemin relatif partiel depuis la racine commune
path_parts = abs_path.split(os.sep)
ref_parts = ref_path.split(os.sep)
while path_parts and ref_parts and path_parts[0] == ref_parts[0]:
path_parts.pop(0)
ref_parts.pop(0)
result = os.path.join(*path_parts) if path_parts else os.path.basename(path)
# Si max_depth est défini, tronque le chemin
if max_depth is not None:
parts = result.split(os.sep)
if len(parts) > max_depth:
result = os.path.join("~\\" , *parts[-max_depth:])
return result
################################################################################################# #################################################################################################
def compile_template(template, template_args, **kwargs): def compile_template(template, template_args, **kwargs):
global error_count global error_count
@@ -63,6 +97,7 @@ def compile_template(template, template_args, **kwargs):
error_count += 1 error_count += 1
#################################################################################################
def compile_template2(template, template_args, **kwargs): def compile_template2(template, template_args, **kwargs):
global error_count global error_count
@@ -147,7 +182,7 @@ def compile_file(filename, **kwargs):
bufsize=1 # ligne par ligne bufsize=1 # ligne par ligne
) )
log.info(f"Start therion compilation file : {Colors.ENDC}~\\{os.path.relpath(filename)}") log.info(f"Start therion compilation file : {Colors.ENDC}{safe_relpath(filename)}")
# Lecture en temps réel # Lecture en temps réel
for line in process.stdout: for line in process.stdout:
line = line.rstrip() line = line.rstrip()
@@ -167,15 +202,14 @@ def compile_file(filename, **kwargs):
log.error(f"Error during Therion compilation, stderr : \n{Colors.ENDC}{process.stderr.decode()}") log.error(f"Error during Therion compilation, stderr : \n{Colors.ENDC}{process.stderr.decode()}")
error_count += 1 error_count += 1
log.info(f"Therion file : {Colors.ENDC}~\\{os.path.relpath(filename)}{Colors.GREEN} succeeded") log.info(f"Therion file : {Colors.ENDC}{safe_relpath(filename)}{Colors.GREEN} succeeded")
except Exception as e: except Exception as e:
log.error(f"Therion file {Colors.ENDC}~\\{os.path.relpath(filename, os.path.expanduser('~'))}{Colors.ERROR} compilation error: {Colors.ENDC}{e}") log.error(f"Therion file {Colors.ENDC}{safe_relpath(filename, os.path.expanduser('~'))}{Colors.ERROR} compilation error: {Colors.ENDC}{e}")
error_count += 1 error_count += 1
#################################################################################################
def compile_file2(filename, **kwargs): def compile_file2(filename, **kwargs):
global error_count global error_count
@@ -232,14 +266,13 @@ def compile_file2(filename, **kwargs):
error_count += 1 error_count += 1
else: else:
log.info(f"Therion file : {Colors.ENDC}~\\{os.path.relpath(filename)}{Colors.GREEN} compilation succeeded") log.info(f"Therion file : {Colors.ENDC}{safe_relpath(filename)}{Colors.GREEN} compilation succeeded")
except Exception as e: except Exception as e:
log.error(f"Therion file {Colors.ENDC}~\\{os.path.relpath(filename)}{Colors.ERROR} compilation error: {Colors.ENDC}{e}") log.error(f"Therion file {Colors.ENDC}{safe_relpath(filename)}{Colors.ERROR} compilation error: {Colors.ENDC}{e}")
error_count += 1 error_count += 1
################################################################################################# #################################################################################################
def compile_file_th(filepath, **kwargs): def compile_file_th(filepath, **kwargs):
template = """source {filepath} template = """source {filepath}
@@ -35,7 +35,8 @@ encoding utf-8
source {fileName}-tot.th source {fileName}-tot.th
## Add config file ## Add config file
input config.thc input {configPath}config.thc
############################################################################################### ###############################################################################################
## 2-LAYOUT ## 2-LAYOUT
+513
View File
@@ -0,0 +1,513 @@
Fulford Cave
SURVEY NAME: A
SURVEY DATE: 6 29 1987 COMMENT:Entrance Passage
SURVEY TEAM:
, , , ,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
A1 A2 21.75 63.50 -28.00 2.60 2.60 2.60 2.60
A2 A3 23.75 15.50 -17.00 8.00 0.00 2.10 2.70
A3 A4 13.35 303.00 -13.50 11.80 3.00 6.00 9.20
A4 A5 14.00 51.00 -14.00 -9999.00 6.00 4.20 -9999.00
A5 A6 32.90 105.50 -8.00 8.00 6.60 5.00 -9999.00
A6 A7 21.10 123.00 22.00 4.00 22.00 4.90 0.00
A6 A8 32.85 76.00 11.00 4.00 22.00 4.90 0.00
A8 A9 19.20 16.00 4.00 6.00 12.00 0.00 2.50
A9 A10 23.75 276.50 -33.50 3.00 6.00 4.50 0.00
A10 A11 9.25 3.50 -16.00 5.80 3.90 0.50 -9999.00
A11 A12 16.60 20.00 -8.00 1.40 0.00 3.90 3.80
A12 A13 30.80 13.00 0.00 5.00 0.00 4.70 3.30
Fulford Cave
SURVEY NAME: A+
SURVEY DATE: 6 20 1987 COMMENT:Big Meander Area
SURVEY TEAM:
Steve Reames,Stan Allison, , ,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
A13 A14 18.20 8.50 6.00 6.90 6.00 2.00 4.00
A14 A15 17.70 333.00 7.00 0.60 3.00 4.30 3.40
A15 A16 20.50 7.50 -5.00 -9999.00 4.00 2.20 1.00
A13 A17 27.20 303.00 -17.00 6.90 6.00 2.00 4.00
A17 A18 14.80 272.00 -31.00 3.00 6.00 4.00 4.20
A18 A19 12.30 346.00 -13.00 2.20 0.90 1.30 -9999.00
A19 A20 22.00 18.00 16.00 2.90 -9999.00 5.60 5.30
A20 A21 33.20 89.00 19.00 2.90 4.00 4.00 5.30
A21 A22 10.10 65.00 32.00 4.00 5.00 5.00 9.00
A16 A22 14.50 97.00 3.00 -9999.00 2.70 2.70 -9999.00
A22 A23 43.40 15.00 3.00 4.00 5.00 5.00 9.00
A23 A24 20.60 21.00 0.00 -9999.00 12.00 5.00 -9999.00
A24 A25 11.80 28.00 4.00 -9999.00 10.00 2.00 -9999.00
A25 A26 10.70 29.00 9.00 3.00 2.00 2.00 2.00
A26 A27 17.80 55.00 19.00 3.00 2.00 2.00 2.00
A27 A28 21.70 110.00 9.00 3.80 6.00 3.70 3.00
A28 A29 11.40 177.00 26.00 0.50 1.30 3.30 5.30
A29 A30 12.40 150.00 34.00 3.50 0.00 3.90 2.00
A30 A31 15.60 172.00 -48.00 0.00 1.00 2.00 1.80
A31 A32 18.60 38.00 -28.00 3.50 5.70 0.00 1.00
Fulford Cave
SURVEY NAME: B
SURVEY DATE: 9 5 1987 COMMENT:Stream Gallery
SURVEY TEAM:
Steve Reames,Paul Burger,Todd Warren, ,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
B2 A32 46.10 146.50 27.00 14.60 4.00 1.50 11.00
B2 B1 14.20 240.00 -31.00 14.60 4.00 1.50 11.00
B2 B2A 21.70 352.00 -9.00 14.60 4.00 1.50 11.00
A32 B3 57.40 159.50 16.00 11.00 3.50 1.50 -9999.00
B3 B4 41.20 131.00 16.00 15.00 5.00 12.00 3.00
B4 B5 11.60 26.00 -8.00 12.00 14.00 4.00 8.00
B5 B6 30.40 125.00 9.00 10.00 16.00 0.00 10.00
B6 B7 38.50 61.00 30.00 4.00 20.00 4.00 1.00
B7 B8 30.50 154.00 18.00 5.00 3.00 4.00 -9999.00
B8 B9 11.90 148.00 -5.00 0.00 9.00 5.50 6.00
B9 B10 21.80 122.50 -5.00 2.00 3.00 4.00 4.00
B10 B11 8.40 33.00 0.00 -9999.00 3.00 1.00 6.50
B4 B12 25.60 143.00 45.00 4.00 20.00 4.00 1.00
B12 B13 90.10 120.50 25.00 23.00 15.00 5.00 8.00
B14 B13 27.60 33.00 35.00 0.00 30.00 15.00 24.00
B14 B15 61.20 86.00 21.50 22.00 20.00 5.00 2.00
B15 B16 45.60 115.00 18.00 4.00 13.00 5.00 0.00
B16 B17 36.00 135.50 25.00 3.00 5.00 0.00 5.00
B17 B18 11.70 128.00 13.00 4.00 5.00 5.00 4.00
B18 B19 16.70 138.00 9.50 5.00 4.00 0.00 3.00
B19 B20 8.80 180.00 50.00 3.00 5.50 3.00 1.00
B20 B21 15.10 56.00 45.00 4.50 6.50 4.00 0.00
B21 B21 0.00 0.00 0.00 6.00 12.00 5.00 7.00
Fulford Cave
SURVEY NAME: C
SURVEY DATE: 7 16 1988 COMMENT:Breakdown Room
SURVEY TEAM:
Steve Reames,Paul Burger, , ,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
A24 C1 20.85 72.00 26.00 -9999.00 10.00 2.00 -9999.00
C1 C2 21.35 76.50 38.00 0.50 7.00 1.00 9.00
C2 C3 8.15 67.50 24.00 6.00 0.00 3.00 -9999.00
C3 C4 7.00 158.00 8.50 3.00 0.50 2.00 4.00
C4 C5 11.55 32.00 61.00 2.00 2.50 1.00 2.50
C5A C5 9.55 18.00 56.00 3.00 0.00 5.00 5.00
C5A C5B 4.10 0.00 -90.00 -9999.00 -9999.00 -9999.00 -9999.00
A30 C5B 4.00 260.00 16.00 0.00 1.10 2.00 1.80
C6 C5 16.70 342.00 -39.00 30.00 0.00 5.50 7.00
C6 C6A 30.40 304.50 -11.00 30.00 0.00 5.50 7.00
C6 C6B 17.00 151.00 31.00 30.00 0.00 5.50 7.00
C6 C6C 26.50 80.00 22.00 30.00 0.00 5.50 7.00
C6 C7 33.30 270.00 -7.00 30.00 0.00 5.50 7.00
C7 C8 46.85 171.00 13.50 30.00 0.00 5.50 7.00
C8 C9 25.15 189.00 4.00 15.00 3.00 2.00 20.00
C9 C10 39.35 203.00 -12.00 15.00 2.00 0.00 14.00
C10 C11 74.65 181.00 -2.00 34.00 1.00 3.00 15.00
Fulford Cave
SURVEY NAME: C+
SURVEY DATE: 7 17 1988 COMMENT:Moon Milk Corridor
SURVEY TEAM:
Steve Reames,Paul Burger , , ,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
C11 C12 63.60 203.50 2.00 4.00 10.00 6.00 18.00
C12 C13 30.35 70.00 -1.50 0.00 8.00 2.00 12.00
C13 C14 41.10 42.50 20.50 7.00 10.00 2.00 0.00
C14 CA1 13.80 21.00 11.00 10.00 5.00 8.00 5.00
CA1 CA2 26.25 357.00 -21.00 4.00 3.50 2.00 10.00
CA2 CA3 30.45 4.00 3.00 3.00 4.00 2.00 4.00
CA3 CA4 15.55 266.00 0.00 -9999.00 6.00 0.50 -9999.00
CA4 C10 34.60 325.00 -13.00 6.00 0.00 5.00 7.00
Fulford Cave
SURVEY NAME: C++
SURVEY DATE: 8 27 1988 COMMENT:Stalagmite Room
SURVEY TEAM:
Steve Reames,Garry Petrie,Paul Burger,Ted Lappin,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
C14 C15 30.30 43.00 21.00 10.00 5.00 8.00 5.00
C15 C15A 21.10 153.00 12.50 3.00 0.50 2.50 12.00
C15 C16 16.70 62.00 2.00 3.00 0.50 2.50 12.00
C16 C17 3.80 55.50 45.00 2.50 1.00 2.00 1.00
C17 C18 9.15 131.00 46.00 3.00 2.00 2.00 2.00
C18 C19 8.70 63.00 54.50 0.00 2.00 5.00 3.00
C19 C20 16.85 123.00 20.50 -9999.00 8.00 4.00 -9999.00
C20 C21 40.50 349.00 2.00 14.00 10.00 2.00 9.00
C21 C21A 26.35 303.00 -11.00 13.00 2.00 5.00 11.00
C21 C22 27.50 351.50 13.50 13.00 2.00 5.00 11.00
C22 C23 6.00 32.00 -25.00 1.00 3.00 1.00 5.00
C23 C24 2.50 0.00 -90.00 0.75 1.50 3.00 1.00
C25 C24 21.60 183.00 0.00 -9999.00 27.00 2.00 -9999.00
C25 C26 15.85 65.00 11.00 -9999.00 27.00 2.00 -9999.00
C26 C27 11.45 48.00 -5.00 -9999.00 -9999.00 -9999.00 3.00
C28 C27 34.80 86.00 -25.50 18.00 5.00 -9999.00 10.00
C28 C29 14.90 193.00 8.50 18.00 5.00 -9999.00 10.00
C30 C29 51.40 155.00 30.00 9.00 10.00 3.00 0.00
C6 C30 69.10 164.00 38.00 30.00 0.00 5.50 7.00
CB1 C29 46.70 131.00 24.00 3.00 3.00 5.00 0.00
CB1 CB2 9.25 244.00 1.00 3.00 3.00 5.00 0.00
CB2 CB3 9.30 301.00 -6.50 0.00 2.50 5.00 2.50
CB3 CB4 15.85 202.00 7.00 3.00 2.50 5.00 0.00
CB4 CB5 4.50 5.50 0.00 0.00 4.50 5.50 4.00
CB5 CB6 10.10 221.00 6.00 3.00 3.00 3.00 0.00
CB6 CB7 15.30 302.00 -1.00 0.00 1.00 9.00 2.00
CB7 CB8 19.95 8.00 -6.00 1.00 1.50 7.00 1.00
CB8 CB9 13.60 102.00 20.50 0.00 4.00 4.50 3.00
CB9 CB10 13.55 346.00 4.00 -9999.00 4.50 4.50 3.00
CB10 CB11 18.90 33.00 25.00 0.00 7.50 4.50 1.50
CB11 CB12 8.05 12.00 0.00 1.50 6.00 5.00 0.00
CB12 CB13 3.05 322.00 9.00 1.50 5.50 6.00 2.00
Fulford Cave
SURVEY NAME: A3
SURVEY DATE: 8 28 1988 COMMENT:Upper Entrance Connection
SURVEY TEAM:
Steve Reames,Garry Petrie,Ted Lappin,Brent Hymel,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
A3A A3 25.80 303.00 -51.00 0.00 20.00 5.00 4.10
A3A AM11 14.80 239.00 47.50 -9999.00 -9999.00 -9999.00 -9999.00
Fulford Cave
SURVEY NAME: AN
SURVEY DATE: 8 27 1988 COMMENT:North Entrance
SURVEY TEAM:
Mike Roberts,Rick Rhinehart, , ,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
A1 S2 13.00 170.00 35.00 2.60 2.60 2.60 2.60 #|P#
S2 AN1 76.71 4.00 11.00 -9999.00 -9999.00 -9999.00 -9999.00 #|P#
AN1 AN2 4.92 121.50 -23.00 -9999.00 -9999.00 -9999.00 -9999.00
AN2 AN3 11.96 17.50 -26.00 -9999.00 3.50 0.00 1.50
AN3 AN4 21.75 301.00 -30.00 4.00 3.00 3.00 0.00
AN4 AN5 9.92 340.50 -29.00 0.00 4.00 3.00 5.00
AN5 AN6 17.13 24.00 -16.00 0.00 7.00 4.00 2.00
AN6 AN7 21.08 330.50 0.00 4.00 3.00 5.00 0.00
AN7 AN8 7.13 218.50 -8.00 3.50 2.00 1.50 2.00
AN8 AN9 9.21 340.00 0.00 1.00 1.00 2.50 -9999.00
Fulford Cave
SURVEY NAME: AA
SURVEY DATE: 8 27 1988 COMMENT:Lower Room
SURVEY TEAM:
Ken Kreager,Ben Longwell,Tamara Beltran,Brent Hymel,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
A13 A13A 30.40 203.00 -9.00 6.90 6.00 2.00 4.00
A13A A13B 17.00 183.00 12.00 7.00 -9999.00 -9999.00 -9999.00
A13B A13C 17.50 205.00 30.50 7.00 -9999.00 -9999.00 -9999.00
A13B AA1 14.90 236.00 -6.60 7.00 -9999.00 -9999.00 -9999.00
AA1 AA2 6.25 147.00 -3.00 7.00 -9999.00 -9999.00 -9999.00
AA2 AA3 12.40 293.00 -21.00 12.00 0.00 3.00 2.00
AA3 AA4 8.50 289.00 -38.00 10.00 4.00 3.00 -9999.00
AA4 AA5 26.00 314.00 -52.00 2.00 1.00 10.00 10.00
AA5 AA6 32.60 298.00 -39.00 9.00 8.00 25.00 20.00
AA6 AA7 30.30 283.00 -23.00 15.00 30.00 4.00 20.00
AA7 AA7A 25.00 219.00 14.00 20.00 25.00 0.00 20.00
AA7 AA8 21.70 336.00 -11.00 20.00 25.00 0.00 20.00
AA8 AA9 17.50 324.00 -11.00 4.00 1.00 1.50 4.00
Fulford Cave
SURVEY NAME: AM
SURVEY DATE: 8 28 1988 COMMENT:North Entrance To Main Cave
SURVEY TEAM:
Mike Roberts,Rick Rhinehart, , ,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
AN1 AM1 17.90 102.50 3.00 -9999.00 -9999.00 -9999.00 -9999.00
AM1 AM2 12.20 130.50 12.00 0.00 1.00 3.50 3.50
AM2 AM3 8.88 93.00 -24.00 3.00 0.00 4.00 2.00
AM3 AM4 4.60 91.00 15.00 0.00 2.50 1.50 2.50
AM4 AM5 7.80 39.00 -16.00 3.00 1.00 3.00 0.00
AM5 AM6 6.90 135.00 -21.50 0.50 4.00 2.00 -9999.00
AM6 AM7 17.60 127.00 11.50 0.00 6.00 1.50 3.00
AM7 AM8 14.55 198.50 11.50 1.50 2.50 4.00 -9999.00
AM8 AM9 10.90 192.00 9.00 0.00 5.00 5.00 2.00
AM9 AM10 8.10 208.50 -25.00 0.00 4.00 4.00 3.00
AM10 AM11 17.10 273.00 -16.50 -9999.00 4.00 5.00 4.00
AM10 AL1 17.05 122.00 0.00 -9999.00 4.00 5.00 4.00
Fulford Cave
SURVEY NAME: CD
SURVEY DATE: 8 28 1988 COMMENT:Upper Level
SURVEY TEAM:
Steve Reames,Garry Petrie,Ted Lappin,Brent Hymel,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
AM7 CD1 30.00 15.20 -56.00 1.50 2.50 4.00 -9999.00
CD1 AD1 6.75 343.50 -34.00 5.00 12.00 3.00 0.00
AD1 AD2 21.40 274.00 -43.00 5.00 14.00 3.00 0.50
XA6 AD2 7.75 287.00 17.00 -9999.00 -9999.00 -9999.00 -9999.00
CD1 CD2 12.30 107.00 49.00 5.00 12.30 3.00 0.00
CD2 CD3 16.85 39.00 38.50 3.00 12.00 4.00 8.00
CD3 CD4 22.80 67.00 5.50 8.00 4.00 7.00 6.00
XC11 CD4 19.45 276.50 -6.00 -9999.00 -9999.00 -9999.00 -9999.00
Fulford Cave
SURVEY NAME: XS
SURVEY DATE: 8 28 1988 COMMENT:Entrance To Upper Entrance Connection
SURVEY TEAM:
Mike Roberts,Ken Kreager,Rick Rhinehart, ,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
A1 XS2 18.30 126.00 39.00 -9999.00 -9999.00 -9999.00 -9999.00 #|P#
XS2 S4 23.96 60.00 20.00 -9999.00 -9999.00 -9999.00 -9999.00 #|P#
S4 AM11 12.46 1.00 -35.00 -9999.00 -9999.00 -9999.00 -9999.00
Fulford Cave
SURVEY NAME: AL
SURVEY DATE: 8 28 1988 COMMENT:Upper Level Side Passage
SURVEY TEAM:
Mike Roberts,Ken Kreager,Rick Rhinehart, ,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
AL1 AL2 9.85 140.50 -1.50 2.00 6.00 0.00 9.00
AL2 AL3 21.85 186.50 3.50 4.00 8.00 3.50 4.00
AL3 AL4 13.40 156.00 27.50 3.50 2.50 0.50 2.00
AL4 AL4 0.00 0.00 0.00 2.00 1.00 3.00 0.00
Fulford Cave
SURVEY NAME: CC
SURVEY DATE: 10 8 1988 COMMENT:Attic, Stove Pipe, Two Level Room
SURVEY TEAM:
Bethany Jablonsky,Paul Burger,June Miller,Clarence Williams,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
CC1 C29 28.30 23.00 -2.50 19.60 6.00 2.00 4.00
CC1 CC2 39.45 119.00 35.00 19.60 6.00 2.00 4.00
CC2 CC3 8.60 151.00 8.00 5.50 4.00 4.00 2.00
CC3 CC4 6.00 161.00 22.00 0.20 0.50 0.00 0.00
CC4 CC5 5.70 205.00 21.00 0.20 0.50 0.00 0.20
CC5 CC6 3.40 142.00 18.00 0.20 2.00 2.00 0.20
CC6 CC7 4.90 237.00 -1.00 0.00 1.00 8.50 8.00
CC7 CC8 5.70 169.00 9.00 0.80 1.50 1.30 0.00
CC8 CC9 16.70 200.00 15.00 0.00 2.70 2.10 1.50
CC9 CC10 35.50 124.50 -17.00 0.10 3.00 7.50 1.00
CC10 CCCP1 19.70 163.00 24.00 16.00 7.60 0.50 -9999.00
CCCP1 CCCP2 9.70 171.00 54.00 3.20 2.80 1.00 1.50
CCCP2 CCCP3 11.20 246.00 22.50 0.00 2.50 1.40 2.00
CCCP3 ACCP3 12.50 134.00 -8.50 0.00 3.90 0.50 4.50
CCCP3 CCCP4 6.10 359.00 -16.00 -9999.00 -9999.00 -9999.00 -9999.00
CCCP4 CCCP5 6.70 0.00 -90.00 3.00 0.00 -9999.00 3.00
CCCP5 CCCP6 22.90 338.50 -36.00 -9999.00 -9999.00 -9999.00 -9999.00
CCCP6 CC10 12.90 69.00 8.50 -9999.00 -9999.00 -9999.00 -9999.00
CC10 CC11 16.90 266.00 -10.50 -9999.00 -9999.00 -9999.00 -9999.00
CC11 CC12 12.60 0.00 -90.00 -9999.00 11.00 -9999.00 -9999.00
CC12 CC13 16.40 186.00 -40.00 -9999.00 -9999.00 -9999.00 -9999.00
CC13 CC14 11.80 314.00 -11.00 6.50 7.30 0.50 -9999.00
CC14 CC15 23.00 0.00 -2.00 5.00 1.50 1.50 4.00
Fulford Cave
SURVEY NAME: CE
SURVEY DATE: 10 8 1988 COMMENT:Cathedral Room
SURVEY TEAM:
Steve Reames,Garry Petrie,Ted Lappin, ,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
C25 CE1 25.08 147.00 9.00 -9999.00 27.00 2.00 -9999.00
CE1 CE2 16.42 51.00 49.00 -9999.00 3.00 5.00 0.00
CE2 CE3 20.54 209.00 47.00 4.00 4.50 4.00 2.00
CE3 CE4 26.67 101.00 9.00 -9999.00 4.00 4.00 -9999.00
CE4 CE5 18.25 77.00 30.00 10.00 2.00 1.00 5.00
CE5 CE6 22.75 108.00 18.00 4.80 1.50 1.60 0.00
CE6 CE7 31.00 119.00 -18.00 5.00 15.00 0.00 7.00
CE7 CE8 14.67 319.00 -20.00 7.00 21.00 3.00 1.00
CE9 CE8 60.10 160.00 87.00 -9999.00 -9999.00 -9999.00 -9999.00
B14 CE9 20.80 14.00 12.50 -9999.00 -9999.00 -9999.00 -9999.00
Fulford Cave
SURVEY NAME: BS
SURVEY DATE: 2 11 1989 COMMENT:Upper Stream
SURVEY TEAM:
Steve Reames,Paul Burger,Stan Allison,Ted Lappin,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
BS1 B5 22.10 0.00 -39.00 -9999.00 8.00 6.00 -9999.00
BS2 BS1 15.85 134.00 -31.50 7.00 9.00 3.00 8.00
BS2 BS3 10.20 7.50 55.00 7.00 9.00 3.00 8.00
BS3 BS4 27.35 110.50 31.00 2.50 1.50 2.50 -9999.00
BS4 BSA1 17.30 142.00 -1.50 -9999.00 4.00 2.00 -9999.00
BS4 BS5 2.10 91.00 -27.00 -9999.00 4.00 2.00 -9999.00
BS5 BS6 7.70 0.00 90.00 -9999.00 9.50 0.00 -9999.00
BS7 BS6 9.95 10.00 -52.50 4.00 0.50 3.00 1.00
BS7 BS8 19.80 242.50 37.00 4.00 0.50 3.00 1.00
BS8 C27 6.25 15.50 -1.00 5.00 3.00 0.00 -9999.00
BS7 BSB1 20.90 109.00 -9.50 4.00 0.50 3.00 1.00
BSB2 BSB1 21.75 325.00 -29.50 7.00 4.00 7.00 0.00
BSB2 XCE8 44.40 134.00 -27.00 7.00 4.00 7.00 0.00
BSA1 BSA2 22.05 159.00 -48.00 -9999.00 -9999.00 -9999.00 -9999.00
BSA2 BS1 37.85 307.00 -23.00 -9999.00 -9999.00 -9999.00 -9999.00
Fulford Cave
SURVEY NAME: CF
SURVEY DATE: 2 11 1989 COMMENT:Hidden Pit
SURVEY TEAM:
Steve Reames,Stan Allison,Ted Lappin,Paul Burger,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
C12 CF1 17.00 311.00 -18.00 0.00 8.00 2.00 12.00
CF1 CF2 7.10 353.00 -19.00 3.00 1.50 1.00 4.00
CF2 CF3 10.60 7.00 2.00 2.00 1.00 2.50 0.00
CF3 CF4 15.80 356.00 -66.00 2.00 -9999.00 -9999.00 2.00
CF5 CF4 22.50 111.00 54.50 4.00 4.00 1.00 2.00
A7 CF5 3.40 270.00 24.00 -9999.00 -9999.00 -9999.00 -9999.00
Fulford Cave
SURVEY NAME: CG
SURVEY DATE: 2 11 1989 COMMENT:Moon Milk Side Passage
SURVEY TEAM:
Steve Reames,Stan Allison,Ted Lappin,Paul Burger,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
C15 CG1 23.10 169.00 -2.00 -9999.00 -9999.00 -9999.00 -9999.00
CG1 CG2 28.00 194.00 -4.00 6.00 6.00 5.00 2.50
CG2 CG3 20.90 164.00 2.00 3.00 2.00 1.50 9.00
Fulford Cave
SURVEY NAME: CH
SURVEY DATE: 2 12 1989 COMMENT:Devils Washboard Connection
SURVEY TEAM:
Steve Reames,Stan Allison,Paul Burger,Ted Lappin,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
C6 CH1 37.50 172.00 32.00 30.00 0.00 5.50 7.00
CH1 CH2 21.25 82.00 31.00 -9999.00 8.00 4.00 -9999.00
CH2 CH3 25.10 144.00 20.00 -9999.00 -9999.00 -9999.00 -9999.00
CH3 CH4 11.30 137.00 49.00 18.00 6.00 4.00 5.00
CH4 CH5 12.15 172.00 34.00 4.00 3.00 5.00 2.50
CH6 CH5 8.60 9.00 -4.00 -9999.00 19.00 3.00 10.00
CH6 C25 21.25 194.00 -16.00 -9999.00 19.00 3.00 10.00
Fulford Cave
SURVEY NAME: AAA
SURVEY DATE: 6 10 1989 COMMENT:Lower Room +
SURVEY TEAM:
Steve Reames,Paul Burger,Stan Allison,Dave Fazzina,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
AA7 AAA1 29.50 224.00 17.50 20.00 25.00 0.00 20.00
AAA1 AAA2 8.50 205.50 1.50 4.50 3.00 4.00 0.50
AAA2 AAA3 14.35 205.00 -49.50 2.00 0.00 -9999.00 1.00
AAA3 AAA4 25.15 125.00 -71.50 3.50 5.00 -9999.00 0.00
Fulford Cave
SURVEY NAME: AB
SURVEY DATE: 6 10 1989 COMMENT:JFK Room
SURVEY TEAM:
Steve Reames,Paul Burger,Stan Allison,Dave Fazzina,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
A13 AB1 26.40 164.50 22.50 6.90 6.00 2.00 4.00
AB1A AB1 15.60 179.50 -27.00 12.00 5.00 0.00 4.00
AB1A AB1B 14.30 11.00 18.00 5.00 8.00 5.00 0.00
AB1B AB1C 14.60 60.50 24.50 -9999.00 -9999.00 -9999.00 -9999.00
AB1C AB1D 12.95 354.00 21.00 -9999.00 -9999.00 -9999.00 -9999.00
AB1 AB2 16.55 121.00 40.00 -9999.00 -9999.00 -9999.00 -9999.00
AB2 AB3 17.00 208.00 8.50 0.00 10.00 7.00 5.00
AB3 AB4 4.00 253.00 -21.00 0.50 1.00 1.00 2.00
AB5 AB4 8.45 16.50 25.50 -9999.00 -9999.00 -9999.00 -9999.00
Fulford Cave
SURVEY NAME: AC
SURVEY DATE: 6 10 1989 COMMENT:Big Meander Side Passage
SURVEY TEAM:
Steve Reames,Paul Burger,Stan Allison,Dave Fazzina,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
A20 AC1 13.10 126.00 -8.50 -9999.00 -9999.00 -9999.00 -9999.00
AC1 AC2 33.70 27.50 5.00 -9999.00 -9999.00 -9999.00 -9999.00
AC2 AC3 20.95 342.00 -11.50 -9999.00 -9999.00 -9999.00 -9999.00
AC3 AC4 21.60 56.00 25.00 5.00 0.00 1.50 4.00
AC4 AC5 29.85 21.50 5.50 -9999.00 -9999.00 -9999.00 -9999.00
AC5 AC6 37.45 343.50 -15.50 -9999.00 -9999.00 -9999.00 -9999.00
AC6 AC7 40.90 18.00 12.00 -9999.00 -9999.00 -9999.00 -9999.00
Fulford Cave
SURVEY NAME: CJ
SURVEY DATE: 6 10 1989 COMMENT:Balconies
SURVEY TEAM:
Steve Reames,Paul Burger,Stan Allison,Dave Fazzina,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
C6 CJ1 27.20 110.00 28.50 30.00 0.00 5.50 7.00
CJ1 CJ2 41.15 152.50 34.50 -9999.00 -9999.00 -9999.00 -9999.00
CJ2 CJ3 14.40 137.00 -42.50 -9999.00 -9999.00 -9999.00 -9999.00
CJ3 CJ4 26.75 73.50 -43.50 -9999.00 -9999.00 -9999.00 -9999.00
CJ4 CJ5 6.80 268.00 -22.50 -9999.00 -9999.00 -9999.00 -9999.00
CJ5 CJ6 36.50 151.00 -10.00 -9999.00 -9999.00 -9999.00 -9999.00
B5 CJ6 26.85 124.00 26.00 -9999.00 -9999.00 -9999.00 -9999.00
Fulford Cave
SURVEY NAME: CK
SURVEY DATE: 6 10 1989 COMMENT:Hidden Room
SURVEY TEAM:
Steve Reames,Paul Burger,Stan Allison,Dave Fazzina,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
C28 CK1 39.80 40.00 20.00 -9999.00 -9999.00 -9999.00 -9999.00
CK1 CK2 15.30 334.00 -1.50 -9999.00 -9999.00 -9999.00 -9999.00
Fulford Cave
SURVEY NAME: CL
SURVEY DATE: 6 10 1989 COMMENT:Moon Milk Side Passage
SURVEY TEAM:
Steve Reames,Paul Burger,Stan Allison,Dave Fazzina,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
CA3 CL1 16.25 93.00 31.50 -9999.00 -9999.00 -9999.00 -9999.00
CL1 CL2 12.70 199.00 0.00 -9999.00 -9999.00 -9999.00 -9999.00
CL2 CL3 15.45 138.50 0.00 -9999.00 -9999.00 -9999.00 -9999.00
CL3 CL4 14.75 163.50 21.50 -9999.00 -9999.00 -9999.00 -9999.00
CL4 C15 12.50 217.50 8.00 -9999.00 -9999.00 -9999.00 -9999.00

File diff suppressed because it is too large Load Diff
+18
View File
@@ -0,0 +1,18 @@
@357715.717,5627162.426,3048.000,13,1.050;
&North American 1983;
!gAVotScxpl;
/
$13;
&North American 1983;
*0.00;
#FULSURF.DAT,
A1[f,1173607.995,14346579.967,10000.000],
SC3[f,1173537.730,14346710.958,9938.648],
S4[f,1173638.451,14346578.084,10020.013],
SS6[f,1173818.570,14346406.496,10018.701];
/
*0.00;
#FULFORD.DAT;

+68
View File
@@ -0,0 +1,68 @@
Fulford Cave
SURVEY NAME: SS
SURVEY DATE: 8 28 1988 COMMENT:Surface to shelter
SURVEY TEAM:
Mike Roberts,Ken Kreager,Rick Rhinehart, ,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
A1 SS1 62.45 104.00 34.50 -9999.00 -9999.00 -9999.00 -9999.00 #|P#
SS1 SS2 35.35 120.50 22.00 -9999.00 -9999.00 -9999.00 -9999.00 #|P#
SS2 SS3 25.35 150.50 10.50 -9999.00 -9999.00 -9999.00 -9999.00 #|P#
SS3 SS4 67.20 117.00 29.50 -9999.00 -9999.00 -9999.00 -9999.00 #|P#
SS4 SS5 60.10 123.50 16.00 -9999.00 -9999.00 -9999.00 -9999.00 #|P#
SS5 SS6 54.50 112.00 11.00 -9999.00 -9999.00 -9999.00 -9999.00 #|P#
SS6 SS7 36.30 89.00 21.00 -9999.00 -9999.00 -9999.00 -9999.00
SS6 SS8 41.70 333.50 -2.50 -9999.00 -9999.00 -9999.00 -9999.00
Fulford Cave
SURVEY NAME: SC
SURVEY DATE: 8 28 1988 COMMENT:Surface to Centipede
SURVEY TEAM:
Paul Burger,Fred Luiszer, , ,
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
SC1 A1 14.63 93.00 1.00 -9999.00 -9999.00 -9999.00 -9999.00 #|P#
SC1 SC2 55.94 332.00 -23.00 -9999.00 -9999.00 -9999.00 -9999.00 #|P#
SC2 SC3 96.56 321.00 -24.00 -9999.00 -9999.00 -9999.00 -9999.00 #|P#
SC3 Z1 13.19 9.00 -37.00 -9999.00 -9999.00 -9999.00 -9999.00
Z1 ZZZ1 1.00 0.00 0.00 -9999.00 -9999.00 -9999.00 -9999.00
CENTIPEDE
SURVEY NAME: Z
SURVEY DATE: 8 28 1988 COMMENT:Centipede
SURVEY TEAM:
F.LUISZER,P.BURGER
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
Z1 Z2 2.17 138.00 -43.00 0.00 0.00 2.50 3.00
Z2 Z3 7.58 87.00 27.00 2.00 0.00 1.00 1.00
Z3 Z3A 4.02 22.00 -4.00 0.00 1.00 4.00 0.00
Z3A Z3B 16.50 31.00 0.00 1.00 1.50 2.00 3.00
Z3 Z4 9.38 126.00 -53.00 0.00 1.00 4.00 0.00
Z4 Z5 9.00 33.00 -44.00 2.00 1.50 0.50 1.50
CENTIPEDE
SURVEY NAME: Z+
SURVEY DATE: 8 27 1989 COMMENT:Centiipede +
SURVEY TEAM:
F.LUISZER,T.LAPPIN,P.BURGER
DECLINATION: 11.18 FORMAT: DDDDUDLRLADN CORRECTIONS: 0.00 0.00 0.00
FROM TO LENGTH BEARING INC LEFT UP DOWN RIGHT FLAGS COMMENTS
Z5 Z6 9.40 114.00 -40.00 1.00 1.00 1.00 1.00
Z6 Z7 6.32 43.00 3.00 1.50 0.50 2.50 0.00
Z7 Z8 3.35 9.45 27.00 0.00 3.00 1.00 3.00
Z8 Z9 7.90 16.00 20.50 3.50 2.00 5.00 1.00
Z6 Z10 11.50 242.00 -28.00 1.50 1.00 0.50 0.50
Z10 Z11 5.45 46.00 -31.00 1.50 1.00 2.50 3.00
Z11 Z12 10.52 337.00 -37.00 2.50 0.50 2.50 1.50
Z12 Z13 6.05 320.00 -2.00 0.50 4.00 0.50 1.50

File diff suppressed because it is too large Load Diff
-993
View File
@@ -1,993 +0,0 @@
"""
#############################################################################################
# #
# Script pour automatiser la création des dossiers et fichiers pour un fichier .th #
# #
# By Alexandre PONT (alexandre_pont@yahoo.fr) #
# #
# Définir les différentes variables dans fichier config.ini #
# Création des dossiers nécessaires d'après dossier 'template' #
# Création des fichiers nécessaires : th, th2, -tot.th #
# Création des scrap avec stations topo #
# #
# usage : python pyCreate_th2.py #
# #
#############################################################################################
Création Alex the 2024 12 16 :
Thank's too
- Tanguy Racine for the script https://github.com/tr1813
- Xavier Robert for the main principes https://github.com/robertxa
- Benoit Urruty https://github.com/BenoitURRUTY
Version 2025 03 21 : Création mode --update th2
"""
Version ="2025.03.21"
#################################################################################################
#################################################################################################
import os
from os.path import isfile, join, abspath
import sys
import re
import unicodedata
import argparse
import shutil
from datetime import datetime
import configparser
import tkinter as tk
from tkinter import filedialog
from helpers.survey import SurveyLoader, NoSurveysFoundException
from helpers.therion import compile_template, Colors, compile_file
#################################################################################################
## [Survey_Data] default values
Author = "Created by pyCreate_th2.py"
Copyright = "# Copyright (C) pyCreate_th2.py"
Copyright_Short = "Licence (C) pyCreate_th2.py"
map_comment = "Created by pyCreate_th2.py"
cs = "UTM30"
club = "Therion"
thanksto = "Therion"
datat = "https://therion.speleo.sk/"
wpage = "https://therion.speleo.sk/"
## [Application_data] default values
template_path = "./template"
station_by_scrap = 20
final_therion_exe = True
therion_path = "C:/Therion/therion.exe"
LINES = -1
NAMES = -1
#################################################################################################
# # Codes de couleur ANSI
# class Colors:
# BLACK = '\033[90m'
# RED = '\033[91m'
# GREEN = '\033[92m'
# YELLOW = '\033[93m'
# BLUE = '\033[94m'
# MAGENTA = '\033[95m'
# CYAN = '\033[96m'
# WHITE = '\033[97m'
# ERROR = '\033[91m'
# WARNING = '\033[95m'
# HEADER = '\033[96m'
# ENDC = '\033[0m'
# BOLD = '\033[1m'
# UNDERLINE = '\033[4m'
#################################################################################################
def sanitize_filename(th_name):
"""
Cleans a string to make it compatible with filenames on Windows, Linux, and macOS.
Replaces special and accented characters with compatible characters.
Args:
th_name (str): The filename to clean.
Returns:
str: The cleaned and compatible string.
"""
# Unicode normalization to replace accented characters with their non-accented equivalents
th_name = unicodedata.normalize('NFKD', th_name).encode('ASCII', 'ignore').decode('ASCII')
# Replace illegal characters with an underscore (_)
th_name = re.sub(r'[<>:"/\\|?*\']', '_', th_name) # Characters not allowed on Windows
th_name = re.sub(r'[\s]', '_', th_name) # Replace spaces with underscores
th_name = re.sub(r'[^a-zA-Z0-9._-]', '_', th_name) # Keep letters, digits, . _ -
# Ensure the name is not empty or just underscores
return th_name.strip('_') or "default_filename"
#################################################################################################
def colored_help(parser):
# Captures the help output
help_text = parser.format_help()
# Coloration des différentes parties
colored_help_text = help_text.replace(
'usage:', f'{Colors.ERROR}usage:{Colors.ENDC}'
).replace(
'options:', f'{Colors.GREEN}options:{Colors.ENDC}'
).replace('positional arguments:', f'{Colors.BLUE}positional arguments:{Colors.ENDC}')
# Surligner les arguments
for action in parser._actions:
if action.option_strings:
# Colorer les options (--xyz)
for opt in action.option_strings:
colored_help_text = colored_help_text.replace(opt, f'{Colors.BLUE}{opt}{Colors.ENDC}')
# Imprimer le texte coloré
print(colored_help_text)
sys.exit(0)
#################################################################################################
def read_config(config_file):
global Author
global Copyright
global Copyright_Short
global map_comment
global club
global thanksto
global datat
global wpage
global cs
global template_path
global station_by_scrap
global final_therion_exe
global therion_path
global LINES
global NAMES
# Initialize the configparser to read .ini files
config = configparser.ConfigParser()
config.read(config_file, encoding="utf-8")
if 'Survey_Data' in config and 'Author' in config['Survey_Data']:
Author = config['Survey_Data']['Author']
if 'Survey_Data' in config and 'Copyright1' in config['Survey_Data']:
Copyright = config['Survey_Data']['Copyright1'] + "\n" + config['Survey_Data']['Copyright2'] + "\n" + config['Survey_Data']['Copyright3'] + "\n"
if 'Survey_Data' in config and 'Copyright_Short' in config['Survey_Data']:
Copyright_Short = config['Survey_Data']['Copyright_Short']
if 'Survey_Data' in config and 'map_comment' in config['Survey_Data']:
map_comment = config['Survey_Data']['map_comment']
if 'Survey_Data' in config and 'club' in config['Survey_Data']:
club = config['Survey_Data']['club']
if 'Survey_Data' in config and 'thanksto' in config['Survey_Data']:
thanksto = config['Survey_Data']['thanksto']
if 'Survey_Data' in config and 'datat' in config['Survey_Data']:
datat = config['Survey_Data']['datat']
if 'Survey_Data' in config and 'wpage' in config['Survey_Data']:
wpage = config['Survey_Data']['wpage']
if 'Survey_Data' in config and 'cs' in config['Survey_Data']:
cs = config['Survey_Data']['cs']
if 'Application_Data' in config and 'template_path' in config['Application_Data']:
template_path = config['Application_Data']['template_path']
if 'Application_Data' in config and 'station_by_scrap' in config['Application_Data']:
station_by_scrap = int(config['Application_Data']['station_by_scrap'])
if 'Application_Data' in config and 'final_therion_exe' in config['Application_Data']:
final_therion_exe = bool(config['Application_Data']['final_therion_exe'])
if 'Application_Data' in config and 'therion_path' in config['Application_Data']:
therion_path = config['Application_Data']['therion_path']
if LINES == -1 :
if 'Application_Data' in config and 'shot_lines_in_th2_files' in config['Application_Data']:
LINES = 0 if config['Application_Data']['shot_lines_in_th2_files'] == "False" else 1
if NAMES == -1 :
if 'Application_Data' in config and 'station_name_in_th2_files' in config['Application_Data']:
NAMES = 0 if config['Application_Data']['station_name_in_th2_files'] == "False" else 1
#################################################################################################
def copy_template_if_not_exists(template_path, destination_path):
# Check if the destination folder exists
try:
if not os.path.exists(destination_path):
# If the destination folder does not exist, copy the template
shutil.copytree(template_path, destination_path)
print(f"{Colors.GREEN}The folder '{Colors.GREEN}{template_path}{Colors.ENDC}' has been copied to '{Colors.ENDC}{destination_path}{Colors.GREEN}'{Colors.ENDC}")
else:
print(f"{Colors.WARNING}Warning: The folder '{Colors.ENDC}{destination_path}{Colors.WARNING}' already exists. No files were copied.{Colors.ENDC}")
except Exception as e:
print(f"{Colors.ERROR}Copy template error: {Colors.ENDC}{e}")
exit(1)
#################################################################################################
def add_copyright_header(file_path, copyright_text):
# Lire le contenu du fichier
with open(file_path, 'r') as file:
content = file.readlines()
# Vérifier si le copyright est déjà présent
if not any("copyright" in line.lower() for line in content):
# Ajouter le copyright en en-tête
content.insert(0, f"{copyright_text}\n")
# Réécrire le fichier avec le copyright ajouté
with open(file_path, 'w') as file:
file.writelines(content)
#################################################################################################
def copy_file_with_copyright(th_file, destination_path, copyright_text):
# Vérifier si le fichier existe
if os.path.exists(th_file):
# Créer le dossier de destination s'il n'existe pas
os.makedirs(destination_path, exist_ok=True)
# Copier le fichier vers le dossier de destination
dest_file = os.path.join(destination_path, os.path.basename(th_file))
shutil.copy(th_file, dest_file)
# Ajouter le copyright dans l'en-tête si nécessaire
add_copyright_header(dest_file, copyright_text)
# print(f"{Colors.GREEN}File '{Colors.ENDC}{th_file}{Colors.GREEN}' has been copied to '{Colors.ENDC}{destination_path}{Colors.GREEN}' with the copyright header added.{Colors.ENDC}")
else:
print(f"{Colors.ERROR}Error: The file .th does not exist {Colors.ENDC}{th_file}")
#################################################################################################
def process_template(template_path, variables, output_path):
"""
Process a Therion template file by replacing variables.
Args:
template_path (str): Path to the original template file
variables (dict): Dictionary of variables to replace
output_path (str): Path for the new configuration file
"""
try:
# Read the content of the template file
with open(template_path, 'r', encoding='utf-8') as file:
content = file.read()
# Replace variables
for var, value in variables.items():
# Use regex to replace {variable} with its value
pattern = r'\{' + re.escape(var) + r'\}'
content = re.sub(pattern, str(value), content)
# Write the new file
with open(output_path, 'w', encoding='utf-8') as file:
file.write(content)
print(f"{Colors.GREEN}Update template successfully: {Colors.ENDC}{output_path}")
# Delete the original template file
os.remove(template_path)
except FileNotFoundError:
print(f"{Colors.WARNING}Warning: Template file {Colors.ENDC}{template_path}{Colors.WARNING} not found.{Colors.ENDC}")
except PermissionError:
print(f"{Colors.ERROR}Error: Insufficient permissions to write the file.{Colors.ENDC}")
except Exception as e:
print(f"{Colors.ERROR}An error occurred: {Colors.ENDC}{e}")
#################################################################################################
def parse_therion_surveys(file_path):
"""
Reads a Therion file and extracts survey names.
Args:
file_path (str): Path to the Therion file to parse
Returns:
list: List of survey names
"""
survey_names = []
try:
with open(file_path, 'r', encoding='utf-8') as file:
# Read all lines from the file
lines = file.readlines()
for line in lines:
# Look for lines starting with survey
line = line.strip()
if line.startswith('survey ') and ' -title ' in line:
# Split the line and extract the survey name
start_index = line.find('survey ') + len('survey ')
end_index = line.find(' -title ')
survey_name = line[start_index:end_index].strip()
survey_names.append(survey_name)
except FileNotFoundError:
print(f"{Colors.WARNING}Warning: File {Colors.ENDC}{file_path}{Colors.WARNING} not found.{Colors.ENDC}")
except PermissionError:
print(f"{Colors.ERROR}Error: Insufficient permissions to read {Colors.ENDC}{file_path}")
except Exception as e:
print(f"{Colors.ERROR}An error occurred: {Colors.ENDC}{e}")
return survey_names
#################################################################################################
def str_to_bool(value):
"""
Function to convert string to boolean
"""
if isinstance(value, bool):
return value
if value.lower() in ('true', '1', 'yes', 'y'):
return True
elif value.lower() in ('false', '0', 'no', 'n'):
return False
else:
raise argparse.ArgumentTypeError(f"{Colors.ERROR}Error: Invalid boolean value: {Colors.ENDC}{value}")
#################################################################################################
def select_file():
# Créer une instance de la fenêtre tkinter
root = tk.Tk()
# Cacher la fenêtre principale
root.withdraw()
# Afficher la boîte de dialogue de sélection de fichier
file_path = filedialog.askopenfilename(title="Sélectionnez un fichier")
# Retourner le chemin complet du fichier sélectionné
return file_path
#################################################################################################
# main function #
#################################################################################################
if __name__ == u'__main__':
#################################################################################################
# Parse arguments #
#################################################################################################
parser = argparse.ArgumentParser(
description=f"{Colors.HEADER}Create a skeleton folder and th2 files with scraps from a .th Therion file\nVersion: {Colors.ENDC}{Version}\n",
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.print_help = colored_help.__get__(parser)
parser.add_argument("--survey_file", help="The survey file (*.th) to perform e.g. './Therion_file.th'", default="")
parser.add_argument("--survey_name", help="Scrap name (if different from 'survey_file' name)", default="None")
#parser.add_argument("--proj", choices=['plan', 'elevation', 'extended', 'none'], help="The scrap projection to produce", default="plan")
#parser.add_argument("--format", choices=['th2', 'plt'], help="Output format. Either th2 for producing skeleton for drawing or plt for visualizing in aven/loch", default="th2")
parser.add_argument("--output", default="./", help="Output folder path")
# parser.add_argument("--therion-path", help="Path to therion binary", default="therion")
parser.add_argument("--scale", help="Scale for the exports", default="500")
parser.add_argument("--lines", type=str_to_bool, help="Shot lines in th2 files", default=-1)
parser.add_argument("--names", type=str_to_bool, help="Stations names in th2 files", default=-1)
parser.add_argument("--update", help="Mode update, option th2", default="")
parser.epilog = (
f"{Colors.GREEN}Please, complete {Colors.RED}config.ini{Colors.GREEN} file for personal configuration{Colors.ENDC}\n"
f"{Colors.GREEN}If no argument :{Colors.RED} files selection windows\n{Colors.ENDC}\n"
f"{Colors.BLUE}Examples:{Colors.ENDC}\n"
f"\t> python pyCreate_th2.py ./test/Entree.th --survey_name Geophysicaya_01_entree --output ./test/ --scale 1000\n"
f"\t> python pyCreate_th2.py Entree.th\n"
f"\t> python pyCreate_th2.py\n\n")
args = parser.parse_args()
# print("args.survey_file : " + args.survey_file )
# print("args.update : " + args.update )
if args.survey_file == "":
args.survey_file = select_file()
print(f"Selected file : {args.survey_file}")
ENTRY_FILE = abspath(args.survey_file)
# PROJECTION = args.proj.capitalize()
PROJECTION = "Plan"
TARGET = args.survey_name
OUTPUT = args.output
#FORMAT = args.format
FORMAT = "th2"
SCALE = args.scale
LINES = args.lines
NAMES = args.names
# TH_NAME = args.survey_file.split("/")[-1].strip(".th")
TH_NAME = sanitize_filename(os.path.splitext(os.path.basename(args.survey_file))[0])
DEST_PATH = os.path.dirname(args.survey_file) + "/" + TH_NAME
#DEST_PATH = args.output + TH_NAME.split("/")[-1].strip(".th")
#ABS_PATH = ENTRY_FILE.strip(args.survey_file)
ABS_PATH = os.path.dirname(ENTRY_FILE)
# print("args.survey_file : " + args.survey_file )
# print("ENTRY_FILE: " + ENTRY_FILE )
# print("PROJECTION: " + PROJECTION )
# print("TARGET: " + TARGET )
# print("OUTPUT: " + OUTPUT )
# print("FORMAT: " + FORMAT )
# print("SCALE: " + SCALE )
# print("TH_NAME: " + TH_NAME )
# print("DEST_PATH: " + DEST_PATH )
# print("ABS_PATH: " + ABS_PATH )
#################################################################################################
# Reading config.ini #
#################################################################################################
try:
# Load the 'database' section from the configuration file
read_config("config.ini")
# print("Auteur: " + Author)
# print(f"Copyright: \n{Copyright}")
except ValueError as e:
# Handle errors if the section is missing
print(f"{Colors.ERROR}Error: read_config:{Colors.ERROR}", e)
if PROJECTION.lower() != "plan" :
print(f"{Colors.ERROR}Error: Sorry, projection '{Colors.ENDC}{PROJECTION}{Colors.ERROR}' not yet implemented{Colors.ENDC}")
exit(1)
if not os.path.isfile(ENTRY_FILE):
print(f"{Colors.ERROR}Error: The Therion file didn't exist: {Colors.ENDC} {ENTRY_FILE}")
exit(1)
if FORMAT not in ["th2", "plt"]:
print(f"{Colors.ERROR}Error: Please choose a supported format: th2, plt{Colors.ENDC}")
exit(1)
# Normalise name, namespace, key, file path
print(f"{Colors.GREEN}Parsing survey entry file:\t{Colors.ENDC} {args.survey_file}")
survey_list = parse_therion_surveys(ENTRY_FILE)
# print(survey_list)
if TARGET == "None" :
if len(survey_list) > 1 :
print(f"{Colors.ERROR}Error: Multiple surveys were found, not yet implemented{Colors.ENDC}")
exit(1)
TARGET = sanitize_filename(survey_list[0])
print(f"{Colors.GREEN}Parsing survey target: \t{Colors.ENDC} {TARGET}")
loader = SurveyLoader(ENTRY_FILE)
survey = loader.get_survey_by_id(survey_list[0])
# print(survey.name)
if not survey:
raise NoSurveysFoundException(f"{Colors.ERROR}Error: No survey found with that selector{Colors.ENDC}")
if args.update == "th2":
print(f"{Colors.GREEN} Update th2 files {Colors.ENDC}")
print(f"\t{Colors.BLUE}survey_file : {Colors.ENDC} {args.survey_file}")
print(f"\t{Colors.BLUE}ENTRY_FILE: {Colors.ENDC} {ENTRY_FILE}")
print(f"\t{Colors.BLUE}PROJECTION: {Colors.ENDC} {PROJECTION}")
print(f"\t{Colors.BLUE}TARGET: {Colors.ENDC} {TARGET}")
print(f"\t{Colors.BLUE}OUTPUT: {Colors.ENDC} {OUTPUT}")
print(f"\t{Colors.BLUE}FORMAT: {Colors.ENDC} {FORMAT}")
print(f"\t{Colors.BLUE}SCALE: {Colors.ENDC} {SCALE}")
print(f"\t{Colors.BLUE}TH_NAME: {Colors.ENDC} {TH_NAME}")
DEST_PATH = os.path.dirname(args.survey_file)
print(f"\t{Colors.BLUE}DEST_PATH: {Colors.ENDC} {DEST_PATH}")
print(f"\t{Colors.BLUE}ABS_PATH: {Colors.ENDC} {ABS_PATH}")
#################################################################################################
# Copy template folders #
#################################################################################################
if args.update == "":
# print(f"{Colors.GREEN}Copy template folder and adapte it{Colors.ENDC}")
copy_template_if_not_exists(template_path, DEST_PATH)
copy_file_with_copyright(ENTRY_FILE, DEST_PATH + "/Data", Copyright)
# Adapte templates
config_vars = {
'fileName': TH_NAME,
'cavename': TH_NAME.replace("_", " "),
'Author': Author,
'Copyright': Copyright,
'Scale' : SCALE,
'Target' : TARGET,
'map_comment' : map_comment,
'club' : club,
'thanksto' : thanksto.replace("_", r"\_"),
'datat' : datat.replace("_", r"\_"),
'wpage' : wpage.replace("_", r"\_"),
'cs' : cs,
'other_scraps_plan' : "",
'file_info' : f'# File generated by pyCreate_th2.py (version {Version}) date: {datetime.now().strftime("%Y.%m.%d %H:%M:%S")}',
}
process_template(DEST_PATH + '/template.thconfig', config_vars, DEST_PATH + '/' + TH_NAME + '.thconfig')
process_template(DEST_PATH + '/template-tot.th', config_vars, DEST_PATH + '/' + TH_NAME + '-tot.th')
process_template(DEST_PATH + '/template-readme.md', config_vars, DEST_PATH + '/readme.md')
#################################################################################################
# Produce the parsable XVI file #
#################################################################################################
print(f"{Colors.GREEN}Compiling 2D XVI file: \t{Colors.ENDC} {TH_NAME}")
template = """source "{th_file}"
layout minimal
scale 1 {scale}
endlayout
select {selector}
export model -o "{th_name}.lox"
export map -projection plan -o "{th_name}-Plan.xvi" -layout minimal -layout-debug station-names
export map -projection extended -o "{th_name}-Extended.xvi" -layout minimal -layout-debug station-names
"""
if args.update == "th2":
template_args = {
"th_file": DEST_PATH + "/" + TH_NAME + ".th",
"selector": survey.therion_id,
"th_name": DEST_PATH + "/" + TH_NAME,
"scale": SCALE,
}
else :
template_args = {
"th_file": DEST_PATH + "/Data/" + TH_NAME + ".th",
"selector": survey.therion_id,
"th_name": DEST_PATH + "/Data/" + TH_NAME,
"scale": SCALE,
}
log, tmpdir = compile_template(template, template_args, cleanup=False, therion_path=therion_path)
#################################################################################################
# Parse the Plan XVI file #
#################################################################################################
if args.update == "th2":
th_name_xvi = DEST_PATH + "/" + TH_NAME + "-Plan.xvi"
else :
th_name_xvi = DEST_PATH + "/Data/" + TH_NAME + "-Plan.xvi"
print(f"{Colors.GREEN}Parsing plan XVI file:\t{Colors.ENDC}{th_name_xvi}")
stations = {}
lines = []
with open(join(th_name_xvi), "r", encoding="utf-8") as f:
xvi_content = f.read()
xvi_stations, xvi_shots = xvi_content.split("XVIshots")
# Extract all the stations
for line in xvi_stations.split("\n"):
match = re.search(r"{\s*(-?\d+\.\d+)\s*(-?\d+\.\d+)\s([^@]+)(?:@([^\s}]*))?\s*}", line)
if match:
x = match.groups()[0]
y = match.groups()[1]
station_number = match.groups()[2]
namespace = match.groups()[3]
namespace_array = namespace.split(".") if namespace else []
station = station_number
if len(namespace_array) > 1:
station = "{}@{}".format(station_number, ".".join(namespace_array[0:-1]))
stations["{}.{}".format(x, y)] = [x, y, station]
# Extraire les valeurs x et y à partir des listes dans stations
x_values = [float(value[0]) for value in stations.values()]
y_values = [float(value[1]) for value in stations.values()]
# Trouver les min et max de x
x_min = float(min(x_values))
x_max = float(max(x_values))
# Trouver les min et max de y
y_min = float(min(y_values))
y_max = float(max(y_values))
x_ecart = x_max - x_min
y_ecart = y_max - y_min
# Afficher les résultats
# print("x_min:", x_min, "x_max:", x_max)
# print("y_min:", y_min, "y_max:", y_max)
# print("Écart max-min pour x:", x_ecart)
# print("Écart max-min pour y:", y_ecart)
# Extract all the lines
for line in xvi_shots.split("\n"):
match = re.search(r"^\s*{\s*(-?\d+\.\d+)\s*(-?\d+\.\d+)\s*(-?\d+\.\d+)\s*(-?\d+\.\d+)\s*.*}", line )
if match:
x1 = match.groups()[0]
y1 = match.groups()[1]
x2 = match.groups()[2]
y2 = match.groups()[3]
key1 = "{}.{}".format(x1, y1)
key2 = "{}.{}".format(x2, y2)
# Splays won't have stations
station1 = stations[key1][2] if key1 in stations else None
station2 = stations[key2][2] if key2 in stations else None
lines.append([x1, y1, x2, y2, station1, station2])
# shutil.rmtree(tmpdir)
if args.update == "th2":
th2_name = DEST_PATH + "/" + TH_NAME
else :
th2_name = DEST_PATH + "/Data/" + TH_NAME
output_path = f'{th2_name}-{PROJECTION}.{FORMAT}'
scrap_to_add = int(len(stations)/station_by_scrap)-1
# print(stations)
print(f"{Colors.GREEN}Writing output to:\t{Colors.ENDC}{output_path}")
# Write TH2
if FORMAT == "th2":
th2_file_header = """encoding utf-8"""
th2_file = """
##XTHERION## xth_me_area_adjust {X_Min} {Y_Min} {X_Max} {Y_Max}
##XTHERION## xth_me_area_zoom_to 100
##XTHERION## xth_me_image_insert {insert_XVI}
{Copyright}
# File generated by pyCreate_th2.py version {version} date: {date}
# x_min: {X_Min}, x_max: {X_Max} ecart : {X_Max_X_Min}
# y_min: {Y_Min}, y_max: {Y_Max} ecart : {Y_Max_Y_Min}
scrap S{projection_short}-{name}_01 -station-names "" "@{name}" -projection {projection} -author {year} "{author}" -copyright {year} "{Copyright_Short}"
{points}
{names}
{lines}
endscrap"""
th2_point = """ point {x} {y} station -name {station}"""
th2_name = """ point {x} {y} station-name -align tr -scale xs -text {station}"""
th2_line = """ line u:Shot_Survey
{x1} {y1}
{x2} {y2}
endline"""
seen = set()
th2_lines = []
th2_points = []
th2_names = []
other_scraps_plan = ""
for line in lines:
th2_lines.append(th2_line.format(x1=line[0], y1=line[1], x2=line[2], y2=line[3]))
coords1 = "{}.{}".format(line[0], line[1])
if coords1 not in seen:
seen.add(coords1)
th2_points.append(th2_point.format(x=line[0], y=line[1], station=line[4]))
th2_names.append(th2_name.format(x=line[0], y=line[1], station=line[4]))
coords2 = "{}.{}".format(line[2], line[3])
if "{}.{}".format(line[2], line[3]) not in seen:
seen.add(coords2)
if line[5] != None:
th2_points.append(th2_point.format(x=line[2], y=line[3], station=line[5]))
th2_names.append(th2_name.format(x=line[2], y=line[3], station=line[5]))
if isfile(output_path):
print(f"{Colors.WARNING}Warning: {Colors.ENDC}{os.path.basename(output_path)}{Colors.WARNING} file already exists - nothing done{Colors.ENDC}")
else :
name = TARGET,
# print(f"{Colors.GREEN}Therion output path :\t{Colors.ENDC}{output_path}")
with open(str(output_path), "w+") as f:
f.write(th2_file_header)
f.write(th2_file.format(
name = name[0],
Copyright = Copyright,
Copyright_Short = Copyright_Short,
points="\n".join(th2_points),
lines="\n".join(th2_lines) if LINES else "",
names="\n".join(th2_names) if NAMES else "",
projection=PROJECTION.lower(),
projection_short=PROJECTION[0].upper(),
author=Author,
year=datetime.now().year,
version = Version,
date=datetime.now().strftime("%Y.%m.%d-%H:%M:%S"),
X_Min=x_min*1.2,
X_Max=x_max*1.2,
Y_Min=y_min*1.2,
Y_Max=y_max*1.2,
X_Max_X_Min =x_ecart,
Y_Max_Y_Min =y_ecart,
insert_XVI = "{" + stations[next(iter(stations))][0] + "1 1.0} {"
+ stations[next(iter(stations))][1] + " "
+ stations[next(iter(stations))][2] +"} "
+ os.path.basename(th_name_xvi) + " 0 {}",
)
)
if scrap_to_add >= 1 :
for i in range(scrap_to_add):
other_scraps_plan = other_scraps_plan + f"\tbreak\n\tS{PROJECTION[0].upper()}-{name[0]}_{i+2:02}\n"
th2_scrap = """
scrap S{projection_short}-{name}_{num:02} -station-names "" "@{name}" -projection {projection} -author {year} "{author}" -copyright {year} "{Copyright_Short}"
endscrap
"""
f.write(th2_scrap.format(
name=name[0],
projection=PROJECTION.lower(),
projection_short=PROJECTION[0].upper(),
author=Author,
year=datetime.now().year,
Copyright_Short = Copyright_Short,
num=f"{i+2:02}",
)
)
#################################################################################################
# Parse the Extended XVI file #
#################################################################################################
if args.update == "th2":
th_name_xvi = DEST_PATH + "/" + TH_NAME + "-Extended.xvi"
else :
th_name_xvi = DEST_PATH + "/Data/" + TH_NAME + "-Extended.xvi"
print(f"{Colors.GREEN}Parsing extended XVI file:\t{Colors.ENDC}{th_name_xvi}")
# Parse the Extended XVI file
stations = {}
lines = []
with open(join(th_name_xvi), "r", encoding="utf-8") as f:
xvi_content = f.read()
xvi_stations, xvi_shots = xvi_content.split("XVIshots")
# Extract all the stations
for line in xvi_stations.split("\n"):
match = re.search(r"{\s*(-?\d+\.\d+)\s*(-?\d+\.\d+)\s([^@]+)(?:@([^\s}]*))?\s*}", line)
if match:
x = match.groups()[0]
y = match.groups()[1]
station_number = match.groups()[2]
namespace = match.groups()[3]
namespace_array = namespace.split(".") if namespace else []
station = station_number
if len(namespace_array) > 1:
station = "{}@{}".format(station_number, ".".join(namespace_array[0:-1]))
stations["{}.{}".format(x, y)] = [x, y, station]
# Extraire les valeurs x et y à partir des listes dans stations
x_values = [float(value[0]) for value in stations.values()]
y_values = [float(value[1]) for value in stations.values()]
# Trouver les min et max de x
x_min = float(min(x_values))
x_max = float(max(x_values))
# Trouver les min et max de y
y_min = float(min(y_values))
y_max = float(max(y_values))
x_ecart = x_max - x_min
y_ecart = y_max - y_min
# Afficher les résultats
# print("x_min:", x_min, "x_max:", x_max)
# print("y_min:", y_min, "y_max:", y_max)
# print("Écart max-min pour x:", x_ecart)
# print("Écart max-min pour y:", y_ecart)
# Extract all the lines
for line in xvi_shots.split("\n"):
match = re.search(r"^\s*{\s*(-?\d+\.\d+)\s*(-?\d+\.\d+)\s*(-?\d+\.\d+)\s*(-?\d+\.\d+)\s*.*}", line )
if match:
x1 = match.groups()[0]
y1 = match.groups()[1]
x2 = match.groups()[2]
y2 = match.groups()[3]
key1 = "{}.{}".format(x1, y1)
key2 = "{}.{}".format(x2, y2)
# Splays won't have stations
station1 = stations[key1][2] if key1 in stations else None
station2 = stations[key2][2] if key2 in stations else None
lines.append([x1, y1, x2, y2, station1, station2])
shutil.rmtree(tmpdir)
if args.update == "th2":
th2_name = DEST_PATH + "/" + TH_NAME
else :
th2_name = DEST_PATH + "/Data/" + TH_NAME
output_path = f'{th2_name}-Extended.{FORMAT}'
print(f"{Colors.GREEN}Writing output to:\t\t{Colors.ENDC}{output_path}")
# Write TH2
if FORMAT == "th2":
th2_file_header = """encoding utf-8"""
th2_file = """
##XTHERION## xth_me_area_adjust {X_Min} {Y_Min} {X_Max} {Y_Max}
##XTHERION## xth_me_area_zoom_to 100
##XTHERION## xth_me_image_insert {insert_XVI}
{Copyright}
# File generated by pyCreate_th2.py version {version} date: {date}
# x_min: {X_Min}, x_max: {X_Max} ecart : {X_Max_X_Min}
# y_min: {Y_Min}, y_max: {Y_Max} ecart : {Y_Max_Y_Min}
scrap SC-{name}_01 -station-names "" "@{name}" -projection extended -author {year} "{author}" -copyright {year} "{Copyright_Short}"
{points}
{names}
{lines}
endscrap"""
th2_point = """ point {x} {y} station -name {station}"""
th2_name = """ point {x} {y} station-name -align tr -scale xs -text {station}"""
th2_line = """ line u:Shot_Survey
{x1} {y1}
{x2} {y2}
endline
"""
seen = set()
th2_lines = []
th2_points = []
th2_names = []
other_scraps_extended = ""
for line in lines:
th2_lines.append(th2_line.format(x1=line[0], y1=line[1], x2=line[2], y2=line[3]))
coords1 = "{}.{}".format(line[0], line[1])
if coords1 not in seen:
seen.add(coords1)
th2_points.append(th2_point.format(x=line[0], y=line[1], station=line[4]))
th2_names.append(th2_name.format(x=line[0], y=line[1], station=line[4]))
coords2 = "{}.{}".format(line[2], line[3])
if "{}.{}".format(line[2], line[3]) not in seen:
seen.add(coords2)
if line[5] != None:
th2_points.append(th2_point.format(x=line[2], y=line[3], station=line[5]))
th2_names.append(th2_name.format(x=line[2], y=line[3], station=line[5]))
if isfile(output_path):
print(f"{Colors.WARNING}Warning: {Colors.ENDC}{os.path.basename(output_path)}{Colors.WARNING} file already exists - nothing done{Colors.ENDC}")
else :
name = TARGET,
# print(f"{Colors.GREEN}Therion output path :\t{Colors.ENDC}{output_path}")
with open(str(output_path), "w+") as f:
f.write(th2_file_header)
f.write(th2_file.format(
name = name[0],
Copyright = Copyright,
Copyright_Short = Copyright_Short,
points="\n".join(th2_points),
lines="\n".join(th2_lines) if LINES else "",
names="\n".join(th2_names) if NAMES else "",
projection="extended",
projection_short="C",
author=Author,
year=datetime.now().year,
version = Version,
date=datetime.now().strftime("%Y.%m.%d-%H:%M:%S"),
X_Min=x_min*1.2,
X_Max=x_max*1.2,
Y_Min=y_min*1.2,
Y_Max=y_max*1.2,
X_Max_X_Min =x_ecart,
Y_Max_Y_Min =y_ecart,
insert_XVI = "{" + stations[next(iter(stations))][0] + "1 1.0} {"
+ stations[next(iter(stations))][1] + " "
+ stations[next(iter(stations))][2] +"} "
+ os.path.basename(th_name_xvi) + " 0 {}",
)
)
if scrap_to_add >= 1 :
for i in range(scrap_to_add):
other_scraps_extended = other_scraps_extended + f"\tbreak\n\tSC-{name[0]}_{i+2:02}\n"
th2_scrap = """
scrap SC-{name}_{num:02} -station-names "" "@{name}" -projection extended -author {year} "{author}" -copyright {year} "{Copyright_Short}"
endscrap
"""
f.write(th2_scrap.format(
name=name[0],
author=Author,
Copyright_Short = Copyright_Short,
year=datetime.now().year,
num=f"{i+2:02}",
)
)
#################################################################################################
# Update -maps files #
#################################################################################################
if args.update == "":
config_vars = {
'fileName': TH_NAME,
'Author': Author,
'Copyright': Copyright,
'Scale' : SCALE,
'Target' : TARGET,
'map_comment' : map_comment,
'club' : club,
'thanksto' : thanksto,
'datat' : datat,
'wpage' : wpage,
'cs' : cs,
'other_scraps_plan' : other_scraps_plan,
'other_scraps_extended' : other_scraps_extended,
'file_info' : f"# File generated by pyCreate_th2.py version {Version} date: {datetime.now().strftime("%Y.%m.%d-%H:%M:%S")}",
}
process_template(DEST_PATH + '/template-maps.th', config_vars, DEST_PATH + '/' + TH_NAME + '-maps.th')
#################################################################################################
# Final therion compilation #
#################################################################################################
if args.update == "":
if final_therion_exe == True:
print(f"{Colors.GREEN}Final therion compilation{Colors.ENDC}")
PATH = os.path.dirname(args.survey_file) + "/" + TH_NAME + "/" + TH_NAME + ".thconfig"
compile_file(PATH, therion_path=therion_path)