diff --git a/SVGs/Omniflo/.specstory/.gitignore b/SVGs/Omniflo/.specstory/.gitignore new file mode 100644 index 0000000..53b537f --- /dev/null +++ b/SVGs/Omniflo/.specstory/.gitignore @@ -0,0 +1,2 @@ +# SpecStory explanation file +/.what-is-this.md diff --git a/SVGs/Omniflo/.vscode/launch.json b/SVGs/Omniflo/.vscode/launch.json new file mode 100644 index 0000000..cbddc10 --- /dev/null +++ b/SVGs/Omniflo/.vscode/launch.json @@ -0,0 +1,37 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Python Debugger: Current File", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal" + }, + { + "name": "Python-Debugger: Aktuelle Datei mit Argumenten", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "args": "${command:pickArgs}" + }, + { + "name": "Python: Aktuelle Datei", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal" + }, + { + "name": "optimize weichen", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "args": [ + "--weichen" + ] + } + ] +} \ No newline at end of file diff --git a/SVGs/Omniflo/bin/01_svg_optimze.bat b/SVGs/Omniflo/bin/01_svg_optimze.bat new file mode 100644 index 0000000..29726d5 --- /dev/null +++ b/SVGs/Omniflo/bin/01_svg_optimze.bat @@ -0,0 +1,25 @@ +@echo off +call setenv.bat +setlocal + + +:: Check if Python is available +where python >nul 2>&1 +if %ERRORLEVEL% neq 0 ( + echo Error: Python is not found in your PATH + pause + exit /b 1 +) + +:: Run the Python script +echo Running SVG optimizer... +python %RD_CONF_LIB%\3_svg_optimizer-Step1.py %* + +:: Check if Python script succeeded +if %ERRORLEVEL% equ 0 ( + echo SVG optimization completed successfully +) else ( + echo SVG optimization failed with error %ERRORLEVEL% +) + +pause \ No newline at end of file diff --git a/SVGs/Omniflo/bin/setenv.bat b/SVGs/Omniflo/bin/setenv.bat new file mode 100644 index 0000000..c466dfc --- /dev/null +++ b/SVGs/Omniflo/bin/setenv.bat @@ -0,0 +1,19 @@ +@echo off +REM ~dp0 steht für das Verzeichnis, in der diese Datei liegt +pushd %~dp0\.. + +set RD_CONF=%cd% +set RD_CONF_BIN=%RD_CONF%\bin +set RD_CONF_WORK=%RD_CONF%\work +set RD_CONF_LIB=%RD_CONF%\lib + +set RD_CONF_BOGEN=%RD_CONF%\Bogen +set RD_CONF_TEFBOGEN=%RD_CONF%\TEFBogen +set RD_CONF_WEICHEN=%RD_CONF%\Weichen +set RD_CONF_TEFWEICHEN=%RD_CONF%\TEFWeichen + + +set PATH=%RD_CONF_BIN%;%PATH% + +popd +goto :eof \ No newline at end of file diff --git a/SVGs/Omniflo/lib/3_svg_optimizer-Step1.py b/SVGs/Omniflo/lib/3_svg_optimizer-Step1.py new file mode 100644 index 0000000..b22aded --- /dev/null +++ b/SVGs/Omniflo/lib/3_svg_optimizer-Step1.py @@ -0,0 +1,332 @@ + + +import os +import re +import xml.etree.ElementTree as ET +from xml.dom import minidom +import argparse + +def analyze_and_normalize_path(d, path_type, path_id=""): + """Strictly normalize path direction and generate detailed report""" + original_d = d + report = [] + normalized = [] + changed = False + + # Ensure path starts with M command + if not d.strip().startswith('M'): + d = 'M' + d[1:] if d.startswith('L') else 'M ' + d + report.append(" Fix: Added M command at path start") + changed = True + + # Parse path commands + commands = [] + current_cmd = None + for token in re.split('([A-Za-z])', d): + if not token: + continue + if token in 'MLAZHVCSQTa-z': + current_cmd = token + else: + if current_cmd: + commands.append((current_cmd, token.strip())) + + prev_x, prev_y = None, None + + for cmd, params in commands: + params = [float(p) for p in re.split('[, ]+', params.strip()) if p] + + if cmd == 'M': + if len(params) >= 2: + x, y = params[0], params[1] + normalized.append(f"M {x} {y}") + prev_x, prev_y = x, y + continue + + if path_type == 'Line segment' and cmd == 'L': + if len(params) >= 2 and prev_x is not None: + x, y = params[0], params[1] + need_swap = x < prev_x or (x == prev_x and y < prev_y) + + if need_swap: + new_segment = [f"M {x} {y}", f"L {prev_x} {prev_y}"] + report.append(f" Need to swap start/end → New path: {' '.join(new_segment)}") + normalized = new_segment + changed = True + else: + normalized.append(f"L {x} {y}") + report.append(" Path direction already correct, no changes made") + + prev_x, prev_y = x, y + continue + + if path_type == 'Arc' and cmd == 'A': + if len(params) >= 7 and prev_x is not None: + rx, ry, xrot, large, sweep, x, y = params[0], params[1], params[2], int(params[3]), int(params[4]), params[5], params[6] + + # Force left-to-right clockwise + need_swap = x < prev_x + new_sweep = 1 + + if need_swap: + new_segment = [f"M {x} {y}", f"A {rx} {ry} {xrot} {large} {new_sweep} {prev_x} {prev_y}"] + report.append(f" Need to swap start/end → New path: {' '.join(new_segment)}") + normalized = new_segment + changed = True + else: + if sweep != new_sweep: + new_segment = [f"A {rx} {ry} {xrot} {large} {new_sweep} {x} {y}"] + report.append(f" Need to adjust sweep to 1 → New path: {' '.join(new_segment)}") + normalized.extend(new_segment) + changed = True + else: + normalized.append(f"A {rx} {ry} {xrot} {large} {sweep} {x} {y}") + report.append(" Arc direction already correct, no changes made") + + prev_x, prev_y = x, y + continue + + normalized.append(f"{cmd} {' '.join(map(str, params))}") + + new_d = ' '.join(normalized) + report_header = f"[{path_id}-Analysis] Type: {path_type}" + full_report = [report_header, f"Original path: {original_d}"] + report + + if changed: + full_report.append(f"Modified path: {new_d}") + else: + full_report.append("Path not modified") + + return new_d, '\n'.join(full_report) + +def optimize_svg(input_path, output_path): + """Process single SVG file with all optimizations""" + try: + # Register namespace + ET.register_namespace('', 'http://www.w3.org/2000/svg') + + # Parse SVG file + tree = ET.parse(input_path) + root = tree.getroot() + + print(f"\nProcessing file: {os.path.basename(input_path)}") + print("="*60) + + # Create parent map + parent_map = {c: p for p in tree.iter() for c in p} + + # 1. Remove xlink namespace + for attr in list(root.attrib): + if 'xlink' in attr: + del root.attrib[attr] + + # 2. Set standard dimensions + root.set('width', '1e3') + root.set('height', '1e3') + root.set('viewBox', '0 0 1e3 1e3') + + # 3. Remove all clipPath definitions and references + defs = root.find('{http://www.w3.org/2000/svg}defs') + if defs is not None: + clip_paths = defs.findall('{http://www.w3.org/2000/svg}clipPath') + for cp in clip_paths: + defs.remove(cp) + if len(defs) == 0: + root.remove(defs) + + # 4. Remove clip-path attributes + for elem in tree.iter(): + if 'clip-path' in elem.attrib: + del elem.attrib['clip-path'] + + # 5. Force square line caps + for g in root.findall('.//{http://www.w3.org/2000/svg}g'): + g.set('stroke-linecap', 'square') + + # 6. Remove dashed line styles + for elem in tree.iter(): + if 'stroke-dasharray' in elem.attrib: + del elem.attrib['stroke-dasharray'] + + # 7. Completely remove empty groups + removed_groups = True + while removed_groups: + removed_groups = False + for g in root.findall('.//{http://www.w3.org/2000/svg}g'): + is_empty = ( + len(g) == 0 and + not (g.text or '').strip() and + not (g.tail or '').strip() and + all(not k.startswith('{') for k in g.attrib)) + if is_empty: + parent = parent_map.get(g) + if parent is not None: + parent.remove(g) + removed_groups = True + parent_map = {c: p for p in tree.iter() for c in p} + + # 8. Convert polylines to paths + for polyline in root.findall('.//{http://www.w3.org/2000/svg}polyline'): + points = polyline.get('points', '').strip() + if points: + coords = [p for p in re.split(r'[\s,]', points) if p] + path_data = [] + for i in range(0, len(coords), 2): + if i == 0: + path_data.append(f"M {coords[i]} {coords[i+1]}") + else: + path_data.append(f"L {coords[i]} {coords[i+1]}") + + path = ET.Element('{http://www.w3.org/2000/svg}path') + new_d, analysis_report = analyze_and_normalize_path( + ' '.join(path_data), + 'Line segment', + "Polyline conversion" + ) + path.set('d', new_d) + print(f"\n[Polyline conversion analysis]\n{analysis_report}") + + for attr, value in polyline.attrib.items(): + if attr not in ('points', 'stroke-dasharray'): + path.set(attr, value) + + parent = parent_map.get(polyline) + if parent is not None: + parent.remove(polyline) + parent.append(path) + + # 9. Normalize path directions (final step) + group_num = 0 + for g in root.findall('.//{http://www.w3.org/2000/svg}g'): + group_num += 1 + path_num = 0 + group_report = [] + + for path in g.findall('.//{http://www.w3.org/2000/svg}path'): + path_num += 1 + if 'd' not in path.attrib: + continue + + # Auto-detect path type + path_type = 'Arc' if 'A' in path.get('d') else 'Line segment' + path_id = f"Group{group_num}-Path{path_num}" + + new_d, analysis_report = analyze_and_normalize_path( + path.get('d'), + path_type, + path_id + ) + + if new_d != path.get('d'): + path.set('d', new_d) + + group_report.append(analysis_report) + + # Print all path reports for current group + if group_report: + print(f"\n=== Group {group_num} Path Analysis ===") + print('\n\n'.join(group_report)) + + # 10. Update colors and line width + for elem in root.findall('.//*[@stroke]'): + stroke = elem.get('stroke', '').lower() + if stroke == '#0ff' or stroke == 'rgb(0,255,255)': + elem.set('stroke', '#ffe31b') + elif stroke == '#000' or stroke == 'rgb(255,0,0)'or stroke == 'rgb(0,0,0)': + elem.set('stroke', '#ec2525') + elem.set('stroke-width', '1') + + # Generate final XML + rough_string = ET.tostring(root, encoding='utf-8', xml_declaration=True) + rough_string = rough_string.replace(b'standalone="no"', b'') + + # Format output (remove empty lines) + reparsed = minidom.parseString(rough_string) + pretty_svg = reparsed.toprettyxml(indent=' ', encoding='utf-8') + pretty_svg = b'\n'.join( + line for line in pretty_svg.splitlines() + if line.strip() + ).replace(b'', b'') + + with open(output_path, 'wb') as f: + f.write(pretty_svg) + + print("\n" + "="*60) + return True + + except Exception as e: + print(f"\nProcessing error: {str(e)}") + print("="*60) + return False + +def batch_process_svgs(input_dir, output_dir): + + if not os.path.exists(output_dir): + os.makedirs(output_dir) + + success_count = 0 + failure_count = 0 + + for filename in os.listdir(input_dir): + if os.path.isdir(os.path.join(input_dir, filename)): + continue + if filename.lower().endswith('.svg') or '_new.svg' in filename.lower(): + input_path = os.path.join(input_dir, filename) + output_filename = filename.replace('_new.svg', '_optimized.svg') + output_path = os.path.join(output_dir, output_filename) + + if optimize_svg(input_path, output_path): + success_count += 1 + print(f"✓ Processed successfully: {filename} → {output_filename}") + else: + failure_count += 1 + print(f"✗ Processing failed: {filename}") + print("\n" + "="*60 + "\n") + + print("\nProcessing summary:") + print(f"Successfully processed: {success_count} files") + print(f"Failed to process: {failure_count} files") + +if __name__ == '__main__': + + parser = argparse.ArgumentParser(description='copies svg files from directory and optimizes them', prog='svg_optimizer') + parser.add_argument('-f', '--file', action='store', help='just optimize this file') + parser.add_argument('-i', '--inputdir', action='store', help='input directory for all svg files which should be rewritten. Mandatory argument') + parser.add_argument('-o', '--outputdir', action='store', help='output directory for all svg files which are writte new') + parser.add_argument('-c', '--console', action='store_true', help='put the result to console') + parser.add_argument( '--bogen', action='store_true', help='just optimize all "bogen"') + parser.add_argument( '--tefbogen', action='store_true', help='just optimize all "tefbogen"') + parser.add_argument( '--weichen', action='store_true', help='just optimize all "weichen"') + parser.add_argument( '--tefweichen', action='store_true', help='just optimize all "tefweichen"') + + + args = parser.parse_args() + in_dir = None + if args.bogen: + in_dir = os.environ.get('RD_CONF_BOGEN') + if args.tefbogen: + in_dir = os.environ.get('RD_CONF_TEFBOGEN') + if args.weichen: + in_dir = os.environ.get('RD_CONF_WEICHEN') + if args.tefweichen: + in_dir = os.environ.get('RD_CONF_TEFWEICHEN') + + out_dir = os.environ.get('RD_CONF_WORK') + + if args.outputdir: + out_dir = args.outputdir + + + if args.file: + filename = args.file + input_path = os.path.join(in_dir, filename) + if os.path.exists(input_path): + optimize_svg(input_path, out_dir) + else: + print(f"file {filename} does not exist") + + if in_dir: + """Batch process SVG files""" + batch_process_svgs(in_dir, out_dir) + else: + parser.print_help() \ No newline at end of file diff --git a/SVGs/Omniflo/lib/3_svg_scaler-Step2.py b/SVGs/Omniflo/lib/3_svg_scaler-Step2.py new file mode 100644 index 0000000..1810af5 --- /dev/null +++ b/SVGs/Omniflo/lib/3_svg_scaler-Step2.py @@ -0,0 +1,155 @@ +import os +import re +import xml.etree.ElementTree as ET +from typing import Tuple, List + +def parse_svg_path(d: str) -> List[Tuple[float, float]]: + """Extract all coordinates from SVG path data (including curve control points)""" + points = [] + commands = re.findall( + r'([MmLlCcQqAaHhVvZz])([^MmLlCcQqAaHhVvZz]*)', + d.strip().replace(',', ' ') + ) + current_pos = (0.0, 0.0) + + for cmd, args in commands: + args = list(map(float, re.findall(r'[-+]?\d*\.?\d+', args))) + if cmd in ('M', 'm', 'L', 'l'): # Move/line commands + for i in range(0, len(args), 2): + x, y = args[i], args[i+1] + if cmd.islower(): # Relative coordinates + x += current_pos[0] + y += current_pos[1] + points.append((x, y)) + current_pos = (x, y) + elif cmd in ('C', 'c'): # Cubic Bezier curves + for i in range(0, len(args), 6): + x1, y1, x2, y2, x, y = args[i:i+6] + if cmd.islower(): + x1 += current_pos[0]; y1 += current_pos[1] + x2 += current_pos[0]; y2 += current_pos[1] + x += current_pos[0]; y += current_pos[1] + points.extend([(x1, y1), (x2, y2), (x, y)]) + current_pos = (x, y) + elif cmd in ('A', 'a'): # Arc commands (start/end points only) + for i in range(0, len(args), 7): + x, y = args[i+5], args[i+6] + if cmd.islower(): + x += current_pos[0] + y += current_pos[1] + points.append((x, y)) + current_pos = (x, y) + return points + +def calculate_bounding_box(svg_file: str) -> Tuple[float, float, float, float]: + """Calculate true bounding box of all paths in SVG""" + tree = ET.parse(svg_file) + root = tree.getroot() + all_points = [] + + for path in root.findall('.//{http://www.w3.org/2000/svg}path'): + d = path.get('d', '') + all_points.extend(parse_svg_path(d)) + + if not all_points: + return (0, 0, 0, 0) + + x_min = min(p[0] for p in all_points) + x_max = max(p[0] for p in all_points) + y_min = min(p[1] for p in all_points) + y_max = max(p[1] for p in all_points) + return (x_min, y_min, x_max, y_max) + + +def normalize_stroke_widths2(root, scale): + """Normalize stroke widths to ensure consistent appearance after scaling""" + for elem in root.iter(): + if 'stroke-width' in elem.attrib: + # Remove existing stroke-width + del elem.attrib['stroke-width'] + # Apply scaled stroke width (e.g., 1px → 1/scale) + elem.set('stroke-width', f'{1/scale:.6f}mm') + +def apply_non_scaling_stroke(root): + """Ensure stroke widths don't scale with the SVG""" + for elem in root.iter(): + if 'stroke' in elem.attrib and elem.attrib['stroke'] != 'none': + elem.set('vector-effect', 'non-scaling-stroke') + +def scale_svg_file(input_path: str, output_path: str): + """Scale SVG file with consistent stroke widths""" + print(f"\nProcessing: {os.path.basename(input_path)}") + + tree = ET.parse(input_path) + root = tree.getroot() + + # Calculate original bounding box + x_min, y_min, x_max, y_max = calculate_bounding_box(input_path) + width = x_max - x_min + height = y_max - y_min + + print(f"Original bounding box: ({x_min:.3f}, {y_min:.3f}) to ({x_max:.3f}, {y_max:.3f})") + print(f"Original dimensions: {width:.3f} (w) × {height:.3f} (h)") + + + # Determine scaling base (larger dimension → 1000px) + if width > height: + scale = 1000.0 / width + new_width = 1000.0 + new_height = round(height * scale) + print(f"Scaling base: Width (larger dimension)") + else: + scale = 1000.0 / height + new_height = 1000.0 + new_width = round(width * scale,3) + print(f"Scaling base: Height (larger dimension)") + + print(f"Scale factor: {scale:.6f}") + print(f"New dimensions: {new_width:.3f}px × {new_height:.3f}px") + print(f"ViewBox: 0 0 {new_width:.3f} {new_height:.3f}") + normalize_stroke_widths2(root, scale) + apply_non_scaling_stroke(root) + # + # Update SVG attributes + root.set('viewBox', f'0 0 {new_width} {new_height}') + root.set('width', f'{new_width}') + root.set('height', f'{new_height}') + + # Apply translation and scaling + for g in root.findall('{http://www.w3.org/2000/svg}g'): + transform = g.get('transform', '') + new_transform = f'translate({-x_min*scale},{-y_min*scale}) scale({scale})' + if transform: + new_transform = f'{transform} {new_transform}' + g.set('transform', new_transform) + + # Save modified SVG + tree.write(output_path, encoding='utf-8', xml_declaration=True) + print(f"Finished processing: {os.path.basename(input_path)}") + +def batch_process_svg(input_dir: str, output_dir: str): + """Batch process SVG files in directory (non-recursive)""" + if not os.path.exists(output_dir): + os.makedirs(output_dir) + + svg_files = [ + f for f in os.listdir(input_dir) + if f.lower().endswith('.svg') and os.path.isfile(os.path.join(input_dir, f)) + ] + + if not svg_files: + print("No SVG files found in the input directory!") + return + + print(f"\nFound {len(svg_files)} SVG files to process") + for filename in svg_files: + input_path = os.path.join(input_dir, filename) + output_path = os.path.join(output_dir, filename) + scale_svg_file(input_path, output_path) + + print("\nAll files processed successfully!") + +if __name__ == '__main__': + input_dir = r'C:\Users\y.wang\Documents\SSG-Ruledesigner-Konfigurator\SVGs\Omniflo\TEFBogen\NewSVG' + output_dir = r'C:\Users\y.wang\Documents\SSG-Ruledesigner-Konfigurator\SVGs\Omniflo\TEFBogen\NewSVG\test' + batch_process_svg(input_dir, output_dir) diff --git a/SVGs/Omniflo/python/OFBogen/1_calculate_ture_width_and_height_dimensions_with_profile_width.py b/SVGs/Omniflo/python/OFBogen/1_calculate_ture_width_and_height_dimensions_with_profile_width.py index afcfe06..dc1e366 100644 --- a/SVGs/Omniflo/python/OFBogen/1_calculate_ture_width_and_height_dimensions_with_profile_width.py +++ b/SVGs/Omniflo/python/OFBogen/1_calculate_ture_width_and_height_dimensions_with_profile_width.py @@ -23,6 +23,7 @@ The script is designed to process SVG measurement data, perform geometric validations, and produce an enhanced dataset while providing thorough feedback about the processing results. ''' import json import math +import os def safe_float(value, default=0.0): """Safely convert value to float, return default if conversion fails""" @@ -145,7 +146,9 @@ def process_json_file(input_file, output_file): # Example usage if __name__ == "__main__": - input_filename = "1_SVGErfassung_updated_new_input.json" # Replace with your input filename - output_filename = "1_SVGErfassung_updated_new_output.json" # Replace with desired output filename + + json_path=os.environ.get("JSON_PATH","JSON") + input_filename = os.path.join(json_path,"1_SVGErfassung_updated_new_input.json") # Replace with your input filename + output_filename = os.path.join(json_path,"1_SVGErfassung_updated_new_output.json") # Replace with desired output filename process_json_file(input_filename, output_filename) \ No newline at end of file diff --git a/SVGs/Omniflo/python/OFBogen/2_calculations_to_standardize_the_dimensions_and_add_connection_points.py b/SVGs/Omniflo/python/OFBogen/2_calculations_to_standardize_the_dimensions_and_add_connection_points.py index 611ec31..9be9f5e 100644 --- a/SVGs/Omniflo/python/OFBogen/2_calculations_to_standardize_the_dimensions_and_add_connection_points.py +++ b/SVGs/Omniflo/python/OFBogen/2_calculations_to_standardize_the_dimensions_and_add_connection_points.py @@ -13,6 +13,7 @@ Maintains aspect ratio while standardizing dimensions ''' import json import math +import os def process_json_item(item): # Ensure all numeric fields are floats @@ -144,7 +145,7 @@ def process_json_file(input_file, output_file): with open(output_file, 'w', encoding='utf-8') as f: json.dump(processed_data, f, indent=4, ensure_ascii=False) - print(f"Processing complete. Results saved to {output_file}") + print(f"Processing for calculations to standardize the dimensions and add connection points completed. Results saved to {output_file}") # Print error reports if error_reports: @@ -168,8 +169,9 @@ def process_json_file(input_file, output_file): # Example usage if __name__ == "__main__": - input_filename = "1_SVGErfassung_updated_new_output.json" - output_filename = "2_calculated_px_cps_output.json" + json_path=os.environ.get("JSON_PATH","JSON") + input_filename = os.path.join(json_path,"1_SVGErfassung_updated_new_output.json") + output_filename =os.path.join(json_path,"2_calculated_px_cps_output.json") process_json_file(input_filename, output_filename) - process_json_file(input_filename, output_filename) \ No newline at end of file + \ No newline at end of file diff --git a/SVGs/Omniflo/python/OFBogen/3_update_dimensions_and_connection_points_in_props.py b/SVGs/Omniflo/python/OFBogen/3_update_dimensions_and_connection_points_in_props.py index df1bd36..49d346f 100644 --- a/SVGs/Omniflo/python/OFBogen/3_update_dimensions_and_connection_points_in_props.py +++ b/SVGs/Omniflo/python/OFBogen/3_update_dimensions_and_connection_points_in_props.py @@ -30,13 +30,21 @@ def process_files(json_file_path, txt_files_dir): # Create Sivasnr to JSON data mapping sivasnr_mapping = {item["Sivasnr"]: item for item in json_data} + # Initialize counters + total_files = 0 + processed_files = 0 + skipped_files = 0 + # Prepare report content report_content = [] report_content.append(f"Modification Report - {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}") + report_content.append(f"JSON Reference File: {json_file_path}") + report_content.append(f"TXT Files Directory: {txt_files_dir}") report_content.append("="*50 + "\n") # Process all TXT files for txt_file_path in glob.glob(os.path.join(txt_files_dir, '*.txt')): + total_files += 1 # Extract Sivasnr from filename sivasnr = os.path.splitext(os.path.basename(txt_file_path))[0] @@ -50,7 +58,7 @@ def process_files(json_file_path, txt_files_dir): # Prepare entry for this file file_entry = [] - file_entry.append(f"\nProcessing file: {txt_file_path}") + file_entry.append(f"\nProcessing file: {os.path.basename(txt_file_path)}") file_entry.append("="*50) # Record old values @@ -107,7 +115,8 @@ def process_files(json_file_path, txt_files_dir): file_entry.append(f" y: {change['y'][0]} → {change['y'][1]}") file_entry.append(f" direction: {change['direction'][0]} → {change['direction'][1]}") - file_entry.append(f"\nFile {txt_file_path} processed successfully") + processed_files += 1 + file_entry.append(f"\nFile processed successfully") file_entry.append("="*50) # Add this file's entry to main report @@ -116,19 +125,41 @@ def process_files(json_file_path, txt_files_dir): # Also print to console print("\n" + "\n".join(file_entry)) else: - print(f"\nSkipping file {txt_file_path} (no matching JSON data found)") + skipped_files += 1 - # Write the report file if any changes were made - if len(report_content) > 2: # More than just the header - with open(log_file_path, 'w', encoding='utf-8') as f: - f.write("\n".join(report_content)) - print(f"\nModification report saved to: {log_file_path}") - else: - print("\nNo files were modified - no report generated") + # Add processing statistics to report + report_content.append("\n" + "="*50) + report_content.append("Processing Statistics:") + report_content.append(f"Total TXT files found: {total_files}") + report_content.append(f"Total JSON records available: {len(json_data)}") + report_content.append(f"Successfully processed: {processed_files}") + report_content.append(f"Skipped files: {skipped_files}") + if total_files > 0: + success_rate = (processed_files / len(json_data)) * 100 + report_content.append(f"Success rate: {success_rate:.2f}%") + report_content.append("="*50) + + # Print statistics to console + print("\n" + "="*50) + print("Processing Statistics:") + print(f"Total TXT files found: {total_files}") + print(f"Total JSON records available: {len(json_data)}") + print(f"Successfully processed: {processed_files}") + print(f"Skipped files: {skipped_files}") + if total_files > 0: + success_rate = (processed_files / len(json_data)) * 100 + print(f"Success rate: {success_rate:.2f}%") + print("="*50 + "\n") + + # Write the report file + with open(log_file_path, 'w', encoding='utf-8') as f: + f.write("\n".join(report_content)) + print(f"Modification report saved to: {log_file_path}") # Example usage if __name__ == "__main__": - json_file_path = "2_calculated_px_cps_output.json" - txt_files_dir = "C:/Program Files/RuleDesigner/RDConfigurator Fusion/WebApi/Editor2D/SSG/shapes/props" + json_path = os.environ.get("JSON_PATH", "JSON") + json_file_path = os.path.join(json_path, "2_calculated_px_cps_output.json") + txt_files_dir = os.environ.get("PROPS_PATH", "props") process_files(json_file_path, txt_files_dir) - print("\nAll files processed!") \ No newline at end of file + print("\nProcessing complete!") \ No newline at end of file diff --git a/SVGs/Omniflo/python/OFBogen/4_OFBogen_SVG_XML_Modifier_Script.py b/SVGs/Omniflo/python/OFBogen/4_OFBogen_SVG_XML_Modifier_Script.py index 67121c5..7c03965 100644 --- a/SVGs/Omniflo/python/OFBogen/4_OFBogen_SVG_XML_Modifier_Script.py +++ b/SVGs/Omniflo/python/OFBogen/4_OFBogen_SVG_XML_Modifier_Script.py @@ -84,9 +84,9 @@ def main(): """ Main processing function """ - # Configure paths - json_file_path = r"C:\Users\y.wang\Documents\SSG-Ruledesigner-Konfigurator\SVGs\Omniflo\python\OFBogen\1_SVGErfassung_updated_new_input.json" - svg_folder_path = r"C:\Program Files\RuleDesigner\RDConfigurator Fusion\WebApi\Editor2D\SSG\shapes\svg" + json_path=os.environ.get("JSON_PATH","JSON") + json_file_path = os.path.join(json_path,"1_SVGErfassung_updated_new_output.json") + svg_folder_path = os.environ.get("XML_PATH","svg") try: # Read and parse JSON file diff --git a/SVGs/Omniflo/python/OFBogen/1_SVGErfassung_updated_new_input.json b/SVGs/Omniflo/python/OFBogen/json/1_SVGErfassung_updated_new_input.json similarity index 100% rename from SVGs/Omniflo/python/OFBogen/1_SVGErfassung_updated_new_input.json rename to SVGs/Omniflo/python/OFBogen/json/1_SVGErfassung_updated_new_input.json diff --git a/SVGs/Omniflo/python/OFBogen/1_SVGErfassung_updated_new_output.json b/SVGs/Omniflo/python/OFBogen/json/1_SVGErfassung_updated_new_output.json similarity index 100% rename from SVGs/Omniflo/python/OFBogen/1_SVGErfassung_updated_new_output.json rename to SVGs/Omniflo/python/OFBogen/json/1_SVGErfassung_updated_new_output.json diff --git a/SVGs/Omniflo/python/OFBogen/2_calculated_px_cps_output.json b/SVGs/Omniflo/python/OFBogen/json/2_calculated_px_cps_output.json similarity index 100% rename from SVGs/Omniflo/python/OFBogen/2_calculated_px_cps_output.json rename to SVGs/Omniflo/python/OFBogen/json/2_calculated_px_cps_output.json diff --git a/SVGs/Omniflo/python/OFBogen/run_Modify_color_in_XML.bat b/SVGs/Omniflo/python/OFBogen/run_Modify_color_in_XML.bat new file mode 100644 index 0000000..5a92918 --- /dev/null +++ b/SVGs/Omniflo/python/OFBogen/run_Modify_color_in_XML.bat @@ -0,0 +1,12 @@ +@echo off + +set OFBogen_PATH=%~dp0 + +set XML_PATH=C:\Program Files\RuleDesigner\RDConfigurator Fusion\WebApi\Editor2D\SSG\shapes\svg + +set JSON_PATH=%OFBogen_PATH%JSON + +python 4_OFBogen_SVG_XML_Modifier_Script.py + + +pause \ No newline at end of file diff --git a/SVGs/Omniflo/python/OFBogen/run_OFBogen.bat b/SVGs/Omniflo/python/OFBogen/run_OFBogen.bat new file mode 100644 index 0000000..d464d4c --- /dev/null +++ b/SVGs/Omniflo/python/OFBogen/run_OFBogen.bat @@ -0,0 +1,12 @@ +@echo off + +set OFBogen_PATH=%~dp0 +set PROPS_PATH=C:\Program Files\RuleDesigner\RDConfigurator Fusion\WebApi\Editor2D\SSG\shapes\props + +set JSON_PATH=%OFBogen_PATH%JSON + +python 1_calculate_ture_width_and_height_dimensions_with_profile_width.py +python 2_calculations_to_standardize_the_dimensions_and_add_connection_points.py +python 3_update_dimensions_and_connection_points_in_props.py + +pause \ No newline at end of file diff --git a/SVGs/Omniflo/python/OFWeiche/Delete.py b/SVGs/Omniflo/python/OFWeiche/Delete.py new file mode 100644 index 0000000..5ed6f18 --- /dev/null +++ b/SVGs/Omniflo/python/OFWeiche/Delete.py @@ -0,0 +1,17 @@ +import json + +# 1. 读取 JSON 文件 +with open("omniflo_weichen.json", "r", encoding="utf-8") as f: + data = json.load(f) # data 是一个列表(数组) + +# 2. 遍历并清理数据 +for item in data: + if isinstance(item, dict) and item.get("SivasnrTEF") is None: + item.pop("TEFWeiche_center_line_width_mm", None) # 安全删除,键不存在时不报错 + item.pop("TEFWeiche_center_line_height_mm", None) + item.pop("TEFWeiche_CP1_x_mm", None) # 安全删除,键不存在时不报错 + item.pop("TEFWeiche_CP1_y_mm", None) + +# 3. 保存修改后的 JSON +with open("omniflo_weichen.json", "w", encoding="utf-8") as f: + json.dump(data, f, indent=2, ensure_ascii=False) # 保持中文/特殊字符 \ No newline at end of file diff --git a/SVGs/Omniflo/python/OFWeiche/check_weichen_ohne_TEF.py b/SVGs/Omniflo/python/OFWeiche/check_weichen_ohne_TEF.py new file mode 100644 index 0000000..02c247c --- /dev/null +++ b/SVGs/Omniflo/python/OFWeiche/check_weichen_ohne_TEF.py @@ -0,0 +1,57 @@ +import json + +def check_null_fields_in_items_with_sivasnrtef_null(json_file_path): + try: + with open(json_file_path, 'r', encoding='utf-8') as file: + data = json.load(file) + except FileNotFoundError: + print(f"Error: The file '{json_file_path}' does not exist.") + return + except json.JSONDecodeError: + print(f"Error: The file '{json_file_path}' is not a valid JSON file.") + return + + if not isinstance(data, list): + print("Error: The JSON file should contain an array of objects.") + return + + items_with_sivasnrtef_null = [item for item in data if isinstance(item, dict) and item.get("SivasnrTEF") is None] + + if not items_with_sivasnrtef_null: + print("No items with 'SivasnrTEF': null found in the JSON file.") + return + + # 初始化统计计数器 + count_only_sivasnrtef_null = 0 + count_with_other_nulls = 0 + + print(f"Found {len(items_with_sivasnrtef_null)} item(s) with 'SivasnrTEF': null") + print("-" * 50) + + for idx, item in enumerate(items_with_sivasnrtef_null, 1): + null_fields = [key for key, value in item.items() if value is None and key != "SivasnrTEF"] + + # 打印关键识别信息 + sivasnr = item.get("Sivasnr", "Not found") + profil_typ = item.get("ProfilTyp", "Not found") + print(f"\nItem {idx}: Sivasnr='{sivasnr}', ProfilTyp='{profil_typ}'") + + if null_fields: + count_with_other_nulls += 1 + print(f" → Other null fields: {null_fields}") + print(" → Full item:", item) + else: + count_only_sivasnrtef_null += 1 + print(" → No other null fields found.") + + # 打印统计结果 + print("\n" + "="*50) + print("Statistics:") + print(f"- Items with ONLY 'SivasnrTEF' as null: {count_only_sivasnrtef_null}") + print(f"- Items with 'SivasnrTEF' AND other null fields: {count_with_other_nulls}") + print("="*50) + + +# Example usage: +json_file_path = "omniflo_weichen.json" # Replace with your JSON file path +check_null_fields_in_items_with_sivasnrtef_null(json_file_path) \ No newline at end of file diff --git a/SVGs/Omniflo/python/OFWeiche/omniflo_weichen.json b/SVGs/Omniflo/python/OFWeiche/omniflo_weichen.json new file mode 100644 index 0000000..69d3f13 --- /dev/null +++ b/SVGs/Omniflo/python/OFWeiche/omniflo_weichen.json @@ -0,0 +1,1700 @@ +[ + { + "Sivasnr": 834372001, + "ProfilTyp": "WEICHE S 45°-L-350/700, KPL. MIT M", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 350.129, + "OFWeiche_center_line_height_mm": 700.123, + "Objekte_width_mm": 386.007, + "Objekte_height_mm": 715.001, + "OFWeiche_CP1_x_mm": 365.007, + "OFWeiche_CP1_y_mm": 355.001, + "KurvenRichtung": 1, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 365.007, + "OFWeiche_CP2_y_mm": 715.001, + "OFWeiche_CP3_x_mm": 14.878, + "OFWeiche_CP3_y_mm": 14.878 + }, + { + "Sivasnr": 834372002, + "ProfilTyp": "WEICHE S 45°-L-350/700, KPL. MIT P", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 350.129, + "OFWeiche_center_line_height_mm": 700.123, + "Objekte_width_mm": 386.007, + "Objekte_height_mm": 715.001, + "OFWeiche_CP1_x_mm": 365.007, + "OFWeiche_CP1_y_mm": 355.001, + "KurvenRichtung": 1, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 365.007, + "OFWeiche_CP2_y_mm": 715.001, + "OFWeiche_CP3_x_mm": 14.878, + "OFWeiche_CP3_y_mm": 14.878 + }, + { + "Sivasnr": "834372002+0_BG090090", + "ProfilTyp": "WEICHE S 45°-L-350/700, KPL. MIT P mit TEF Innen", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 350, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 1, + "SivasnrTEF": "0_B10090+0_B10090" + }, + { + "Sivasnr": 834372004, + "ProfilTyp": "WEICHE S 45°-R-350/700, KPL. MIT M", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 350.129, + "OFWeiche_center_line_height_mm": 700.123, + "Objekte_width_mm": 386.007, + "Objekte_height_mm": 715.001, + "OFWeiche_CP1_x_mm": 21.0, + "OFWeiche_CP1_y_mm": 355.001, + "KurvenRichtung": 2, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.0, + "OFWeiche_CP2_y_mm": 715.001, + "OFWeiche_CP3_x_mm": 371.129, + "OFWeiche_CP3_y_mm": 14.878 + }, + { + "Sivasnr": 834372005, + "ProfilTyp": "WEICHE S 45°-R-350/700, KPL. MIT P", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 350.129, + "OFWeiche_center_line_height_mm": 700.123, + "Objekte_width_mm": 386.007, + "Objekte_height_mm": 715.001, + "OFWeiche_CP1_x_mm": 21.0, + "OFWeiche_CP1_y_mm": 355.001, + "KurvenRichtung": 2, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.0, + "OFWeiche_CP2_y_mm": 715.001, + "OFWeiche_CP3_x_mm": 371.129, + "OFWeiche_CP3_y_mm": 14.878 + }, + { + "Sivasnr": "834372005+0_BG090090", + "ProfilTyp": "WEICHE S 45°-R-350/700, KPL. MIT P mit TEF Innen", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 350, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 2, + "SivasnrTEF": "0_B10090+0_B10090" + }, + { + "Sivasnr": 834372007, + "ProfilTyp": "WEICHE S 45°-L-400/750, KPL. MIT M", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 400, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": 435.878, + "Objekte_height_mm": 764.878, + "OFWeiche_CP1_x_mm": 414.878, + "OFWeiche_CP1_y_mm": 404.878, + "KurvenRichtung": 1, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 414.878, + "OFWeiche_CP2_y_mm": 764.878, + "OFWeiche_CP3_x_mm": 14.878, + "OFWeiche_CP3_y_mm": 14.878 + }, + { + "Sivasnr": 834372008, + "ProfilTyp": "WEICHE S 45°-L-400/750, KPL. MIT P", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 400, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": 435.878, + "Objekte_height_mm": 764.878, + "OFWeiche_CP1_x_mm": 414.878, + "OFWeiche_CP1_y_mm": 404.878, + "KurvenRichtung": 1, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 414.878, + "OFWeiche_CP2_y_mm": 764.878, + "OFWeiche_CP3_x_mm": 14.878, + "OFWeiche_CP3_y_mm": 14.878 + }, + { + "Sivasnr": "834372008+0_BG190090", + "ProfilTyp": "WEICHE S 45°-L-400/750, KPL. MIT P mit TEF Ihnen", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 400, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 1, + "SivasnrTEF": "0_B10090+0_B10090" + }, + { + "Sivasnr": 834372010, + "ProfilTyp": "WEICHE S 45°-R-400/750, KPL. MIT M", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 400, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": 435.878, + "Objekte_height_mm": 764.878, + "OFWeiche_CP1_x_mm": 21.0, + "OFWeiche_CP1_y_mm": 404.878, + "KurvenRichtung": 2, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.0, + "OFWeiche_CP2_y_mm": 764.878, + "OFWeiche_CP3_x_mm": 421.0, + "OFWeiche_CP3_y_mm": 14.878 + }, + { + "Sivasnr": 834372011, + "ProfilTyp": "WEICHE S 45°-R-400/750, KPL. MIT P", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 400, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": 435.878, + "Objekte_height_mm": 764.878, + "OFWeiche_CP1_x_mm": 21.0, + "OFWeiche_CP1_y_mm": 404.878, + "KurvenRichtung": 2, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.0, + "OFWeiche_CP2_y_mm": 764.878, + "OFWeiche_CP3_x_mm": 421.0, + "OFWeiche_CP3_y_mm": 14.878 + }, + { + "Sivasnr": "834372011+0_BG190090", + "ProfilTyp": "WEICHE S 45°-R-400/750, KPL. MIT P mit TEF Ihnen", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 400, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 2, + "SivasnrTEF": "0_B10090+0_B10090" + }, + { + "Sivasnr": 834372021, + "ProfilTyp": "WEICHE S 90°-L-500/600, KPL. MIT M", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 500.23, + "OFWeiche_center_line_height_mm": 600.197, + "Objekte_width_mm": 521.23, + "Objekte_height_mm": 621.237, + "OFWeiche_CP1_x_mm": 521.27, + "OFWeiche_CP1_y_mm": 261.237, + "KurvenRichtung": 1, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 521.27, + "OFWeiche_CP2_y_mm": 621.237, + "OFWeiche_CP3_x_mm": 0.0, + "OFWeiche_CP3_y_mm": 21.04 + }, + { + "Sivasnr": 834372022, + "ProfilTyp": "WEICHE S 90°-L-500/600, KPL. MIT P", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 500.23, + "OFWeiche_center_line_height_mm": 600.197, + "Objekte_width_mm": 521.23, + "Objekte_height_mm": 621.237, + "OFWeiche_CP1_x_mm": 521.27, + "OFWeiche_CP1_y_mm": 261.237, + "KurvenRichtung": 1, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 521.27, + "OFWeiche_CP2_y_mm": 621.237, + "OFWeiche_CP3_x_mm": 0.0, + "OFWeiche_CP3_y_mm": 21.04 + }, + { + "Sivasnr": "834372022+0_BG081090", + "ProfilTyp": "WEICHE S 90°-L-500/600, KPL. MIT P mit TEF Innen", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 500, + "OFWeiche_center_line_height_mm": 600, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 1, + "SivasnrTEF": "0_B10081+0_B10090" + }, + { + "Sivasnr": 834372024, + "ProfilTyp": "WEICHE S 90°-R-500/600, KPL. MIT M", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 500.23, + "OFWeiche_center_line_height_mm": 600.197, + "Objekte_width_mm": 521.23, + "Objekte_height_mm": 621.237, + "OFWeiche_CP1_x_mm": 21.0, + "OFWeiche_CP1_y_mm": 261.237, + "KurvenRichtung": 2, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.0, + "OFWeiche_CP2_y_mm": 621.237, + "OFWeiche_CP3_x_mm": 521.23, + "OFWeiche_CP3_y_mm": 21.04 + }, + { + "Sivasnr": 834372025, + "ProfilTyp": "WEICHE S 90°-R-500/600, KPL. MIT P", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 500.23, + "OFWeiche_center_line_height_mm": 600.197, + "Objekte_width_mm": 521.23, + "Objekte_height_mm": 621.237, + "OFWeiche_CP1_x_mm": 21.0, + "OFWeiche_CP1_y_mm": 261.237, + "KurvenRichtung": 2, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.0, + "OFWeiche_CP2_y_mm": 621.237, + "OFWeiche_CP3_x_mm": 521.23, + "OFWeiche_CP3_y_mm": 21.04 + }, + { + "Sivasnr": "834372025+0_BG081090", + "ProfilTyp": "WEICHE S 90°-R-500/600, KPL. MIT P mit TEF Innen", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 500, + "OFWeiche_center_line_height_mm": 600, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 2, + "SivasnrTEF": "0_B10081+0_B10090" + }, + { + "Sivasnr": 834372027, + "ProfilTyp": "WEICHE S 90°-L-700/700, KPL. MIT M", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 700.374, + "OFWeiche_center_line_height_mm": 700.185, + "Objekte_width_mm": 721.374, + "Objekte_height_mm": 721.225, + "OFWeiche_CP1_x_mm": 721.414, + "OFWeiche_CP1_y_mm": 361.225, + "KurvenRichtung": 1, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 721.414, + "OFWeiche_CP2_y_mm": 721.225, + "OFWeiche_CP3_x_mm": 0.0, + "OFWeiche_CP3_y_mm": 21.04 + }, + { + "Sivasnr": 834372028, + "ProfilTyp": "WEICHE S 90°-L-700/700, KPL. MIT P", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 700.374, + "OFWeiche_center_line_height_mm": 700.185, + "Objekte_width_mm": 721.374, + "Objekte_height_mm": 721.225, + "OFWeiche_CP1_x_mm": 721.414, + "OFWeiche_CP1_y_mm": 361.225, + "KurvenRichtung": 1, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 721.414, + "OFWeiche_CP2_y_mm": 721.225, + "OFWeiche_CP3_x_mm": 0.0, + "OFWeiche_CP3_y_mm": 21.04 + }, + { + "Sivasnr": "834372028+0_BG080090", + "ProfilTyp": "WEICHE S 90°-L-700/700, KPL. MIT P mit TEF Innen", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 700, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 1, + "SivasnrTEF": "0_B10080+0_B10090" + }, + { + "Sivasnr": 834372030, + "ProfilTyp": "WEICHE S 90°-R-700/700, KPL. MIT M", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 700.374, + "OFWeiche_center_line_height_mm": 700.185, + "Objekte_width_mm": 721.374, + "Objekte_height_mm": 721.225, + "OFWeiche_CP1_x_mm": 21.0, + "OFWeiche_CP1_y_mm": 361.225, + "KurvenRichtung": 2, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.0, + "OFWeiche_CP2_y_mm": 721.225, + "OFWeiche_CP3_x_mm": 721.374, + "OFWeiche_CP3_y_mm": 21.04 + }, + { + "Sivasnr": 834372031, + "ProfilTyp": "WEICHE S 90°-R-700/700, KPL. MIT P", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 700.374, + "OFWeiche_center_line_height_mm": 700.185, + "Objekte_width_mm": 721.374, + "Objekte_height_mm": 721.225, + "OFWeiche_CP1_x_mm": 21.0, + "OFWeiche_CP1_y_mm": 361.225, + "KurvenRichtung": 2, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.0, + "OFWeiche_CP2_y_mm": 721.225, + "OFWeiche_CP3_x_mm": 721.374, + "OFWeiche_CP3_y_mm": 21.04 + }, + { + "Sivasnr": "834372031+0_BG080090", + "ProfilTyp": "WEICHE S 90°-R-700/700, KPL. MIT P mit TEF Innen", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 700, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 2, + "SivasnrTEF": "0_B10080+0_B10090" + }, + { + "Sivasnr": 834372047, + "ProfilTyp": "WEICHE S PARALLEL-L-200/750, KPL. MIT M", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 0, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 200.007, + "OFWeiche_center_line_height_mm": 749.8, + "Objekte_width_mm": 242.047, + "Objekte_height_mm": 749.8, + "OFWeiche_CP1_x_mm": 200.007, + "OFWeiche_CP1_y_mm": 389.8, + "KurvenRichtung": 1, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 200.007, + "OFWeiche_CP2_y_mm": 749.8, + "OFWeiche_CP3_x_mm": 21.04, + "OFWeiche_CP3_y_mm": 0.0 + }, + { + "Sivasnr": 834372048, + "ProfilTyp": "WEICHE S PARALLEL-L-200/750, KPL. MIT P", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 0, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 200.007, + "OFWeiche_center_line_height_mm": 749.8, + "Objekte_width_mm": 242.047, + "Objekte_height_mm": 749.8, + "OFWeiche_CP1_x_mm": 200.007, + "OFWeiche_CP1_y_mm": 389.8, + "KurvenRichtung": 1, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 200.007, + "OFWeiche_CP2_y_mm": 749.8, + "OFWeiche_CP3_x_mm": 21.04, + "OFWeiche_CP3_y_mm": 0.0 + }, + { + "Sivasnr": 834372050, + "ProfilTyp": "WEICHE S PARALLEL-R-200/750, KPL. MIT M", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 0, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 200.007, + "OFWeiche_center_line_height_mm": 749.8, + "Objekte_width_mm": 242.047, + "Objekte_height_mm": 749.8, + "OFWeiche_CP1_x_mm": 21.0, + "OFWeiche_CP1_y_mm": 389.8, + "KurvenRichtung": 2, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.0, + "OFWeiche_CP2_y_mm": 749.8, + "OFWeiche_CP3_x_mm": 221.007, + "OFWeiche_CP3_y_mm": 0.0 + }, + { + "Sivasnr": 834372051, + "ProfilTyp": "WEICHE S PARALLEL-R-200/750, KPL. MIT P", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 0, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 200.007, + "OFWeiche_center_line_height_mm": 749.8, + "Objekte_width_mm": 242.047, + "Objekte_height_mm": 749.8, + "OFWeiche_CP1_x_mm": 21.0, + "OFWeiche_CP1_y_mm": 389.8, + "KurvenRichtung": 2, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.0, + "OFWeiche_CP2_y_mm": 749.8, + "OFWeiche_CP3_x_mm": 221.007, + "OFWeiche_CP3_y_mm": 0.0 + }, + { + "Sivasnr": 834372100, + "ProfilTyp": "WEICHE S D 45°-350/700, KPL. MIT M", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 700.258, + "OFWeiche_center_line_height_mm": 700.123, + "Objekte_width_mm": 730.013, + "Objekte_height_mm": 715.001, + "OFWeiche_CP1_x_mm": 365.007, + "OFWeiche_CP1_y_mm": 715.001, + "KurvenRichtung": 3, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 14.878, + "OFWeiche_CP2_y_mm": 14.878, + "OFWeiche_CP3_x_mm": 715.136, + "OFWeiche_CP3_y_mm": 14.878 + }, + { + "Sivasnr": 834372101, + "ProfilTyp": "WEICHE S D 45°-350/700, KPL. MIT P", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 700.258, + "OFWeiche_center_line_height_mm": 700.123, + "Objekte_width_mm": 730.013, + "Objekte_height_mm": 715.001, + "OFWeiche_CP1_x_mm": 365.007, + "OFWeiche_CP1_y_mm": 715.001, + "KurvenRichtung": 3, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 14.878, + "OFWeiche_CP2_y_mm": 14.878, + "OFWeiche_CP3_x_mm": 715.136, + "OFWeiche_CP3_y_mm": 14.878 + }, + { + "Sivasnr": "834372101+0_BG090090", + "ProfilTyp": "WEICHE S D 45°-350/700, KPL. MIT P mit TEF links", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 350, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 3, + "SivasnrTEF": "0_B10090+0_B10090" + }, + { + "Sivasnr": "0_BG090090+834372101", + "ProfilTyp": "WEICHE S D 45°-350/700, KPL. MIT P mit TEF rechts", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 350, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 3, + "SivasnrTEF": "0_B10090+0_B10090" + }, + { + "Sivasnr": "0_BG090090+834372101+0_BG090090", + "ProfilTyp": "WEICHE S D 45°-350/700, KPL. MIT P mit TEF beideseitig", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 350, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 3, + "SivasnrTEF": "0_B10090+0_B10090+0_B10090+0_B10090" + }, + { + "Sivasnr": 834372103, + "ProfilTyp": "WEICHE S D 45°-400/750, KPL. MIT M", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 800.0, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": 829.755, + "Objekte_height_mm": 764.878, + "OFWeiche_CP1_x_mm": 414.877, + "OFWeiche_CP1_y_mm": 764.878, + "KurvenRichtung": 3, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 14.878, + "OFWeiche_CP2_y_mm": 14.878, + "OFWeiche_CP3_x_mm": 814.878, + "OFWeiche_CP3_y_mm": 14.878 + }, + { + "Sivasnr": 834372104, + "ProfilTyp": "WEICHE S D 45°-400/750, KPL. MIT P", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 800.0, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": 829.755, + "Objekte_height_mm": 764.878, + "OFWeiche_CP1_x_mm": 414.877, + "OFWeiche_CP1_y_mm": 764.878, + "KurvenRichtung": 3, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 14.878, + "OFWeiche_CP2_y_mm": 14.878, + "OFWeiche_CP3_x_mm": 814.878, + "OFWeiche_CP3_y_mm": 14.878 + }, + { + "Sivasnr": "834372104+0_BG190090", + "ProfilTyp": "WEICHE S D 45°-400/750, KPL. MIT P mit TEF links", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 400, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 3, + "SivasnrTEF": "0_B10090+0_B10090" + }, + { + "Sivasnr": "0_BG190090+834372104", + "ProfilTyp": "WEICHE S D 45°-400/750, KPL. MIT P mit TEF rechts", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 400, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 3, + "SivasnrTEF": "0_B10090+0_B10090" + }, + { + "Sivasnr": "0_BG190090+834372104+0_BG190090", + "ProfilTyp": "WEICHE S D 45°-400/750, KPL. MIT P mit TEF beideseitig", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 400, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 3, + "SivasnrTEF": "0_B10090+0_B10090+0_B10090+0_B10090" + }, + { + "Sivasnr": 834372106, + "ProfilTyp": "WEICHE S D 90°-500/600, KPL. MIT M", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 1000.46, + "OFWeiche_center_line_height_mm": 600.197, + "Objekte_width_mm": 1030.215, + "Objekte_height_mm": 615.075, + "OFWeiche_CP1_x_mm": 515.107, + "OFWeiche_CP1_y_mm": 615.075, + "KurvenRichtung": 3, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 14.878, + "OFWeiche_CP2_y_mm": 14.878, + "OFWeiche_CP3_x_mm": 1015.338, + "OFWeiche_CP3_y_mm": 14.878 + }, + { + "Sivasnr": 834372107, + "ProfilTyp": "WEICHE S D 90°-500/600, KPL. MIT P", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 1000.46, + "OFWeiche_center_line_height_mm": 600.197, + "Objekte_width_mm": 1030.215, + "Objekte_height_mm": 615.075, + "OFWeiche_CP1_x_mm": 515.107, + "OFWeiche_CP1_y_mm": 615.075, + "KurvenRichtung": 3, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 14.878, + "OFWeiche_CP2_y_mm": 14.878, + "OFWeiche_CP3_x_mm": 1015.338, + "OFWeiche_CP3_y_mm": 14.878 + }, + { + "Sivasnr": "834372107+0_BG081090", + "ProfilTyp": "WEICHE S D 90°-500/600, KPL. MIT P mit TEF links", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 500, + "OFWeiche_center_line_height_mm": 600, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 3, + "SivasnrTEF": "0_B10081+0_B10090" + }, + { + "Sivasnr": "834372107+0_B10090+0_B10081", + "ProfilTyp": "WEICHE S D 90°-500/600, KPL. MIT P mit TEF rechts", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 500, + "OFWeiche_center_line_height_mm": 600, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 3, + "SivasnrTEF": "0_B10090+0_B10081" + }, + { + "Sivasnr": "0_BG081090+834372107+0_BG081090", + "ProfilTyp": "WEICHE S D 90°-500/600, KPL. MIT P mit TEF beideseitig", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 500, + "OFWeiche_center_line_height_mm": 600, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 3, + "SivasnrTEF": "0_B10081+0_B10090+0_B10081+0_B10090" + }, + { + "Sivasnr": 834372109, + "ProfilTyp": "WEICHE S D 90°-700/700, KPL. MIT M", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 1400.739, + "OFWeiche_center_line_height_mm": 700.176, + "Objekte_width_mm": 1400.739, + "Objekte_height_mm": 721.216, + "OFWeiche_CP1_x_mm": 700.37, + "OFWeiche_CP1_y_mm": 721.216, + "KurvenRichtung": 3, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 0.0, + "OFWeiche_CP2_y_mm": 21.04, + "OFWeiche_CP3_x_mm": 1400.739, + "OFWeiche_CP3_y_mm": 21.04 + }, + { + "Sivasnr": 834372110, + "ProfilTyp": "WEICHE S D 90°-700/700, KPL. MIT P", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 1400.739, + "OFWeiche_center_line_height_mm": 700.176, + "Objekte_width_mm": 1400.739, + "Objekte_height_mm": 721.216, + "OFWeiche_CP1_x_mm": 700.37, + "OFWeiche_CP1_y_mm": 721.216, + "KurvenRichtung": 3, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 0.0, + "OFWeiche_CP2_y_mm": 21.04, + "OFWeiche_CP3_x_mm": 1400.739, + "OFWeiche_CP3_y_mm": 21.04 + }, + { + "Sivasnr": "834372110+0_BG080090", + "ProfilTyp": "WEICHE S D 90°-700/700, KPL. MIT P mit TEF links", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 700, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 3, + "SivasnrTEF": "0_B10080+0_B10090" + }, + { + "Sivasnr": "834372110+0_B10090+0_B10080", + "ProfilTyp": "WEICHE S D 90°-700/700, KPL. MIT P mit TEF rechts", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 700, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 3, + "SivasnrTEF": "0_B10090+0_B10080" + }, + { + "Sivasnr": "0_BG080090+834372110+0_BG080090", + "ProfilTyp": "WEICHE S D 90°-700/700, KPL. MIT P mit TEF beideseitig", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 700, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 3, + "SivasnrTEF": "0_B10080+0_B10090+0_B10080+0_B10090" + }, + { + "Sivasnr": 834372115, + "ProfilTyp": "WEICHE S D PARALLEL-200/750, KPL. MIT M", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 0, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 400.014, + "OFWeiche_center_line_height_mm": 749.8, + "Objekte_width_mm": 442.094, + "Objekte_height_mm": 749.8, + "OFWeiche_CP1_x_mm": 221.047, + "OFWeiche_CP1_y_mm": 749.8, + "KurvenRichtung": 3, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.04, + "OFWeiche_CP2_y_mm": 0.0, + "OFWeiche_CP3_x_mm": 421.054, + "OFWeiche_CP3_y_mm": 0.0 + }, + { + "Sivasnr": 834372116, + "ProfilTyp": "WEICHE S D PARALLEL-200/750, KPL. MIT P", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 0, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 400.014, + "OFWeiche_center_line_height_mm": 749.8, + "Objekte_width_mm": 442.094, + "Objekte_height_mm": 749.8, + "OFWeiche_CP1_x_mm": 221.047, + "OFWeiche_CP1_y_mm": 749.8, + "KurvenRichtung": 3, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.04, + "OFWeiche_CP2_y_mm": 0.0, + "OFWeiche_CP3_x_mm": 421.054, + "OFWeiche_CP3_y_mm": 0.0 + }, + { + "Sivasnr": 834372200, + "ProfilTyp": "WEICHE S T 45°-350/700, KPL. MIT M", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 700.258, + "OFWeiche_center_line_height_mm": 700.123, + "Objekte_width_mm": 730.013, + "Objekte_height_mm": 715.001, + "OFWeiche_CP1_x_mm": 365.007, + "OFWeiche_CP1_y_mm": 715.001, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 14.878, + "OFWeiche_CP2_y_mm": 14.878, + "OFWeiche_CP3_x_mm": 715.136, + "OFWeiche_CP3_y_mm": 14.878, + "OFWeiche_CP4_x_mm": 365.007, + "OFWeiche_CP4_y_mm": 355.001 + }, + { + "Sivasnr": 834372201, + "ProfilTyp": "WEICHE S T 45°-350/700, KPL. MIT P", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 700.258, + "OFWeiche_center_line_height_mm": 700.123, + "Objekte_width_mm": 730.013, + "Objekte_height_mm": 715.001, + "OFWeiche_CP1_x_mm": 365.007, + "OFWeiche_CP1_y_mm": 715.001, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 14.878, + "OFWeiche_CP2_y_mm": 14.878, + "OFWeiche_CP3_x_mm": 715.136, + "OFWeiche_CP3_y_mm": 14.878, + "OFWeiche_CP4_x_mm": 365.007, + "OFWeiche_CP4_y_mm": 355.001 + }, + { + "Sivasnr": "834372201+0_BG090090", + "ProfilTyp": "WEICHE S T 45°-350/700, KPL. MIT P mit TEF links", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 350, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10090+0_B10090" + }, + { + "Sivasnr": "0_BG090090+834372201", + "ProfilTyp": "WEICHE S T 45°-350/700, KPL. MIT P mit TEF rechts", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 350, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10090+0_B10090" + }, + { + "Sivasnr": "0_BG090090+834372201+0_BG090090", + "ProfilTyp": "WEICHE S T 45°-350/700, KPL. MIT P mit TEF beideseitig", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 350, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10090+0_B10090+0_B10090+0_B10090" + }, + { + "Sivasnr": 834372203, + "ProfilTyp": "WEICHE S T 45°-400/750, KPL. MIT M", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 800.0, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": 829.755, + "Objekte_height_mm": 764.878, + "OFWeiche_CP1_x_mm": 414.877, + "OFWeiche_CP1_y_mm": 764.878, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 14.878, + "OFWeiche_CP2_y_mm": 14.878, + "OFWeiche_CP3_x_mm": 814.878, + "OFWeiche_CP3_y_mm": 14.878, + "OFWeiche_CP4_x_mm": 414.877, + "OFWeiche_CP4_y_mm": 404.878 + }, + { + "Sivasnr": 834372204, + "ProfilTyp": "WEICHE S T 45°-400/750, KPL. MIT P", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 800.0, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": 829.755, + "Objekte_height_mm": 764.878, + "OFWeiche_CP1_x_mm": 414.877, + "OFWeiche_CP1_y_mm": 764.878, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 14.878, + "OFWeiche_CP2_y_mm": 14.878, + "OFWeiche_CP3_x_mm": 814.878, + "OFWeiche_CP3_y_mm": 14.878, + "OFWeiche_CP4_x_mm": 414.877, + "OFWeiche_CP4_y_mm": 404.878 + }, + { + "Sivasnr": "834372204+0_BG090090", + "ProfilTyp": "WEICHE S T 45°-400/750, KPL. MIT P mit TEF links", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 400, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10090+0_B10090" + }, + { + "Sivasnr": "0_BG190090+834372204", + "ProfilTyp": "WEICHE S T 45°-400/750, KPL. MIT P mit TEF rechts", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 400, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10090+0_B10090" + }, + { + "Sivasnr": "0_BG090090+834372204+0_BG090090", + "ProfilTyp": "WEICHE S T 45°-400/750, KPL. MIT P mit TEF beideseitig", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 45, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 400, + "OFWeiche_center_line_height_mm": 750, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10090+0_B10090+0_B10090+0_B10090" + }, + { + "Sivasnr": 834372206, + "ProfilTyp": "WEICHE S T 90°-500/600, KPL. MIT M", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 1000.46, + "OFWeiche_center_line_height_mm": 600.197, + "Objekte_width_mm": 1030.215, + "Objekte_height_mm": 615.075, + "OFWeiche_CP1_x_mm": 515.107, + "OFWeiche_CP1_y_mm": 615.075, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 14.878, + "OFWeiche_CP2_y_mm": 14.878, + "OFWeiche_CP3_x_mm": 1015.338, + "OFWeiche_CP3_y_mm": 14.878, + "OFWeiche_CP4_x_mm": 515.107, + "OFWeiche_CP4_y_mm": 255.075 + }, + { + "Sivasnr": 834372207, + "ProfilTyp": "WEICHE S T 90°-500/600, KPL. MIT P", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 1000.46, + "OFWeiche_center_line_height_mm": 600.197, + "Objekte_width_mm": 1030.215, + "Objekte_height_mm": 615.075, + "OFWeiche_CP1_x_mm": 515.107, + "OFWeiche_CP1_y_mm": 615.075, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 14.878, + "OFWeiche_CP2_y_mm": 14.878, + "OFWeiche_CP3_x_mm": 1015.338, + "OFWeiche_CP3_y_mm": 14.878, + "OFWeiche_CP4_x_mm": 515.107, + "OFWeiche_CP4_y_mm": 255.075 + }, + { + "Sivasnr": "834372207+0_BG081090", + "ProfilTyp": "WEICHE S T 90°-500/600, KPL. MIT P mit TEF links", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 500, + "OFWeiche_center_line_height_mm": 600, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10081+0_B10090" + }, + { + "Sivasnr": "0_BG081090+834372207", + "ProfilTyp": "WEICHE S T 90°-500/600, KPL. MIT P mit TEF rechts", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 500, + "OFWeiche_center_line_height_mm": 600, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10090+0_B10081" + }, + { + "Sivasnr": "0_BG081090+834372207+0_BG081090", + "ProfilTyp": "WEICHE S T 90°-500/600, KPL. MIT P mit TEF beideseitig", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 500, + "OFWeiche_center_line_height_mm": 600, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10081+0_B10090+0_B10081+0_B10090" + }, + { + "Sivasnr": 834372209, + "ProfilTyp": "WEICHE S T 90°-700/700, KPL. MIT M", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 1400.739, + "OFWeiche_center_line_height_mm": 700.176, + "Objekte_width_mm": 1400.739, + "Objekte_height_mm": 721.216, + "OFWeiche_CP1_x_mm": 700.37, + "OFWeiche_CP1_y_mm": 721.216, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 0.0, + "OFWeiche_CP2_y_mm": 21.04, + "OFWeiche_CP3_x_mm": 1400.739, + "OFWeiche_CP3_y_mm": 21.04, + "OFWeiche_CP4_x_mm": 700.37, + "OFWeiche_CP4_y_mm": 361.216 + }, + { + "Sivasnr": 834372210, + "ProfilTyp": "WEICHE S T 90°-700/700, KPL. MIT P", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 1400.739, + "OFWeiche_center_line_height_mm": 700.176, + "Objekte_width_mm": 1400.739, + "Objekte_height_mm": 721.216, + "OFWeiche_CP1_x_mm": 700.37, + "OFWeiche_CP1_y_mm": 721.216, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 0.0, + "OFWeiche_CP2_y_mm": 21.04, + "OFWeiche_CP3_x_mm": 1400.739, + "OFWeiche_CP3_y_mm": 21.04, + "OFWeiche_CP4_x_mm": 700.37, + "OFWeiche_CP4_y_mm": 361.216 + }, + { + "Sivasnr": "834372404+0_BG080090", + "ProfilTyp": "WEICHE S T 90°-700/700, KPL. MIT P mit TEF links", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 700, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10080+0_B10090" + }, + { + "Sivasnr": "0_BG080090+834372404", + "ProfilTyp": "WEICHE S T 90°-700/700, KPL. MIT P mit TEF rechts", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 700, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10090+0_B10080" + }, + { + "Sivasnr": "0_BG080090+834372404+0_BG080090", + "ProfilTyp": "WEICHE S T 90°-700/700, KPL. MIT P mit TEF beideseitig", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 700, + "OFWeiche_center_line_height_mm": 700, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10080+0_B10090+0_B10080+0_B10090" + }, + { + "Sivasnr": 834372215, + "ProfilTyp": "WEICHE S T PARALLEL-200/750, KPL. MIT M", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 0, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 400.014, + "OFWeiche_center_line_height_mm": 749.8, + "Objekte_width_mm": 442.094, + "Objekte_height_mm": 749.8, + "OFWeiche_CP1_x_mm": 221.047, + "OFWeiche_CP1_y_mm": 749.8, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.04, + "OFWeiche_CP2_y_mm": 0.0, + "OFWeiche_CP3_x_mm": 421.054, + "OFWeiche_CP3_y_mm": 0.0, + "OFWeiche_CP4_x_mm": 221.047, + "OFWeiche_CP4_y_mm": 389.8 + }, + { + "Sivasnr": 834372216, + "ProfilTyp": "WEICHE S T PARALLEL-200/750, KPL. MIT P", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 0, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 400.014, + "OFWeiche_center_line_height_mm": 749.8, + "Objekte_width_mm": 442.094, + "Objekte_height_mm": 749.8, + "OFWeiche_CP1_x_mm": 221.047, + "OFWeiche_CP1_y_mm": 749.8, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.04, + "OFWeiche_CP2_y_mm": 0.0, + "OFWeiche_CP3_x_mm": 421.054, + "OFWeiche_CP3_y_mm": 0.0, + "OFWeiche_CP4_x_mm": 221.047, + "OFWeiche_CP4_y_mm": 389.8 + }, + { + "Sivasnr": 834372400, + "ProfilTyp": "WEICHE S C DELTA 1400/700, KPL. M", + "WeichenTyp": "Dreifachweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 1400.462, + "OFWeiche_center_line_height_mm": 700.237, + "Objekte_width_mm": 1400.462, + "Objekte_height_mm": 721.237, + "OFWeiche_CP1_x_mm": 700.231, + "OFWeiche_CP1_y_mm": 0, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 0, + "OFWeiche_CP2_y_mm": 700.237, + "OFWeiche_CP3_x_mm": 1400.462, + "OFWeiche_CP3_y_mm": 700.237 + }, + { + "Sivasnr": 834372401, + "ProfilTyp": "WEICHE S C DELTA 1400/700, KPL. P", + "WeichenTyp": "Dreifachweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 1400.462, + "OFWeiche_center_line_height_mm": 700.237, + "Objekte_width_mm": 1400.462, + "Objekte_height_mm": 721.237, + "OFWeiche_CP1_x_mm": 700.231, + "OFWeiche_CP1_y_mm": 0, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 0, + "OFWeiche_CP2_y_mm": 700.237, + "OFWeiche_CP3_x_mm": 1400.462, + "OFWeiche_CP3_y_mm": 700.237 + }, + { + "Sivasnr": 834372403, + "ProfilTyp": "WEICHE S C DELTA 1600/800, KPL. M", + "WeichenTyp": "Dreifachweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 1600.384, + "OFWeiche_center_line_height_mm": 800.266, + "Objekte_width_mm": 1600.384, + "Objekte_height_mm": 821.266, + "OFWeiche_CP1_x_mm": 800.192, + "OFWeiche_CP1_y_mm": 0, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 0, + "OFWeiche_CP2_y_mm": 800.266, + "OFWeiche_CP3_x_mm": 1600.384, + "OFWeiche_CP3_y_mm": 800.266 + }, + { + "Sivasnr": 834372404, + "ProfilTyp": "WEICHE S C DELTA 1600/800, KPL. P", + "WeichenTyp": "Dreifachweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 1600.384, + "OFWeiche_center_line_height_mm": 800.266, + "Objekte_width_mm": 1600.384, + "Objekte_height_mm": 821.266, + "OFWeiche_CP1_x_mm": 800.192, + "OFWeiche_CP1_y_mm": 0, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 0, + "OFWeiche_CP2_y_mm": 800.266, + "OFWeiche_CP3_x_mm": 1600.384, + "OFWeiche_CP3_y_mm": 800.266 + }, + { + "Sivasnr": "0_BG071090+834372404+0_BG071090", + "ProfilTyp": "WEICHE S C DELTA 1600/800, KPL. P mit TEF beideseitig", + "WeichenTyp": "Dreifachweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 1600, + "OFWeiche_center_line_height_mm": 800, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10071+0_B10090+0_B10090+0_B10071+0_B10090+0_B10090" + }, + { + "Sivasnr": "834372404+0_BG071090", + "ProfilTyp": "WEICHE S C DELTA 1600/800, KPL. P mit TEF links", + "WeichenTyp": "Dreifachweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 1600, + "OFWeiche_center_line_height_mm": 800, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10071+0_B10090+0_B10090" + }, + { + "Sivasnr": "0_BG071090+834372404", + "ProfilTyp": "WEICHE S C DELTA 1600/800, KPL. P mit TEF rechts", + "WeichenTyp": "Dreifachweiche", + "KurvenWinkel": 90, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 1600, + "OFWeiche_center_line_height_mm": 800, + "Objekte_width_mm": null, + "Objekte_height_mm": null, + "TEFWeiche_center_line_width_mm": null, + "TEFWeiche_center_line_height_mm": null, + "OFWeiche_CP1_x_mm": null, + "OFWeiche_CP1_y_mm": null, + "TEFWeiche_CP1_x_mm": null, + "TEFWeiche_CP1_y_mm": null, + "KurvenRichtung": 7, + "SivasnrTEF": "0_B10090+0_B10090+0_B10071" + }, + { + "Sivasnr": 834372420, + "ProfilTyp": "WEICHE S C STAR 1400/1400, KPL. M", + "WeichenTyp": "Sternweiche", + "KurvenWinkel": 0, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 1400.442, + "OFWeiche_center_line_height_mm": 1400.442, + "Objekte_width_mm": 1400.442, + "Objekte_height_mm": 1400.442, + "OFWeiche_CP1_x_mm": 700.221, + "OFWeiche_CP1_y_mm": 0, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 1400.442, + "OFWeiche_CP2_y_mm": 700.221, + "OFWeiche_CP3_x_mm": 700.221, + "OFWeiche_CP3_y_mm": 1400.442, + "OFWeiche_CP4_x_mm": 0, + "OFWeiche_CP4_y_mm": 700.221 + }, + { + "Sivasnr": 834342011, + "ProfilTyp": "WEICHENKOERPER S -L-, KPL. MIT M", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 22.5, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 101.5, + "OFWeiche_center_line_height_mm": 360, + "Objekte_width_mm": 141.938, + "Objekte_height_mm": 360, + "OFWeiche_CP1_x_mm": 109.552, + "OFWeiche_CP1_y_mm": 0.0, + "KurvenRichtung": 1, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 109.552, + "OFWeiche_CP2_y_mm": 360, + "OFWeiche_CP3_x_mm": 19.438, + "OFWeiche_CP3_y_mm": 8.052 + }, + { + "Sivasnr": 834342001, + "ProfilTyp": "WEICHENKOERPER S -R-, KPL. MIT M", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 22.5, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 101.5, + "OFWeiche_center_line_height_mm": 360, + "Objekte_width_mm": 141.938, + "Objekte_height_mm": 360, + "OFWeiche_CP1_x_mm": 21.0, + "OFWeiche_CP1_y_mm": 0.0, + "KurvenRichtung": 2, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.0, + "OFWeiche_CP2_y_mm": 360, + "OFWeiche_CP3_x_mm": 122.5, + "OFWeiche_CP3_y_mm": 8.052 + }, + { + "Sivasnr": 834342012, + "ProfilTyp": "WEICHENKOERPER S -L-, KPL. MIT P", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 22.5, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 101.5, + "OFWeiche_center_line_height_mm": 360, + "Objekte_width_mm": 141.938, + "Objekte_height_mm": 360, + "OFWeiche_CP1_x_mm": 109.552, + "OFWeiche_CP1_y_mm": 0.0, + "KurvenRichtung": 1, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 109.552, + "OFWeiche_CP2_y_mm": 360, + "OFWeiche_CP3_x_mm": 19.438, + "OFWeiche_CP3_y_mm": 8.052 + }, + { + "Sivasnr": 834342002, + "ProfilTyp": "WEICHENKOERPER S -R-, KPL. MIT P", + "WeichenTyp": "Einzelweiche", + "KurvenWinkel": 22.5, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 101.5, + "OFWeiche_center_line_height_mm": 360, + "Objekte_width_mm": 141.938, + "Objekte_height_mm": 360, + "OFWeiche_CP1_x_mm": 21.0, + "OFWeiche_CP1_y_mm": 0.0, + "KurvenRichtung": 2, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 21.0, + "OFWeiche_CP2_y_mm": 360, + "OFWeiche_CP3_x_mm": 122.5, + "OFWeiche_CP3_y_mm": 8.052 + }, + { + "Sivasnr": 834342100, + "ProfilTyp": "WEICHENKOERPER S D, KPL. MIT M", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 22.5, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 203, + "OFWeiche_center_line_height_mm": 340, + "Objekte_width_mm": 241.877, + "Objekte_height_mm": 348.052, + "OFWeiche_CP1_x_mm": 120.939, + "OFWeiche_CP1_y_mm": 348.052, + "KurvenRichtung": 3, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 19.438, + "OFWeiche_CP2_y_mm": 8.052, + "OFWeiche_CP3_x_mm": 222.438, + "OFWeiche_CP3_y_mm": 8.052 + }, + { + "Sivasnr": 834342101, + "ProfilTyp": "WEICHENKOERPER S D, KPL. MIT P", + "WeichenTyp": "Doppelweiche", + "KurvenWinkel": 22.5, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 203, + "OFWeiche_center_line_height_mm": 340, + "Objekte_width_mm": 241.877, + "Objekte_height_mm": 348.052, + "OFWeiche_CP1_x_mm": 120.939, + "OFWeiche_CP1_y_mm": 348.052, + "KurvenRichtung": 3, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 19.438, + "OFWeiche_CP2_y_mm": 8.052, + "OFWeiche_CP3_x_mm": 222.438, + "OFWeiche_CP3_y_mm": 8.052 + }, + { + "Sivasnr": 834342200, + "ProfilTyp": "WEICHENKOERPER S T, KPL. MIT M", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 22.5, + "Schaltungstyp": "M", + "OFWeiche_center_line_width_mm": 203, + "OFWeiche_center_line_height_mm": 360.0, + "Objekte_width_mm": 241.877, + "Objekte_height_mm": 360.0, + "OFWeiche_CP1_x_mm": 120.939, + "OFWeiche_CP1_y_mm": 360.0, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 19.438, + "OFWeiche_CP2_y_mm": 20, + "OFWeiche_CP3_x_mm": 222.438, + "OFWeiche_CP3_y_mm": 20, + "OFWeiche_CP4_x_mm": 120.939, + "OFWeiche_CP4_y_mm": -11.948 + }, + { + "Sivasnr": 834342201, + "ProfilTyp": "WEICHENKOERPER S T, KPL. MIT P", + "WeichenTyp": "Dreiwegeweiche", + "KurvenWinkel": 22.5, + "Schaltungstyp": "P", + "OFWeiche_center_line_width_mm": 203, + "OFWeiche_center_line_height_mm": 360.0, + "Objekte_width_mm": 241.877, + "Objekte_height_mm": 360.0, + "OFWeiche_CP1_x_mm": 120.939, + "OFWeiche_CP1_y_mm": 360.0, + "KurvenRichtung": 7, + "SivasnrTEF": null, + "OFWeiche_CP2_x_mm": 19.438, + "OFWeiche_CP2_y_mm": 20, + "OFWeiche_CP3_x_mm": 222.438, + "OFWeiche_CP3_y_mm": 20, + "OFWeiche_CP4_x_mm": 120.939, + "OFWeiche_CP4_y_mm": -11.948 + } +] \ No newline at end of file diff --git a/SVGs/Omniflo/python/OFWeiche/omniflo_weichen.py b/SVGs/Omniflo/python/OFWeiche/omniflo_weichen.py new file mode 100644 index 0000000..0119846 --- /dev/null +++ b/SVGs/Omniflo/python/OFWeiche/omniflo_weichen.py @@ -0,0 +1,622 @@ + +import json +import math + +def modify_json_values(json_file): + # 常量定义 + BogenProfileWidth = 42.080 + WeichenkProfileWidth = 42.000 + WeichenGerade = 360.000 + + # 读取JSON文件 + with open(json_file, 'r', encoding='utf-8') as f: + data = json.load(f) + process_einzelweiche_items(data, WeichenkProfileWidth,BogenProfileWidth, WeichenGerade) + + process_doppelweiche_items(data, BogenProfileWidth, WeichenGerade) + + process_dreifachweiche_items(data, WeichenkProfileWidth) + # 询问是否保存 + save_choice = input("\n是否保存所有修改? (直接回车保存,输入n取消): ").lower() + if save_choice == 'n': + print("所有修改未保存") + else: + with open(json_file, 'w', encoding='utf-8') as f: + json.dump(data, f, indent=2, ensure_ascii=False) + print("所有修改已保存!") + +def process_einzelweiche_items(data, WeichenkProfileWidth,BogenProfileWidth, WeichenGerade): # 筛选符合条件的项 + filtered_items = [ + item for item in data + if (item.get("SivasnrTEF") is None and + item.get("KurvenRichtung") == 1 and + item.get("Schaltungstyp") == "M") + ] + + print(f"共找到 {len(filtered_items)} 项符合条件的记录") + print("="*50) + + # 遍历每一项 + for idx, item in enumerate(filtered_items, 1): + print(f"\n第 {idx} 项:") + print(f"Sivasnr: {item['Sivasnr']}") + print(f"ProfilTyp: {item['ProfilTyp']}") + print(f"Schaltungstyp: {item['Schaltungstyp']}") + + # 处理 OFWeiche_center_line_width_mm + current_value = item.get("OFWeiche_center_line_width_mm") + print(f"\n当前 OFWeiche_center_line_width_mm: {current_value}") + choice = input("是否修改? (y修改,直接回车跳过): ").lower() + if choice == 'y': + new_value = input(f"请输入新值 (当前: {current_value}): ") + try: + old_value = item["OFWeiche_center_line_width_mm"] + item["OFWeiche_center_line_width_mm"] = round(float(new_value), 3) if new_value.lower() != 'null' else None + print(f"值已更新: {old_value} → {item['OFWeiche_center_line_width_mm']}") + except ValueError: + print("输入无效,保持原值") + else: + print("跳过修改") + + # 处理 OFWeiche_center_line_height_mm + current_value = item.get("OFWeiche_center_line_height_mm") + print(f"\n当前 OFWeiche_center_line_height_mm: {current_value}") + choice = input("是否修改? (y修改,直接回车跳过): ").lower() + if choice == 'y': + new_value = input(f"请输入新值 (当前: {current_value}): ") + try: + old_value = item["OFWeiche_center_line_height_mm"] + item["OFWeiche_center_line_height_mm"] = round(float(new_value), 3) if new_value.lower() != 'null' else None + print(f"值已更新: {old_value} → {item['OFWeiche_center_line_height_mm']}") + except ValueError: + print("输入无效,保持原值") + else: + print("跳过修改") + + # 计算相关值 + if (item["OFWeiche_center_line_width_mm"] is not None and + item["OFWeiche_center_line_height_mm"] is not None): + + angle_rad = math.radians(item["KurvenWinkel"]) + + # 计算并打印基本值 + old_width = item.get("Objekte_width_mm") + item["Objekte_width_mm"] = round( + (BogenProfileWidth/2 * math.cos(angle_rad)) + + item["OFWeiche_center_line_width_mm"] + + WeichenkProfileWidth/2, 3) + print(f"\nObjekte_width_mm 计算更新: {old_width} → {item['Objekte_width_mm']}") + + old_height = item.get("Objekte_height_mm") + if item["KurvenWinkel"] == 22.5: + item["Objekte_height_mm"] = round( + item["OFWeiche_center_line_height_mm"], 3) + else: + item["Objekte_height_mm"] = round( + (BogenProfileWidth/2 * math.sin(angle_rad)) + + item["OFWeiche_center_line_height_mm"], 3) + print(f"Objekte_height_mm 计算更新: {old_height} → {item['Objekte_height_mm']}") + + # 计算并打印CP点坐标 + old_cp1x = item.get("OFWeiche_CP1_x_mm") + item["OFWeiche_CP1_x_mm"] = round( + (BogenProfileWidth/2 * math.sin(angle_rad)) + + item["OFWeiche_center_line_width_mm"], 3) + print(f"OFWeiche_CP1_x_mm 计算更新: {old_cp1x} → {item['OFWeiche_CP1_x_mm']}") + + old_cp1y = item.get("OFWeiche_CP1_y_mm") + item["OFWeiche_CP1_y_mm"] = round( + item["Objekte_height_mm"] - WeichenGerade, 3) + print(f"OFWeiche_CP1_y_mm 计算更新: {old_cp1y} → {item['OFWeiche_CP1_y_mm']}") + + item["OFWeiche_CP2_x_mm"] = round(item["OFWeiche_CP1_x_mm"], 3) + print(f"OFWeiche_CP2_x_mm 设置: {item['OFWeiche_CP2_x_mm']}") + + item["OFWeiche_CP2_y_mm"] = round(item["Objekte_height_mm"], 3) + print(f"OFWeiche_CP2_y_mm 设置: {item['OFWeiche_CP2_y_mm']}") + + item["OFWeiche_CP3_x_mm"] = round( + BogenProfileWidth/2 * math.cos(angle_rad), 3) + print(f"OFWeiche_CP3_x_mm 计算更新: {item['OFWeiche_CP3_x_mm']}") + + item["OFWeiche_CP3_y_mm"] = round( + BogenProfileWidth/2 * math.sin(angle_rad), 3) + print(f"OFWeiche_CP3_y_mm 计算更新: {item['OFWeiche_CP3_y_mm']}") + + # 1. 查找Schaltungstyp为P的相似项(更新所有CP点) + current_profil = item["ProfilTyp"] + if "S" in current_profil: + prefix = current_profil.rsplit(" ", 1)[0] + + similar_items_p = [x for x in data + if x["ProfilTyp"].startswith(prefix) and + x["ProfilTyp"] != current_profil and + "WEICHE" in x["ProfilTyp"] and + x.get("SivasnrTEF") is None and + x.get("Schaltungstyp") == "P"] + + if similar_items_p: + print(f"\n找到 {len(similar_items_p)} 个Schaltungstyp=P的相似项") + for similar in similar_items_p: + print(f"正在更新相似项: {similar['ProfilTyp']} (Sivasnr: {similar['Sivasnr']})") + + + # 更新所有字段包括CP点 + fields_to_copy = [ + "OFWeiche_center_line_width_mm", + "OFWeiche_center_line_height_mm", + "Objekte_width_mm", + "Objekte_height_mm", + "OFWeiche_CP1_x_mm", + "OFWeiche_CP1_y_mm", + "OFWeiche_CP2_x_mm", + "OFWeiche_CP2_y_mm", + "OFWeiche_CP3_x_mm", + "OFWeiche_CP3_y_mm" + ] + + for field in fields_to_copy: + old_val = similar.get(field) + similar[field] = item[field] + print(f" {field}: {old_val} → {similar[field]}") + + else: + print("没有找到Schaltungstyp=P的相似项") + + # 2. 查找L→R且KurvenRichtung=2的相似项 + if "S" in current_profil and "-L-" in current_profil: + r_profil = current_profil.replace("-L-", "-R-") + + similar_items_r = [x for x in data + if x["ProfilTyp"] == r_profil and + x.get("SivasnrTEF") is None and + x.get("KurvenRichtung") == 2 and + x.get("Schaltungstyp") == "M"] + + if similar_items_r: + print(f"\n找到 {len(similar_items_r)} 个L→R的相似项(KurvenRichtung=2)") + for similar in similar_items_r: + print(f"正在更新R型相似项: {similar['ProfilTyp']} (Sivasnr: {similar['Sivasnr']})") + + # 复制基础值 + base_fields = [ + "OFWeiche_center_line_width_mm", + "OFWeiche_center_line_height_mm", + "Objekte_width_mm", + "Objekte_height_mm" + ] + + for field in base_fields: + old_val = similar.get(field) + similar[field] = item[field] + print(f" {field}: {old_val} → {similar[field]}") + + # 计算并打印R型特有的CP点 + old_cp1x = similar.get("OFWeiche_CP1_x_mm") + similar["OFWeiche_CP1_x_mm"] = round(WeichenkProfileWidth/2, 3) + print(f" OFWeiche_CP1_x_mm (R型): {old_cp1x} → {similar['OFWeiche_CP1_x_mm']}") + + old_cp1y = similar.get("OFWeiche_CP1_y_mm") + similar["OFWeiche_CP1_y_mm"] = round(item["Objekte_height_mm"] - WeichenGerade, 3) + print(f" OFWeiche_CP1_y_mm (R型): {old_cp1y} → {similar['OFWeiche_CP1_y_mm']}") + + similar["OFWeiche_CP2_x_mm"] = similar["OFWeiche_CP1_x_mm"] + print(f" OFWeiche_CP2_x_mm (R型): 设置为 {similar['OFWeiche_CP2_x_mm']}") + + old_cp2y = similar.get("OFWeiche_CP2_y_mm") + similar["OFWeiche_CP2_y_mm"] = round(item["Objekte_height_mm"], 3) + print(f" OFWeiche_CP2_y_mm (R型): {old_cp2y} → {similar['OFWeiche_CP2_y_mm']}") + + old_cp3x = similar.get("OFWeiche_CP3_x_mm") + similar["OFWeiche_CP3_x_mm"] = round( + similar["OFWeiche_CP1_x_mm"] + item["OFWeiche_center_line_width_mm"], 3) + print(f" OFWeiche_CP3_x_mm (R型): {old_cp3x} → {similar['OFWeiche_CP3_x_mm']}") + + old_cp3y = similar.get("OFWeiche_CP3_y_mm") + similar["OFWeiche_CP3_y_mm"] = round( + BogenProfileWidth/2 * math.sin(angle_rad), 3) + print(f" OFWeiche_CP3_y_mm (R型): {old_cp3y} → {similar['OFWeiche_CP3_y_mm']}") + + # 3. 查找该R型项的P型对应项 + r_p_profil = r_profil.replace("MIT M", "MIT P") + + similar_items_r_p = [x for x in data + if x["ProfilTyp"] == r_p_profil and + x.get("SivasnrTEF") is None and + x.get("Schaltungstyp") == "P"] + + if similar_items_r_p: + print(f"\n找到 {len(similar_items_r_p)} 个R型P型对应项") + for similar_r_p in similar_items_r_p: + print(f"正在更新R型P型对应项: {similar_r_p['ProfilTyp']} (Sivasnr: {similar_r_p['Sivasnr']})") + + fields_to_copy_r_p = [ + "OFWeiche_center_line_width_mm", + "OFWeiche_center_line_height_mm", + "Objekte_width_mm", + "Objekte_height_mm", + "OFWeiche_CP1_x_mm", + "OFWeiche_CP1_y_mm", + "OFWeiche_CP2_x_mm", + "OFWeiche_CP2_y_mm", + "OFWeiche_CP3_x_mm", + "OFWeiche_CP3_y_mm" + ] + + for field in fields_to_copy_r_p: + old_val = similar_r_p.get(field) + similar_r_p[field] = similar[field] + print(f" {field}: {old_val} → {similar_r_p[field]}") + + save_choice = input(f"是否确认更新此项? (直接回车确认,输入n取消): ").lower() + if save_choice == 'n': + print("此项更新已取消") + # 恢复原值 + for field in fields_to_copy_r_p: + if field in similar_r_p: + similar_r_p[field] = old_val + else: + print("没有找到R型P型对应项") + else: + + print("没有找到L→R的相似项") + +def process_doppelweiche_items(data,BogenProfileWidth, WeichenGerade): + # 筛选Doppelweiche类型的项 + filtered_items = [ + + item for item in data + if (item.get("WeichenTyp") == "Doppelweiche" and + item.get("Schaltungstyp") == "M" and + item.get("SivasnrTEF") is None) + ] + + print(f"\n\n共找到 {len(filtered_items)} 项Doppelweiche类型记录") + print("="*50) + + # 遍历每一项Doppelweiche + for idx, item in enumerate(filtered_items, 1): + print(f"\n第 {idx} 项Doppelweiche:") + print(f"Sivasnr: {item['Sivasnr']}") + print(f"ProfilTyp: {item['ProfilTyp']}") + print(f"Schaltungstyp: {item['Schaltungstyp']}") + print(f"KurvenWinkel: {item['KurvenWinkel']}") + + # 处理 OFWeiche_center_line_width_mm + current_value = item.get("OFWeiche_center_line_width_mm") + print(f"\n当前 OFWeiche_center_line_width_mm: {current_value}") + choice = input("是否修改? (y修改,直接回车跳过): ").lower() + if choice == 'y': + new_value = input(f"请输入新值 (当前: {current_value}): ") + try: + old_value = item["OFWeiche_center_line_width_mm"] + item["OFWeiche_center_line_width_mm"] = round(float(new_value), 3) if new_value.lower() != 'null' else None + print(f"值已更新: {old_value} → {item['OFWeiche_center_line_width_mm']}") + except ValueError: + print("输入无效,保持原值") + else: + print("跳过修改") + + # 处理 OFWeiche_center_line_height_mm + current_value = item.get("OFWeiche_center_line_height_mm") + print(f"\n当前 OFWeiche_center_line_height_mm: {current_value}") + choice = input("是否修改? (y修改,直接回车跳过): ").lower() + if choice == 'y': + new_value = input(f"请输入新值 (当前: {current_value}): ") + try: + old_value = item["OFWeiche_center_line_height_mm"] + item["OFWeiche_center_line_height_mm"] = round(float(new_value), 3) if new_value.lower() != 'null' else None + print(f"值已更新: {old_value} → {item['OFWeiche_center_line_height_mm']}") + except ValueError: + print("输入无效,保持原值") + else: + print("跳过修改") + + # 计算相关值 + if (item["OFWeiche_center_line_width_mm"] is not None and + item["OFWeiche_center_line_height_mm"] is not None): + + angle_rad = math.radians(item["KurvenWinkel"]) + + # 计算并打印基本值(Doppelweiche特有公式) + old_width = item.get("Objekte_width_mm") + item["Objekte_width_mm"] = round( + (BogenProfileWidth/2 * math.cos(angle_rad)) + + item["OFWeiche_center_line_width_mm"] + + BogenProfileWidth/2 * math.cos(angle_rad), 3) + print(f"\nObjekte_width_mm 计算更新: {old_width} → {item['Objekte_width_mm']}") + + old_height = item.get("Objekte_height_mm") + item["Objekte_height_mm"] = round( + (BogenProfileWidth/2 * math.sin(angle_rad)) + + item["OFWeiche_center_line_height_mm"], 3) + print(f"Objekte_height_mm 计算更新: {old_height} → {item['Objekte_height_mm']}") + + # 计算并打印CP点坐标(Doppelweiche特有公式) + item["OFWeiche_CP1_x_mm"] = round(item["Objekte_width_mm"]/2, 3) + print(f"OFWeiche_CP1_x_mm 计算更新: {item['OFWeiche_CP1_x_mm']}") + + item["OFWeiche_CP1_y_mm"] = round(item["Objekte_height_mm"], 3) + print(f"OFWeiche_CP1_y_mm 计算更新: {item['OFWeiche_CP1_y_mm']}") + + item["OFWeiche_CP2_x_mm"] = round(BogenProfileWidth/2 * math.cos(angle_rad), 3) + print(f"OFWeiche_CP2_x_mm 计算更新: {item['OFWeiche_CP2_x_mm']}") + + item["OFWeiche_CP2_y_mm"] = round(BogenProfileWidth/2 * math.sin(angle_rad), 3) + print(f"OFWeiche_CP2_y_mm 计算更新: {item['OFWeiche_CP2_y_mm']}") + + item["OFWeiche_CP3_x_mm"] = round( + BogenProfileWidth/2 * math.cos(angle_rad) + + item["OFWeiche_center_line_width_mm"], 3) + print(f"OFWeiche_CP3_x_mm 计算更新: {item['OFWeiche_CP3_x_mm']}") + + item["OFWeiche_CP3_y_mm"] = item["OFWeiche_CP2_y_mm"] + print(f"OFWeiche_CP3_y_mm 设置: {item['OFWeiche_CP3_y_mm']}") + + # 1. 查找类似项1(D型P型) + current_profil = item["ProfilTyp"] + if "S D" in current_profil: + d_p_profil = current_profil.replace("MIT M", "MIT P") + + similar_items_d_p = [x for x in data + if x["ProfilTyp"] == d_p_profil and + x.get("SivasnrTEF") is None] + + if similar_items_d_p: + print(f"\n找到 {len(similar_items_d_p)} 个D型P型相似项") + for similar in similar_items_d_p: + print(f"正在更新D型P型相似项: {similar['ProfilTyp']} (Sivasnr: {similar['Sivasnr']})") + + # 更新所有字段 + fields_to_copy = [ + "OFWeiche_center_line_width_mm", + "OFWeiche_center_line_height_mm", + "Objekte_width_mm", + "Objekte_height_mm", + "OFWeiche_CP1_x_mm", + "OFWeiche_CP1_y_mm", + "OFWeiche_CP2_x_mm", + "OFWeiche_CP2_y_mm", + "OFWeiche_CP3_x_mm", + "OFWeiche_CP3_y_mm" + ] + + for field in fields_to_copy: + old_val = similar.get(field) + similar[field] = item[field] + print(f" {field}: {old_val} → {similar[field]}") + else: + print("没有找到D型P型相似项") + + # 2. 查找类似项2(T型M型) + if "S D" in current_profil: + t_m_profil = current_profil.replace("S D", "S T") + + similar_items_t_m = [x for x in data + if x["ProfilTyp"] == t_m_profil and + x.get("SivasnrTEF") is None and + x.get("Schaltungstyp") == "M"] + + if similar_items_t_m: + print(f"\n找到 {len(similar_items_t_m)} 个T型M型相似项") + for similar in similar_items_t_m: + print(f"正在更新T型M型相似项: {similar['ProfilTyp']} (Sivasnr: {similar['Sivasnr']})") + if similar["KurvenWinkel"] == 22.5: + print("检测到KurvenWinkel=22.5,采用特殊处理方式") + + # 特殊处理逻辑 + similar["OFWeiche_center_line_width_mm"] = item["OFWeiche_center_line_width_mm"] + print(f" OFWeiche_center_line_width_mm: → {similar['OFWeiche_center_line_width_mm']}") + + similar["OFWeiche_center_line_height_mm"] = WeichenGerade + print(f" OFWeiche_center_line_height_mm: → {WeichenGerade}") + + similar["Objekte_width_mm"] = item["Objekte_width_mm"] + print(f" Objekte_width_mm: → {similar['Objekte_width_mm']}") + + similar["Objekte_height_mm"] = WeichenGerade + print(f" Objekte_height_mm: → {WeichenGerade}") + + similar["OFWeiche_CP1_x_mm"] = item["OFWeiche_CP1_x_mm"] + print(f" OFWeiche_CP1_x_mm: → {similar['OFWeiche_CP1_x_mm']}") + + similar["OFWeiche_CP1_y_mm"] = similar["Objekte_height_mm"] + print(f" OFWeiche_CP1_y_mm: → {similar['OFWeiche_CP1_y_mm']}") + + similar["OFWeiche_CP2_x_mm"] = item["OFWeiche_CP2_x_mm"] + print(f" OFWeiche_CP2_x_mm: → {similar['OFWeiche_CP2_x_mm']}") + + similar["OFWeiche_CP2_y_mm"] = 20 + print(f" OFWeiche_CP2_y_mm: → 20") + + similar["OFWeiche_CP3_x_mm"] = item["OFWeiche_CP3_x_mm"] + print(f" OFWeiche_CP3_x_mm: → {similar['OFWeiche_CP3_x_mm']}") + + similar["OFWeiche_CP3_y_mm"] = 20 + print(f" OFWeiche_CP3_y_mm: → 20") + + else: + # 更新基本字段 + base_fields = [ + "OFWeiche_center_line_width_mm", + "OFWeiche_center_line_height_mm", + "Objekte_width_mm", + "Objekte_height_mm", + "OFWeiche_CP1_x_mm", + "OFWeiche_CP1_y_mm", + "OFWeiche_CP2_x_mm", + "OFWeiche_CP2_y_mm", + "OFWeiche_CP3_x_mm", + "OFWeiche_CP3_y_mm" + ] + + for field in base_fields: + old_val = similar.get(field) + similar[field] = item[field] + print(f" {field}: {old_val} → {similar[field]}") + + # 添加CP4点(T型特有) + similar["OFWeiche_CP4_x_mm"] = round(item["Objekte_width_mm"]/2, 3) + print(f" OFWeiche_CP4_x_mm 添加: {similar['OFWeiche_CP4_x_mm']}") + + similar["OFWeiche_CP4_y_mm"] = round(item["Objekte_height_mm"] - WeichenGerade, 3) + print(f" OFWeiche_CP4_y_mm 添加: {similar['OFWeiche_CP4_y_mm']}") + + # 3. 查找T型P型对应项 + t_p_profil = t_m_profil.replace("MIT M", "MIT P") + + similar_items_t_p = [x for x in data + if x["ProfilTyp"] == t_p_profil and + x.get("SivasnrTEF") is None and + x.get("Schaltungstyp") == "P"] + + if similar_items_t_p: + print(f"\n找到 {len(similar_items_t_p)} 个T型P型对应项") + for similar_t_p in similar_items_t_p: + print(f"正在更新T型P型对应项: {similar_t_p['ProfilTyp']} (Sivasnr: {similar_t_p['Sivasnr']})") + + # 更新所有字段包括CP4点 + fields_to_copy_t_p = [ + "OFWeiche_center_line_width_mm", + "OFWeiche_center_line_height_mm", + "Objekte_width_mm", + "Objekte_height_mm", + "OFWeiche_CP1_x_mm", + "OFWeiche_CP1_y_mm", + "OFWeiche_CP2_x_mm", + "OFWeiche_CP2_y_mm", + "OFWeiche_CP3_x_mm", + "OFWeiche_CP3_y_mm", + "OFWeiche_CP4_x_mm", + "OFWeiche_CP4_y_mm" + ] + + for field in fields_to_copy_t_p: + old_val = similar_t_p.get(field) + similar_t_p[field] = similar[field] + print(f" {field}: {old_val} → {similar_t_p[field]}") + + # 添加保存确认提示 + save_choice = input(f"是否确认更新此项? (直接回车确认,输入n取消): ").lower() + if save_choice == 'n': + print("此项更新已取消") + # 恢复原值 + for field in fields_to_copy_t_p: + similar_t_p[field] = old_val + else: + print("没有找到T型P型对应项") + else: + print("没有找到T型M型相似项") +def process_dreifachweiche_items(data, WeichenkProfileWidth): + # 筛选Dreifachweiche类型的项 + filtered_items = [ + item for item in data + if (item.get("WeichenTyp") == "Dreifachweiche" and + item.get("Schaltungstyp") == "M" and + item.get("SivasnrTEF") is None) + ] + + print(f"\n\n共找到 {len(filtered_items)} 项Dreifachweiche类型记录") + print("="*50) + + for idx, item in enumerate(filtered_items, 1): + print(f"\n第 {idx} 项Dreifachweiche:") + print(f"Sivasnr: {item['Sivasnr']}") + print(f"ProfilTyp: {item['ProfilTyp']}") + + # 交互修改OFWeiche_center_line_width_mm + current_value = item.get("OFWeiche_center_line_width_mm") + print(f"\n当前 OFWeiche_center_line_width_mm: {current_value}") + choice = input("是否修改? (y修改,直接回车跳过): ").lower() + if choice == 'y': + new_value = input(f"请输入新值 (当前: {current_value}): ") + try: + old_value = item["OFWeiche_center_line_width_mm"] + item["OFWeiche_center_line_width_mm"] = round(float(new_value), 3) if new_value.lower() != 'null' else None + print(f"值已更新: {old_value} → {item['OFWeiche_center_line_width_mm']}") + except ValueError: + print("输入无效,保持原值") + + # 交互修改OFWeiche_center_line_height_mm + current_value = item.get("OFWeiche_center_line_height_mm") + print(f"\n当前 OFWeiche_center_line_height_mm: {current_value}") + choice = input("是否修改? (y修改,直接回车跳过): ").lower() + if choice == 'y': + new_value = input(f"请输入新值 (当前: {current_value}): ") + try: + old_value = item["OFWeiche_center_line_height_mm"] + item["OFWeiche_center_line_height_mm"] = round(float(new_value), 3) if new_value.lower() != 'null' else None + print(f"值已更新: {old_value} → {item['OFWeiche_center_line_height_mm']}") + except ValueError: + print("输入无效,保持原值") + + # 计算相关值 + if (item["OFWeiche_center_line_width_mm"] is not None and + item["OFWeiche_center_line_height_mm"] is not None): + + # 计算基本尺寸 + item["Objekte_width_mm"] = round(item["OFWeiche_center_line_width_mm"], 3) + print(f"\nObjekte_width_mm 计算更新: {item['Objekte_width_mm']}") + + item["Objekte_height_mm"] = round(WeichenkProfileWidth/2 + item["OFWeiche_center_line_height_mm"], 3) + print(f"Objekte_height_mm 计算更新: {item['Objekte_height_mm']}") + + # 计算控制点 + item["OFWeiche_CP1_x_mm"] = round(item["Objekte_width_mm"]/2, 3) + item["OFWeiche_CP1_y_mm"] = 0 + item["OFWeiche_CP2_x_mm"] = 0 + item["OFWeiche_CP2_y_mm"] = round(item["OFWeiche_center_line_height_mm"], 3) + item["OFWeiche_CP3_x_mm"] = round(item["OFWeiche_center_line_width_mm"], 3) + item["OFWeiche_CP3_y_mm"] = item["OFWeiche_CP2_y_mm"] + print(f"OFWeiche_CP1_x_mm: {item['OFWeiche_CP1_x_mm']}") + print(f"OFWeiche_CP1_y_mm: {item['OFWeiche_CP1_y_mm']}") + print(f"OFWeiche_CP2_x_mm: {item['OFWeiche_CP2_x_mm']}") + print(f"OFWeiche_CP2_y_mm: {item['OFWeiche_CP2_y_mm']}") + print(f"OFWeiche_CP3_x_mm: {item['OFWeiche_CP3_x_mm']}") + print(f"OFWeiche_CP3_y_mm: {item['OFWeiche_CP3_y_mm']}") + + # 查找相似项(P型) + if "WEICHE S C DELTA" in item["ProfilTyp"]: + similar_profil = item["ProfilTyp"].replace("KPL. M", "KPL. P") + + similar_items = [x for x in data + if x["ProfilTyp"] == similar_profil and + x.get("SivasnrTEF") is None] + + if similar_items: + print(f"\n找到 {len(similar_items)} 个相似P型项") + for similar in similar_items: + print(f"\n正在更新: {similar['ProfilTyp']} (Sivasnr: {similar['Sivasnr']})") + + fields_to_copy = [ + "OFWeiche_center_line_width_mm", + "OFWeiche_center_line_height_mm", + "Objekte_width_mm", + "Objekte_height_mm", + "OFWeiche_CP1_x_mm", + "OFWeiche_CP1_y_mm", + "OFWeiche_CP2_x_mm", + "OFWeiche_CP2_y_mm", + "OFWeiche_CP3_x_mm", + "OFWeiche_CP3_y_mm" + ] + + print("\n更新中:") + for field in fields_to_copy: + print(f" {field}: {similar.get(field)} → {item[field]}") + similar[field] = item[field]# 实际更新相似项的值 + + choice = input("\n确认更新此项? (回车确认/n取消): ").lower() + if choice == 'n': + print("取消此项更新") + for field in fields_to_copy: + similar[field] = similar[field] + else: + print("此项更新已确认") + + else: + print("没有找到相似P型项") + +if __name__ == "__main__": + json_file_path = "omniflo_weichen.json" # 替换为你的JSON文件路径 + modify_json_values(json_file_path) \ No newline at end of file diff --git a/SVGs/Omniflo/python/TEFBogen/.vscode/launch.json b/SVGs/Omniflo/python/TEFBogen/.vscode/launch.json deleted file mode 100644 index 552f3ae..0000000 --- a/SVGs/Omniflo/python/TEFBogen/.vscode/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Python Debugger: Current File", - "type": "debugpy", - "request": "launch", - "program": "${file}", - "args": ["1_TEF_Boegen_input.json"], - "console": "integratedTerminal" - } - ] -} \ No newline at end of file diff --git a/SVGs/Omniflo/python/TEFBogen/1_process_TEFBogen_json.py b/SVGs/Omniflo/python/TEFBogen/1_process_TEFBogen_json.py deleted file mode 100644 index 5eabb68..0000000 --- a/SVGs/Omniflo/python/TEFBogen/1_process_TEFBogen_json.py +++ /dev/null @@ -1,189 +0,0 @@ -import json -import sys -import os -from datetime import datetime - -def convert_to_float(value): - """Safely convert value to float, return original if conversion fails""" - try: - return float(value) - except (ValueError, TypeError): - return value -def process_json_file(input_file): - # Validate and prepare file paths - input_path = os.path.abspath(input_file) - if not os.path.isfile(input_path): - print(f"Error: Input file not found - {input_path}") - sys.exit(1) - - print(f"Reading file: {input_path}") - - # Read JSON file - try: - with open(input_path, 'r', encoding='utf-8') as f: - data = json.load(f) - except json.JSONDecodeError as e: - print(f"Error: Invalid JSON format in {input_path}") - print(f"Details: {str(e)}") - sys.exit(1) - except Exception as e: - print(f"Error reading file {input_path}: {str(e)}") - sys.exit(1) - - # Process each item in the JSON array - for i, item in enumerate(data): - print(f"\nProcessing item {i+1}: {item.get('Sivasnr', 'Unknown')}") - - # Convert numerical values to float - for key in item: - if isinstance(item[key], (int, float, str)) and any(x in key.lower() for x in ['mm', 'width', 'height', 'radius', 'winkel']): - item[key] = convert_to_float(item[key]) - - # 1. Add four new attributes and calculate their values - print("\nStep 1: Adding four new attributes with calculations") - - # OFBogen_CP2_x_mm - of_cp2_x = float(item["OFBogen_CP1_x_mm"]) + float(item["OFBogen_center_line_width_mm"]) - item["OFBogen_CP2_x_mm"] = round(of_cp2_x, 3) - print(f"Added OFBogen_CP2_x_mm: {item['OFBogen_CP2_x_mm']}") - - # TEFBogen_CP2_x_mm - tef_cp2_x = float(item["TEFBogen_CP1_x_mm"]) + float(item["TEFBogen_center_line_width_mm"]) - item["TEFBogen_CP2_x_mm"] = round(tef_cp2_x, 3) - print(f"Added TEFBogen_CP2_x_mm: {item['TEFBogen_CP2_x_mm']}") - - # OFBogen_CP2_y_mm - of_cp2_y = float(item["OFBogen_CP1_y_mm"]) + float(item["OFBogen_center_line_height_mm"]) - item["OFBogen_CP2_y_mm"] = round(of_cp2_y, 3) - print(f"Added OFBogen_CP2_y_mm: {item['OFBogen_CP2_y_mm']}") - - # TEFBogen_CP2_y_mm - tef_cp2_y = float(item["TEFBogen_CP1_y_mm"]) + float(item["TEFBogen_center_line_height_mm"]) - item["TEFBogen_CP2_y_mm"] = round(tef_cp2_y, 3) - print(f"Added TEFBogen_CP2_y_mm: {item['TEFBogen_CP2_y_mm']}") - - # 2. Calculate pixel dimensions and SVG dimensions - print("\nStep 2: Calculating pixel and SVG dimensions") - - # Calculate Gruppe_width_px and Gruppe_height_px - item["Gruppe_width_px"] = round(float(item["Gruppe_width_mm"]) * 3.7795, 3) - item["Gruppe_height_px"] = round(float(item["Gruppe_height_mm"]) * 3.7795, 3) - print(f"Calculated Gruppe_width_px: {item['Gruppe_width_px']}") - print(f"Calculated Gruppe_height_px: {item['Gruppe_height_px']}") - - # Compare width and height to determine scaling - if float(item["Gruppe_width_mm"]) > float(item["Gruppe_height_mm"]): - print("Width is larger, setting calculated_SVG_width to 1000px") - scale = round(1000 / float(item["Gruppe_width_mm"]), 6) - item["calculated_SVG_width_px"] = 1000 - item["calculated_SVG_height_px"] = round(float(item["Gruppe_height_mm"]) * scale+3.7795/2, 3) - scale_RD_H = round(1000 / float(item["calculated_SVG_height_px"]), 6) - scale_RD_W = 1 - elif float(item["Gruppe_width_mm"]) == float(item["Gruppe_height_mm"]): - print("Width =Height") - scale = round(1000 / float(item["Gruppe_width_mm"]), 6) - item["calculated_SVG_width_px"] = 1000 - item["calculated_SVG_height_px"] = round(float(item["Gruppe_height_mm"]) * scale, 3) - scale_RD_H = round(1000 / float(item["calculated_SVG_height_px"]), 6) - scale_RD_W = 1 - else: - print("Height is larger, setting calculated_SVG_height to 1000px") - scale = round(1000 / float(item["Gruppe_height_mm"]), 6) - item["calculated_SVG_height_px"] = 1000 - item["calculated_SVG_width_px"] = round(float(item["Gruppe_width_mm"]) * scale+3.7795/2, 3) - scale_RD_W = round(1000 / float(item["calculated_SVG_width_px"]), 6) - scale_RD_H = 1 - - print(f"Calculated scale: {scale}") - print(f"Calculated calculated_SVG_width_px: {item['calculated_SVG_width_px']}") - print(f"Calculated calculated_SVG_height_px: {item['calculated_SVG_height_px']}") - print(f"Calculated scale_RD_W: {scale_RD_W}") - print(f"Calculated scale_RD_H: {scale_RD_H}") - - # 3. Create connectionPoints array - print("\nStep 3: Creating connectionPoints array") - - connection_points = [] - - # CP1 - cp1_x = round(float(item["OFBogen_CP1_x_mm"]) * scale * scale_RD_W, 3) - cp1_y = round(float(item["OFBogen_CP1_y_mm"]) * scale * scale_RD_H, 3) - cp1 = { - "id": "cp1", - "x": cp1_x, - "y": cp1_y, - "direction": 270.0, - "linkClass": "Omniflo" - } - connection_points.append(cp1) - print(f"Created CP1: x={cp1_x}, y={cp1_y}, direction=270.0, linkClass=Omniflo") - - # CP2 - cp2_x = round(float(item["OFBogen_CP2_x_mm"]) * scale * scale_RD_W, 3) - cp2_y = round(float(item["OFBogen_CP2_y_mm"]) * scale * scale_RD_H, 3) - cp2_direction = round(90 + float(item["KurvenWinkel"]), 1) - cp2 = { - "id": "cp2", - "x": cp2_x, - "y": cp2_y, - "direction": cp2_direction, - "linkClass": "Omniflo" - } - connection_points.append(cp2) - print(f"Created CP2: x={cp2_x}, y={cp2_y}, direction={cp2_direction}, linkClass=Omniflo") - - # CP3 - cp3_x = round(float(item["TEFBogen_CP1_x_mm"]) * scale * scale_RD_W, 3) - cp3_y = round(float(item["TEFBogen_CP1_y_mm"]) * scale * scale_RD_H, 3) - cp3 = { - "id": "cp3", - "x": cp3_x, - "y": cp3_y, - "direction": 270.0, - "linkClass": "OmnifloTEF" - } - connection_points.append(cp3) - print(f"Created CP3: x={cp3_x}, y={cp3_y}, direction=270.0, linkClass=OmnifloTEF") - - # CP4 - cp4_x = round(float(item["TEFBogen_CP2_x_mm"]) * scale * scale_RD_W, 3) - cp4_y = round(float(item["TEFBogen_CP2_y_mm"]) * scale * scale_RD_H, 3) - cp4_direction = round(90 + float(item["KurvenWinkel"]), 1) - cp4 = { - "id": "cp4", - "x": cp4_x, - "y": cp4_y, - "direction": cp4_direction, - "linkClass": "OmnifloTEF" - } - connection_points.append(cp4) - print(f"Created CP4: x={cp4_x}, y={cp4_y}, direction={cp4_direction}, linkClass=OmnifloTEF") - - item["connectionPoints"] = connection_points - - # Prepare output path - output_dir = os.path.dirname(input_path) or '.' # Handle case when no directory in path - base_name = os.path.splitext(os.path.basename(input_path))[0] - timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") - output_path = os.path.join(output_dir, f"{base_name}_processed_output.json") - - # Save processed JSON file - try: - with open(output_path, 'w', encoding='utf-8') as f: - json.dump(data, f, indent=2, ensure_ascii=False) - print(f"\nProcessing complete! Results saved to new file: {output_path}") - print(f"Original file remains unchanged: {input_path}") - except Exception as e: - print(f"\nError saving processed file: {str(e)}") - sys.exit(1) - - -if __name__ == "__main__": - try: - if len(sys.argv) != 2: - raise ValueError("请提供输入文件路径") - input_file = sys.argv[1] - process_json_file(input_file) - except Exception as e: - print(f"错误详情: {str(e)}", file=sys.stderr) - sys.exit(1) diff --git a/SVGs/Omniflo/python/TEFBogen/1_process_TEFBogen_json_1.py b/SVGs/Omniflo/python/TEFBogen/1_process_TEFBogen_json_1.py new file mode 100644 index 0000000..d0be684 --- /dev/null +++ b/SVGs/Omniflo/python/TEFBogen/1_process_TEFBogen_json_1.py @@ -0,0 +1,259 @@ +import json +import sys +import os +from datetime import datetime + +def convert_to_float(value): + """Convert value to float safely, return original if conversion fails""" + try: + return float(value) + except (ValueError, TypeError): + return value + +def process_json_file(input_filename, output_filename=None): + """ + Process JSON file and generate output + + Args: + input_filename: Input file path (can be relative or absolute) + output_filename: Optional output file path. Auto-generated if not provided + """ + # Get base path from environment variable + json_base_path = os.environ.get("JSON_PATH","JSON") + if not json_base_path: + print("Error: JSON_PATH environment variable not set") + print("Please set JSON_PATH in your .bat file") + sys.exit(1) + + # Normalize path (handle path separator issues) + json_base_path = os.path.normpath(json_base_path) + + # Build full input path + if os.path.isabs(input_filename): + input_path = input_filename + else: + input_path = os.path.join(json_base_path, input_filename) + + # Convert to absolute path and normalize + input_path = os.path.abspath(os.path.normpath(input_path)) + + # Validate input file + if not os.path.isfile(input_path): + print(f"Error: Input file not found - {input_path}") + print(f"Current working directory: {os.getcwd()}") + sys.exit(1) + + print(f"\nReading file: {input_path}") + + # Read JSON file + try: + with open(input_path, 'r', encoding='utf-8') as f: + data = json.load(f) + except json.JSONDecodeError as e: + print(f"Error: Invalid JSON format in {input_path}") + print(f"Details: {str(e)}") + sys.exit(1) + except Exception as e: + print(f"Error reading file {input_path}: {str(e)}") + sys.exit(1) + + # Print found item count + total_items = len(data) + processed_items = 0 + print(f"\nFound {total_items} JSON records") + print("="*50) # Separator line + + + # 处理JSON数据 (保持原有处理逻辑不变) + for i, item in enumerate(data): + print(f"\nProcessing item {i+1}: {item.get('Sivasnr', 'Unknown')}") + + try: + # 转换数值为float + for key in item: + if isinstance(item[key], (int, float, str)) and any(x in key.lower() for x in ['mm', 'width', 'height', 'radius', 'winkel']): + item[key] = convert_to_float(item[key]) + + # 1. 添加四个新属性并计算它们的值 + print("\nStep 1: Adding four new attributes with calculations") + + # OFBogen_CP2_x_mm + of_cp2_x = float(item["OFBogen_CP1_x_mm"]) + float(item["OFBogen_center_line_width_mm"]) + item["OFBogen_CP2_x_mm"] = round(of_cp2_x, 3) + print(f"Added OFBogen_CP2_x_mm: {item['OFBogen_CP2_x_mm']}") + + # TEFBogen_CP2_x_mm + tef_cp2_x = float(item["TEFBogen_CP1_x_mm"]) + float(item["TEFBogen_center_line_width_mm"]) + item["TEFBogen_CP2_x_mm"] = round(tef_cp2_x, 3) + print(f"Added TEFBogen_CP2_x_mm: {item['TEFBogen_CP2_x_mm']}") + + # OFBogen_CP2_y_mm + of_cp2_y = float(item["OFBogen_CP1_y_mm"]) + float(item["OFBogen_center_line_height_mm"]) + item["OFBogen_CP2_y_mm"] = round(of_cp2_y, 3) + print(f"Added OFBogen_CP2_y_mm: {item['OFBogen_CP2_y_mm']}") + + # TEFBogen_CP2_y_mm + tef_cp2_y = float(item["TEFBogen_CP1_y_mm"]) + float(item["TEFBogen_center_line_height_mm"]) + item["TEFBogen_CP2_y_mm"] = round(tef_cp2_y, 3) + print(f"Added TEFBogen_CP2_y_mm: {item['TEFBogen_CP2_y_mm']}") + + # 2. 计算像素尺寸和SVG尺寸 + print("\nStep 2: Calculating pixel and SVG dimensions") + + # 计算 Gruppe_width_px 和 Gruppe_height_px + item["Gruppe_width_px"] = round(float(item["Gruppe_width_mm"]) * 3.7795, 3) + item["Gruppe_height_px"] = round(float(item["Gruppe_height_mm"]) * 3.7795, 3) + print(f"Calculated Gruppe_width_px: {item['Gruppe_width_px']}") + print(f"Calculated Gruppe_height_px: {item['Gruppe_height_px']}") + + # 比较宽度和高度以确定缩放比例 + if float(item["Gruppe_width_mm"]) > float(item["Gruppe_height_mm"]): + print("Width is larger, setting calculated_SVG_width to 1000px") + scale = round(1000 / float(item["Gruppe_width_mm"]), 6) + item["calculated_SVG_width_px"] = 1000 + item["calculated_SVG_height_px"] = round(float(item["Gruppe_height_mm"]) * scale+3.7795/2, 3) + scale_RD_H = round(1000 / float(item["calculated_SVG_height_px"]), 6) + scale_RD_W = 1 + elif float(item["Gruppe_width_mm"]) == float(item["Gruppe_height_mm"]): + print("Width = Height") + scale = round(1000 / float(item["Gruppe_width_mm"]), 6) + item["calculated_SVG_width_px"] = 1000 + item["calculated_SVG_height_px"] = round(float(item["Gruppe_height_mm"]) * scale, 3) + scale_RD_H = round(1000 / float(item["calculated_SVG_height_px"]), 6) + scale_RD_W = 1 + else: + print("Height is larger, setting calculated_SVG_height to 1000px") + scale = round(1000 / float(item["Gruppe_height_mm"]), 6) + item["calculated_SVG_height_px"] = 1000 + item["calculated_SVG_width_px"] = round(float(item["Gruppe_width_mm"]) * scale+3.7795/2, 3) + scale_RD_W = round(1000 / float(item["calculated_SVG_width_px"]), 6) + scale_RD_H = 1 + + print(f"Calculated scale: {scale}") + print(f"Calculated calculated_SVG_width_px: {item['calculated_SVG_width_px']}") + print(f"Calculated calculated_SVG_height_px: {item['calculated_SVG_height_px']}") + print(f"Calculated scale_RD_W: {scale_RD_W}") + print(f"Calculated scale_RD_H: {scale_RD_H}") + + # 3. 创建connectionPoints数组 + print("\nStep 3: Creating connectionPoints array") + + connection_points = [] + + # CP1 + cp1_x = round(float(item["OFBogen_CP1_x_mm"]) * scale * scale_RD_W, 3) + cp1_y = round(float(item["OFBogen_CP1_y_mm"]) * scale * scale_RD_H, 3) + cp1 = { + "id": "cp1", + "x": cp1_x, + "y": cp1_y, + "direction": 270.0, + "linkClass": "Omniflo" + } + connection_points.append(cp1) + print(f"Created CP1: x={cp1_x}, y={cp1_y}, direction=270.0, linkClass=Omniflo") + + # CP2 + cp2_x = round(float(item["OFBogen_CP2_x_mm"]) * scale * scale_RD_W, 3) + cp2_y = round(float(item["OFBogen_CP2_y_mm"]) * scale * scale_RD_H, 3) + cp2_direction = round(90 + float(item["KurvenWinkel"]), 1) + cp2 = { + "id": "cp2", + "x": cp2_x, + "y": cp2_y, + "direction": cp2_direction, + "linkClass": "Omniflo" + } + connection_points.append(cp2) + print(f"Created CP2: x={cp2_x}, y={cp2_y}, direction={cp2_direction}, linkClass=Omniflo") + + # CP3 + cp3_x = round(float(item["TEFBogen_CP1_x_mm"]) * scale * scale_RD_W, 3) + cp3_y = round(float(item["TEFBogen_CP1_y_mm"]) * scale * scale_RD_H, 3) + cp3 = { + "id": "cp3", + "x": cp3_x, + "y": cp3_y, + "direction": 270.0, + "linkClass": "OmnifloTEF" + } + connection_points.append(cp3) + print(f"Created CP3: x={cp3_x}, y={cp3_y}, direction=270.0, linkClass=OmnifloTEF") + + # CP4 + cp4_x = round(float(item["TEFBogen_CP2_x_mm"]) * scale * scale_RD_W, 3) + cp4_y = round(float(item["TEFBogen_CP2_y_mm"]) * scale * scale_RD_H, 3) + cp4_direction = round(90 + float(item["KurvenWinkel"]), 1) + cp4 = { + "id": "cp4", + "x": cp4_x, + "y": cp4_y, + "direction": cp4_direction, + "linkClass": "OmnifloTEF" + } + connection_points.append(cp4) + print(f"Created CP4: x={cp4_x}, y={cp4_y}, direction={cp4_direction}, linkClass=OmnifloTEF") + + item["connectionPoints"] = connection_points + # Increment success counter + processed_items += 1 + print(f"Item {i} processed successfully") + + except Exception as e: + print(f"Error processing item {i}: {str(e)}") + continue + + # Print processing statistics + print("\n" + "="*50) + print("Processing Statistics:") + print(f"Total records found: {total_items}") + print(f"Successfully processed: {processed_items}") + if total_items > 0: + success_rate = (processed_items / total_items) * 100 + print(f"Success rate: {success_rate:.2f}%") + print("="*50 + "\n") + + # Handle output file path + if output_filename is None: + base_name = os.path.splitext(os.path.basename(input_path))[0] + timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + output_filename = f"{base_name}_processed_{timestamp}.json" + + # Build output path + if os.path.isabs(output_filename): + output_path = output_filename + else: + output_path = os.path.join(json_base_path, output_filename) + + # Ensure output directory exists + os.makedirs(os.path.dirname(output_path) or '.', exist_ok=True) + + # Save processed JSON file + try: + with open(output_path, 'w', encoding='utf-8') as f: + json.dump(data, f, indent=2, ensure_ascii=False) + print(f"Processing complete! Results saved to: {output_path}") + print(f"Original file remains unchanged: {input_path}") + except Exception as e: + print(f"\nError saving processed file: {str(e)}") + sys.exit(1) + +if __name__ == "__main__": + try: + # Get JSON_PATH from environment + json_path = os.environ.get("JSON_PATH","JSON") + + # Default filenames + input_filename = "1_TEF_Boegen_input.json" + output_filename = "1_TEF_Boegen_output.json" + + # Use command line arguments if provided + if len(sys.argv) > 1: + input_filename = sys.argv[1] + if len(sys.argv) > 2: + output_filename = sys.argv[2] + + process_json_file(input_filename, output_filename) + except Exception as e: + print(f"Error: {str(e)}", file=sys.stderr) + sys.exit(1) \ No newline at end of file diff --git a/SVGs/Omniflo/python/TEFBogen/2_update_props_TEF_Boegen_from_json.py b/SVGs/Omniflo/python/TEFBogen/2_update_props_TEF_Boegen_from_json_1.py similarity index 69% rename from SVGs/Omniflo/python/TEFBogen/2_update_props_TEF_Boegen_from_json.py rename to SVGs/Omniflo/python/TEFBogen/2_update_props_TEF_Boegen_from_json_1.py index 0e118e1..dd7f543 100644 --- a/SVGs/Omniflo/python/TEFBogen/2_update_props_TEF_Boegen_from_json.py +++ b/SVGs/Omniflo/python/TEFBogen/2_update_props_TEF_Boegen_from_json_1.py @@ -1,18 +1,3 @@ -''' Script Analysis - -This Python script processes JSON and TXT files to update dimensions and connection points in SVG-related data. Here's the main logic: - Input Handling: - Reads a JSON file containing reference data - Processes all TXT files in a specified directory - Data Processing: - Creates a mapping between Sivasnr (from filenames) and JSON data - For each matching TXT file: - Updates width and height based on JSON data (converting mm to px) - Updates connection points (x, y, direction) from JSON data - Preserves the original file structure while updating specific values - Reporting: - Prints detailed change reports to console - Skips files without matching JSON data ''' import json import os import glob @@ -30,13 +15,21 @@ def process_files(json_file_path, txt_files_dir): # Create Sivasnr to JSON data mapping sivasnr_mapping = {item["Sivasnr"]: item for item in json_data} + # Initialize counters + total_files = 0 + processed_files = 0 + skipped_files = 0 + # Prepare report content report_content = [] report_content.append(f"Modification Report - {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}") + report_content.append(f"JSON Reference File: {json_file_path}") + report_content.append(f"TXT Files Directory: {txt_files_dir}") report_content.append("="*50 + "\n") # Process all TXT files for txt_file_path in glob.glob(os.path.join(txt_files_dir, '*.txt')): + total_files += 1 # Extract Sivasnr from filename sivasnr = os.path.splitext(os.path.basename(txt_file_path))[0] @@ -50,7 +43,7 @@ def process_files(json_file_path, txt_files_dir): # Prepare entry for this file file_entry = [] - file_entry.append(f"\nProcessing file: {txt_file_path}") + file_entry.append(f"\nProcessing file: {os.path.basename(txt_file_path)}") file_entry.append("="*50) # Record old values @@ -108,7 +101,9 @@ def process_files(json_file_path, txt_files_dir): file_entry.append(f" y: {change['y'][0]} → {change['y'][1]}") file_entry.append(f" direction: {change['direction'][0]} → {change['direction'][1]}") file_entry.append(f" linkClass: {change['linkClass'][0]} → {change['linkClass'][1]}") - file_entry.append(f"\nFile {txt_file_path} processed successfully") + + processed_files += 1 + file_entry.append(f"\nFile processed successfully") file_entry.append("="*50) # Add this file's entry to main report @@ -117,19 +112,41 @@ def process_files(json_file_path, txt_files_dir): # Also print to console print("\n" + "\n".join(file_entry)) else: - print(f"\nSkipping file {txt_file_path} (no matching JSON data found)") + skipped_files += 1 - # Write the report file if any changes were made - if len(report_content) > 2: # More than just the header - with open(log_file_path, 'w', encoding='utf-8') as f: - f.write("\n".join(report_content)) - print(f"\nModification report saved to: {log_file_path}") - else: - print("\nNo files were modified - no report generated") + # Add processing statistics to report + report_content.append("\n" + "="*50) + report_content.append("Processing Statistics:") + report_content.append(f"Total TXT files found: {total_files}") + report_content.append(f"Total JSON records available: {len(json_data)}") + report_content.append(f"Successfully processed: {processed_files}") + report_content.append(f"Skipped files: {skipped_files}") + if total_files > 0: + success_rate = (processed_files / len(json_data)) * 100 + report_content.append(f"Success rate: {success_rate:.2f}%") + report_content.append("="*50) + + # Print statistics to console + print("\n" + "="*50) + print("Processing Statistics:") + print(f"Total TXT files found: {total_files}") + print(f"Total JSON records available: {len(json_data)}") + print(f"Successfully processed: {processed_files}") + print(f"Skipped files: {skipped_files}") + if total_files > 0: + success_rate = (processed_files / len(json_data)) * 100 + print(f"Success rate: {success_rate:.2f}%") + print("="*50 + "\n") + + # Write the report file + with open(log_file_path, 'w', encoding='utf-8') as f: + f.write("\n".join(report_content)) + print(f"Modification report saved to: {log_file_path}") # Example usage if __name__ == "__main__": - json_file_path = "1_TEF_Boegen_input_processed_output.json" - txt_files_dir = "C:/Program Files/RuleDesigner/RDConfigurator Fusion/WebApi/Editor2D/SSG/shapes/props" + json_path = os.environ.get("JSON_PATH", "JSON") + json_file_path = os.path.join(json_path, "1_TEF_Boegen_output.json") + txt_files_dir = os.environ.get("PROPS_PATH", "props") process_files(json_file_path, txt_files_dir) - print("\nAll files processed!") \ No newline at end of file + print("\nProcessing complete!") \ No newline at end of file diff --git a/SVGs/Omniflo/python/TEFBogen/4_TEFBogen_SVG_XML_Modifier_Script.py b/SVGs/Omniflo/python/TEFBogen/4_TEFBogen_SVG_XML_Modifier_Script.py index 09dc438..8a56391 100644 --- a/SVGs/Omniflo/python/TEFBogen/4_TEFBogen_SVG_XML_Modifier_Script.py +++ b/SVGs/Omniflo/python/TEFBogen/4_TEFBogen_SVG_XML_Modifier_Script.py @@ -107,8 +107,10 @@ def main(): Main processing function """ # Configure paths - json_file_path = "1_TEF_Boegen_input.json" - svg_folder_path = r"C:\Program Files\RuleDesigner\RDConfigurator Fusion\WebApi\Editor2D\SSG\shapes\svg" + json_path=os.environ.get("JSON_PATH","JSON") + json_file_path = os.path.join(json_path,"1_TEF_Boegen_input.json") + svg_folder_path = os.environ.get("XML_PATH","svg") + try: # Read and parse JSON file diff --git a/SVGs/Omniflo/python/TEFBogen/1_TEF_Boegen_input.json b/SVGs/Omniflo/python/TEFBogen/JSON/1_TEF_Boegen_input.json similarity index 100% rename from SVGs/Omniflo/python/TEFBogen/1_TEF_Boegen_input.json rename to SVGs/Omniflo/python/TEFBogen/JSON/1_TEF_Boegen_input.json diff --git a/SVGs/Omniflo/python/TEFBogen/1_TEF_Boegen_input_processed_output.json b/SVGs/Omniflo/python/TEFBogen/JSON/1_TEF_Boegen_output.json similarity index 100% rename from SVGs/Omniflo/python/TEFBogen/1_TEF_Boegen_input_processed_output.json rename to SVGs/Omniflo/python/TEFBogen/JSON/1_TEF_Boegen_output.json diff --git a/SVGs/Omniflo/python/TEFBogen/run_Modify_color_in_XML.bat b/SVGs/Omniflo/python/TEFBogen/run_Modify_color_in_XML.bat new file mode 100644 index 0000000..b1fb235 --- /dev/null +++ b/SVGs/Omniflo/python/TEFBogen/run_Modify_color_in_XML.bat @@ -0,0 +1,12 @@ +@echo off + +set TEFBogen_PATH=%~dp0 + +set XML_PATH=C:\Program Files\RuleDesigner\RDConfigurator Fusion\WebApi\Editor2D\SSG\shapes\svg + +set JSON_PATH=%TEFBogen_PATH%JSON + +python 4_TEFBogen_SVG_XML_Modifier_Script.py + + +pause \ No newline at end of file diff --git a/SVGs/Omniflo/python/TEFBogen/run_TEFBogen.bat b/SVGs/Omniflo/python/TEFBogen/run_TEFBogen.bat new file mode 100644 index 0000000..a6a7fd9 --- /dev/null +++ b/SVGs/Omniflo/python/TEFBogen/run_TEFBogen.bat @@ -0,0 +1,12 @@ +@echo off + +set TEFBogen_PATH=%~dp0 +set PROPS_PATH=C:\Program Files\RuleDesigner\RDConfigurator Fusion\WebApi\Editor2D\SSG\shapes\props + +set JSON_PATH=%TEFBogen_PATH%JSON + +python 1_process_TEFBogen_json_1.py +python 2_update_props_TEF_Boegen_from_json_1.py + + +pause \ No newline at end of file