diff --git a/Editor2DLibrary/SSG/shapes/props/834342001.txt b/Editor2DLibrary/SSG/shapes/props/834342001.txt
index 8c2597b..e610e66 100644
--- a/Editor2DLibrary/SSG/shapes/props/834342001.txt
+++ b/Editor2DLibrary/SSG/shapes/props/834342001.txt
@@ -1,4 +1,4 @@
-{
+{
"shapeMode": 0,
"name": "Weichenkörper Einfach 22.5° rechts M",
"family": "OFWeiche",
diff --git a/Editor2DLibrary/SSG/shapes/props/834342002.txt b/Editor2DLibrary/SSG/shapes/props/834342002.txt
index 24b633b..e2363ec 100644
--- a/Editor2DLibrary/SSG/shapes/props/834342002.txt
+++ b/Editor2DLibrary/SSG/shapes/props/834342002.txt
@@ -1,4 +1,4 @@
-{
+{
"shapeMode": 0,
"name": "Weichenkörper Einfach 22.5° rechts P",
"family": "OFWeiche",
diff --git a/Editor2DLibrary/SSG/shapes/props/834342012.txt b/Editor2DLibrary/SSG/shapes/props/834342012.txt
index 2cc48d7..049cd76 100644
--- a/Editor2DLibrary/SSG/shapes/props/834342012.txt
+++ b/Editor2DLibrary/SSG/shapes/props/834342012.txt
@@ -1,4 +1,4 @@
-{
+{
"shapeMode": 0,
"name": "Weichenkörper Einfach 22.5° links P",
"family": "OFWeiche",
diff --git a/Editor2DLibrary/SSG/shapes/props/OFWeicheParallelEinfach.txt b/Editor2DLibrary/SSG/shapes/props/OFWeicheParallelEinfach.txt
index 48706c5..2588840 100644
--- a/Editor2DLibrary/SSG/shapes/props/OFWeicheParallelEinfach.txt
+++ b/Editor2DLibrary/SSG/shapes/props/OFWeicheParallelEinfach.txt
@@ -1,4 +1,4 @@
-{
+{
"shapeMode": 0,
"name": "Einfach Parallel 200/750 links M",
"family": "OFWeiche",
@@ -62,7 +62,7 @@
"zMin": "",
"zMax": "",
"zStep": "",
- "direction": 360,
+ "direction": 360.0,
"linkClass": "Omniflo",
"label": "",
"isDimension": true
diff --git a/Editor2DLibrary/SSG/shapes/svg/834342001.xml b/Editor2DLibrary/SSG/shapes/svg/834342001.xml
index eeaafaa..22e62f7 100644
--- a/Editor2DLibrary/SSG/shapes/svg/834342001.xml
+++ b/Editor2DLibrary/SSG/shapes/svg/834342001.xml
@@ -1,14 +1,13 @@
-
diff --git a/Editor2DLibrary/SSG/shapes/svg/OFWeicheParallelEinfach.xml b/Editor2DLibrary/SSG/shapes/svg/OFWeicheParallelEinfach.xml
index 6c689bf..52bdac2 100644
--- a/Editor2DLibrary/SSG/shapes/svg/OFWeicheParallelEinfach.xml
+++ b/Editor2DLibrary/SSG/shapes/svg/OFWeicheParallelEinfach.xml
@@ -1,4 +1,3 @@
-
@@ -13,7 +12,7 @@
-
+
diff --git a/Editor2DLibrary/SSG/shapes/svg/OFWeichenkoerperEinfach.xml b/Editor2DLibrary/SSG/shapes/svg/OFWeichenkoerperEinfach.xml
index 0261774..42d8955 100644
--- a/Editor2DLibrary/SSG/shapes/svg/OFWeichenkoerperEinfach.xml
+++ b/Editor2DLibrary/SSG/shapes/svg/OFWeichenkoerperEinfach.xml
@@ -1,14 +1,13 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/MAIN_SSG.rdx b/MAIN_SSG.rdx
index ae8b23b..a1c6ffe 100644
--- a/MAIN_SSG.rdx
+++ b/MAIN_SSG.rdx
@@ -1,6 +1,6 @@
-
+
@@ -90,7 +90,7 @@
-
+
@@ -99,7 +99,7 @@
-
+
@@ -174,7 +174,7 @@
-
+
@@ -23244,15 +23244,6 @@ SSGConnectionPoint.x_M
-
-
-
-
-
-
-
-
-
@@ -26436,7 +26427,7 @@ SSGConnectionPoint.x_M
-
+
@@ -26449,6 +26440,10 @@ SSGConnectionPoint.x_M
+
+
+
+
diff --git a/SVGs/Omniflo/Weichen/outputdir_Kopie/Weiche_Parallel_200_750_R_M_834372050.svg b/SVGs/Omniflo/Weichen/outputdir_Kopie/Weiche_Parallel_200_750_R_M_834372050.svg
index 0ba0dba..6df378a 100644
--- a/SVGs/Omniflo/Weichen/outputdir_Kopie/Weiche_Parallel_200_750_R_M_834372050.svg
+++ b/SVGs/Omniflo/Weichen/outputdir_Kopie/Weiche_Parallel_200_750_R_M_834372050.svg
@@ -1,6 +1,6 @@
-
-
+
+
@@ -9,6 +9,6 @@
-
+
diff --git a/SVGs/Omniflo/Weichen/outputdir_Kopie/Weiche_Parallel_200_750_R_P_834372051.svg b/SVGs/Omniflo/Weichen/outputdir_Kopie/Weiche_Parallel_200_750_R_P_834372051.svg
index 432f3a9..29d53b3 100644
--- a/SVGs/Omniflo/Weichen/outputdir_Kopie/Weiche_Parallel_200_750_R_P_834372051.svg
+++ b/SVGs/Omniflo/Weichen/outputdir_Kopie/Weiche_Parallel_200_750_R_P_834372051.svg
@@ -1,6 +1,6 @@
-
-
+
+
@@ -9,6 +9,6 @@
-
+
diff --git a/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_L_M_834342011.svg b/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_L_M_834342011.svg
index 5b8327f..8336386 100644
--- a/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_L_M_834342011.svg
+++ b/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_L_M_834342011.svg
@@ -1,11 +1,11 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_L_P_834342012.svg b/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_L_P_834342012.svg
index c6602f8..173d20e 100644
--- a/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_L_P_834342012.svg
+++ b/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_L_P_834342012.svg
@@ -1,11 +1,11 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_R_M_834342001.svg b/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_R_M_834342001.svg
index 1a0d4b8..991b30b 100644
--- a/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_R_M_834342001.svg
+++ b/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_R_M_834342001.svg
@@ -1,11 +1,11 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_R_P_834342002.svg b/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_R_P_834342002.svg
index 20d5d11..f581d6c 100644
--- a/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_R_P_834342002.svg
+++ b/SVGs/Omniflo/Weichen/outputdir_Kopie/Weichenkörper_R_P_834342002.svg
@@ -1,11 +1,11 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/SVGs/Omniflo/bin/01_svg_optimze.bat b/SVGs/Omniflo/bin/01_svg_optimze.bat
index 29726d5..05ac0c7 100644
--- a/SVGs/Omniflo/bin/01_svg_optimze.bat
+++ b/SVGs/Omniflo/bin/01_svg_optimze.bat
@@ -13,8 +13,9 @@ if %ERRORLEVEL% neq 0 (
:: Run the Python script
echo Running SVG optimizer...
-python %RD_CONF_LIB%\3_svg_optimizer-Step1.py %*
-
+python %RD_CONF_LIB%\3_svg_optimizer_Step1.py %*
+python %RD_CONF_LIB%\3_svg_scaler_Step2.py %*
+python %RD_CONF_LIB%\3_svg_scaler_Step3.py %*
:: Check if Python script succeeded
if %ERRORLEVEL% equ 0 (
echo SVG optimization completed successfully
diff --git a/SVGs/Omniflo/bin/optimize_easy.bat b/SVGs/Omniflo/bin/optimize_easy.bat
index 8a4d7fe..2aed708 100644
--- a/SVGs/Omniflo/bin/optimize_easy.bat
+++ b/SVGs/Omniflo/bin/optimize_easy.bat
@@ -35,8 +35,9 @@ if %ERRORLEVEL% equ 3 set "arg=--weichen"
if %ERRORLEVEL% equ 4 set "arg=--tefweichen"
REM Execute Python script with selected argument
-python "%RD_CONF_LIB%\3_svg_optimizer-Step1.py" %arg%
-
+python %RD_CONF_LIB%\3_svg_optimizer_Step1.py %*
+python %RD_CONF_LIB%\3_svg_scaler_Step2.py %*
+python %RD_CONF_LIB%\3_svg_scaler_Step3.py %*
REM Check execution status
if %ERRORLEVEL% equ 0 (
echo SVG optimization completed successfully!
diff --git a/SVGs/Omniflo/bin/setenv.bat b/SVGs/Omniflo/bin/setenv.bat
index cd9bca9..266226c 100644
--- a/SVGs/Omniflo/bin/setenv.bat
+++ b/SVGs/Omniflo/bin/setenv.bat
@@ -6,11 +6,13 @@ set RD_CONF=%cd%
set RD_CONF_BIN=%RD_CONF%\bin
set RD_CONF_CFG=%RD_CONF%\cfg
set RD_CONF_WORK=%RD_CONF%\work
+set RD_CONF_OUTPUT=%RD_CONF%\Weichen\outputdir
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\neu_backup
+set RD_CONF_WEICHEN=%RD_CONF%\Weichen\neu_original_backup
set RD_CONF_TEFWEICHEN=%RD_CONF%\TEFWeichen
diff --git a/SVGs/Omniflo/doc/Omniflo_2D_Erzeugung.md b/SVGs/Omniflo/doc/Omniflo_2D_Erzeugung.md
index e9885f9..ac19ae2 100644
--- a/SVGs/Omniflo/doc/Omniflo_2D_Erzeugung.md
+++ b/SVGs/Omniflo/doc/Omniflo_2D_Erzeugung.md
@@ -3,13 +3,29 @@
für die Umsetzung der 2D-Library im Rule Designer sind folgende Schritte vorgesehen – unterteilt in TXT und SVG:
-**TXT-Daten:**
+**PROPS-TXT-Daten:**
1. JSON-Struktur vorbereiten: inkl. Gesamtbreite, Gesamthöhe sowie Breite und Höhe der Mittellinie.
2. CPs (Connection Points): Richtung und Position der CPs berechnen.
3. Daten aus JSON in der lokalen RD-Installation als Props importieren.
+**Props-Bearbeitung:**
+
+1. Führe run_OFWeiche.bat im Ordner OFWeiche aus.
+2. Kopiere den Ordner SSG erneut in den Git-Ordner.
+3. Führe git push aus.
+
**SVG-Daten:**
1. DWG-Dateien exportieren und in SVG umwandeln.
2. SVG optimieren: z. B. Polylinien in einfache Linien umwandeln.
3. Viewbox im SVG definieren, um saubere Skalierung zu gewährleisten.
4. Aus dem SVG Symbol generieren.
+
+**SVG-Bearbeitung:**
+
+1. Führe optimize_easy.bat im Ordner SSG-Ruledesigner-Konfigurator\SVGs\Omniflo\bin aus, um die SVGs vorzubereiten.
+2. Bearbeite die SVGs im Ordner outputdir manuell in Inkscape : Passe den viewbox an und entferne Hilfslinien (füge fill:none, stroke:none hinzu) bei Einfachweichen und Deltaweichen.
+3. Kopiere die bearbeiteten Dateien in outputdir_kopie, um pneumatische Weichen-SVGs zu erstellen.
+4. Füge die SVGs manuell im 2D-Wizard hinzu.
+5. Führe 6_update_XML_Strich_WK.py im Ordner OFWeiche aus, um Hilfslinien erneut zu deaktivieren.
+6. Kopiere den Ordner SSG aus C:\Program Files\RuleDesigner\...\Editor2D in den Git-Ordner Editor2DLibrary.
+7. Führe git push aus.
\ 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
similarity index 100%
rename from SVGs/Omniflo/lib/3_svg_optimizer-Step1.py
rename to SVGs/Omniflo/lib/3_svg_optimizer_Step1.py
diff --git a/SVGs/Omniflo/lib/3_svg_scaler-Step2.py b/SVGs/Omniflo/lib/3_svg_scaler_Step2.py
similarity index 96%
rename from SVGs/Omniflo/lib/3_svg_scaler-Step2.py
rename to SVGs/Omniflo/lib/3_svg_scaler_Step2.py
index 4db40fa..07a9b5f 100644
--- a/SVGs/Omniflo/lib/3_svg_scaler-Step2.py
+++ b/SVGs/Omniflo/lib/3_svg_scaler_Step2.py
@@ -153,6 +153,6 @@ def batch_process_svg(input_dir: str, output_dir: str):
print("\nAll files processed successfully!")
if __name__ == '__main__':
- input_dir = r'C:\Users\y.wang\Documents\SSG-Ruledesigner-Konfigurator\SVGs\Omniflo\work'
- output_dir = r'C:\Users\y.wang\Documents\SSG-Ruledesigner-Konfigurator\SVGs\Omniflo\Weichen'
+ input_dir = os.environ.get('RD_CONF_WORK')
+ output_dir = os.environ.get('RD_CONF_WORK')
batch_process_svg(input_dir, output_dir)
diff --git a/SVGs/Omniflo/lib/3_svg_scaler-Step3.py b/SVGs/Omniflo/lib/3_svg_scaler_Step3.py
similarity index 95%
rename from SVGs/Omniflo/lib/3_svg_scaler-Step3.py
rename to SVGs/Omniflo/lib/3_svg_scaler_Step3.py
index f64a118..1bf5eef 100644
--- a/SVGs/Omniflo/lib/3_svg_scaler-Step3.py
+++ b/SVGs/Omniflo/lib/3_svg_scaler_Step3.py
@@ -154,7 +154,7 @@ def batch_process_svgs(input_dir: str, output_dir: str):
print(f"\nCompleted: {success_count} files processed")
if __name__ == '__main__':
- input_dir = r'C:\Users\y.wang\Documents\SSG-Ruledesigner-Konfigurator\SVGs\Omniflo\Weichen'
- output_dir = r'C:\Users\y.wang\Documents\SSG-Ruledesigner-Konfigurator\SVGs\Omniflo\Weichen\outputdir'
+ input_dir = os.environ.get('RD_CONF_WORK')
+ output_dir = os.environ.get('RD_CONF_OUTPUT')
# Example usage:
batch_process_svgs(input_dir, output_dir)
\ No newline at end of file
diff --git a/SVGs/Omniflo/python/OFWeiche/4_update_SVG_in_Props.py b/SVGs/Omniflo/python/OFWeiche/4_update_SVG_in_Props.py
deleted file mode 100644
index 3281c25..0000000
--- a/SVGs/Omniflo/python/OFWeiche/4_update_SVG_in_Props.py
+++ /dev/null
@@ -1,125 +0,0 @@
-import os
-import json
-import re
-import shutil
-
-def extract_sivasnr_from_svg(filename):
- """
- Extracts the sivasnr (numeric ID) from the SVG filename.
- Example: "DeltaWeiche_1400_700_M_834372400.svg" → "834372400"
- """
- match = re.search(r'_(\d+)\.svg$', filename)
- return match.group(1) if match else None
-
-def convert_svg_to_xml(svg_path, output_folder):
- """
- Converts an SVG file to an XML file (renames it) and saves it in `output_folder`.
- Returns the relative path in the format: "SSG/shapes/svg/{sivasnr}.xml"
- """
- os.makedirs(output_folder, exist_ok=True)
- sivasnr = extract_sivasnr_from_svg(os.path.basename(svg_path))
- if not sivasnr:
- raise ValueError(f"Could not extract sivasnr from SVG: {svg_path}")
-
- xml_filename = f"{sivasnr}.xml"
- xml_relative_path = f"SSG/shapes/svg/{xml_filename}" # Format: "SSG/shapes/svg/834372400.xml"
- xml_abs_path = os.path.join(output_folder, xml_filename)
-
- # Copy SVG to XML (same content, just renamed)
- shutil.copy2(svg_path, xml_abs_path)
- return xml_relative_path # Return the relative path for TXT file
-
-def update_txt_srcsvg(txt_path, new_srcsvg_value):
- """
- Updates the "srcSVG" field in a TXT file with the relative path.
- Format: "SSG/shapes/svg/{sivasnr}.xml"
- """
- try:
- with open(txt_path, 'r', encoding='utf-8') as f:
- data = json.load(f)
-
- data["srcSVG"] = new_srcsvg_value # Write the relative path
-
- with open(txt_path, 'w', encoding='utf-8') as f:
- json.dump(data, f, indent=4, ensure_ascii=False)
-
- return True
- except Exception as e:
- print(f"❌ Failed to update {txt_path}: {str(e)}")
- return False
-
-def process_svg_files(svg_folder, prorps_folder, output_folder="shapes/svg"):
- """
- Processes all SVG files:
- 1. Extracts sivasnr.
- 2. Converts SVG to XML in `output_folder`.
- 3. Updates the TXT file with "SSG/shapes/svg/{sivasnr}.xml".
- """
- if not os.path.exists(svg_folder):
- print(f"❌ Error: SVG folder not found: {svg_folder}")
- return
-
- if not os.path.exists(prorps_folder):
- print(f"❌ Error: Prorps folder not found: {prorps_folder}")
- return
-
- os.makedirs(output_folder, exist_ok=True)
- svg_files = [f for f in os.listdir(svg_folder) if f.endswith('.svg')]
- total_files = len(svg_files)
- success_count = 0
- failed_count = 0
-
- print(f"\n🔍 Found {total_files} SVG files in: {svg_folder}")
- print(f"📂 TXT files will be read from: {prorps_folder}")
- print(f"💾 XML files will be saved to: {output_folder}\n")
-
- for svg_filename in svg_files:
- svg_path = os.path.join(svg_folder, svg_filename)
- sivasnr = extract_sivasnr_from_svg(svg_filename)
-
- if not sivasnr:
- print(f"❌ Skipping {svg_filename}: Could not extract sivasnr.")
- failed_count += 1
- continue
-
- print(f"🔄 Processing: {svg_filename} (sivasnr={sivasnr})")
-
- try:
- # Step 1: Convert SVG to XML and get relative path
- xml_relative_path = convert_svg_to_xml(svg_path, output_folder)
- print(f" ✅ Converted to XML: {xml_relative_path}")
-
- # Step 2: Update TXT file with relative path
- txt_path = os.path.join(prorps_folder, f"{sivasnr}.txt")
- if not os.path.exists(txt_path):
- print(f" ❌ TXT file not found: {os.path.basename(txt_path)}")
- failed_count += 1
- continue
-
- if update_txt_srcsvg(txt_path, xml_relative_path):
- print(f" ✅ Updated TXT: {os.path.basename(txt_path)}")
- success_count += 1
- else:
- failed_count += 1
-
- except Exception as e:
- print(f" ❌ Error processing {svg_filename}: {str(e)}")
- failed_count += 1
-
- # Print summary
- print("\n📊 Processing Summary:")
- print(f" - Total SVG files: {total_files}")
- print(f" - Successfully processed: {success_count}")
- print(f" - Failed: {failed_count}")
- if total_files > 0:
- print(f" - Success rate: {(success_count / total_files) * 100:.2f}%")
-
-
-if __name__ == "__main__":
- # Configuration - modify these paths as needed
- SVG_FOLDER = r"C:\Users\y.wang\Documents\SSG-Ruledesigner-Konfigurator\SVGs\Omniflo\Weichen\outputdir" # Folder containing SVG files
- PRORPS_FOLDER = r"C:\Program Files\RuleDesigner\RDConfigurator Fusion\WebApi\Editor2D\SSG\shapes\props" # Folder containing txt files
- OUTPUT_FOLDER = r"C:\Program Files\RuleDesigner\RDConfigurator Fusion\WebApi\Editor2D\SSG\shapes\svg"
- # Start processing
- process_svg_files(SVG_FOLDER, PRORPS_FOLDER, OUTPUT_FOLDER)
- print("\nProcessing complete.")
\ No newline at end of file
diff --git a/SVGs/Omniflo/python/OFWeiche/5_OFWeiche_SVG_XML_Modifier_Script.py b/SVGs/Omniflo/python/OFWeiche/5_OFWeiche_SVG_XML_Modifier_Script.py
deleted file mode 100644
index 62f1f65..0000000
--- a/SVGs/Omniflo/python/OFWeiche/5_OFWeiche_SVG_XML_Modifier_Script.py
+++ /dev/null
@@ -1,150 +0,0 @@
-"""
-SVG XML Batch Modifier Script
-
-This script:
-1. Reads a JSON array of items
-2. For each item, extracts the "Sivasnr" value
-3. Locates and modifies the corresponding XML file
-4. Provides comprehensive reporting
-"""
-
-import json
-import os
-import xml.etree.ElementTree as ET
-from xml.etree.ElementTree import Element, SubElement, tostring
-
-def process_xml_file(xml_path):
- """
- Process a single XML file with proper namespace handling
- Returns modification statistics
- """
- try:
- tree = ET.parse(xml_path)
- root = tree.getroot()
-
- # Register and handle SVG namespace
- ET.register_namespace('', 'http://www.w3.org/2000/svg')
- namespaces = {'svg': 'http://www.w3.org/2000/svg'}
-
- stats = {
- 'ffe31b_groups': 0,
- 'ec2525_groups': 0,
- 'elements_modified': 0,
- 'modified': False
- }
-
- # Process all group elements
- for g in root.findall('.//svg:g', namespaces):
- stroke = g.get('stroke')
-
- if stroke == "#ffe31b":
- stats['ffe31b_groups'] += 1
-
- if 'stroke-width' in g.attrib:
- del g.attrib['stroke-width']
- stats['modified'] = True
- if 'stroke-miterlimit' in g.attrib:
- del g.attrib['stroke-miterlimit']
- stats['modified'] = True
-
- for child in g.findall('.//svg:path', namespaces):
- child.set('stroke-width', '1px')
- stats['elements_modified'] += 1
- stats['modified'] = True
-
- elif stroke == "#ec2525":
- stats['ec2525_groups'] += 1
-
- for attr in ['stroke', 'stroke-width', 'stroke-linejoin']:
- if attr in g.attrib:
- del g.attrib[attr]
- stats['modified'] = True
-
- for child in g.findall('.//svg:path[@stroke-width="1px"]', namespaces):
- del child.attrib['stroke-width']
- child.set('style', 'stroke:#ec2525;stroke-width:2px')
- stats['elements_modified'] += 1
- stats['modified'] = True
-
- # Save changes if modified
- if stats['modified']:
- xml_str = ET.tostring(root, encoding='unicode')
- xml_str = xml_str.replace('><', '>\n<').replace('', '\n')
-
- with open(xml_path, 'w', encoding='utf-8') as f:
- f.write(xml_str)
-
- return stats
-
- except Exception as e:
- print(f" Error processing file: {str(e)}")
- return None
-
-def main():
- """
- Main processing function
- """
- json_path=os.environ.get("JSON_PATH","JSON")
- json_file_path = os.path.join(json_path,"omniflo_weichen_output.json")
- svg_folder_path = os.environ.get("XML_PATH","svg")
-
- try:
- # Read and parse JSON file
- with open(json_file_path, 'r', encoding='utf-8') as f:
- data = json.load(f)
-
- # Verify we have a list of items
- if not isinstance(data, list):
- print("Error: JSON data should be an array of items")
- return
-
- print(f"\nFound {len(data)} items in JSON file")
-
- # Process each item in the JSON array
- for index, item in enumerate(data, 1):
- if not isinstance(item, dict):
- print(f"\nItem {index}: Not a dictionary, skipping")
- continue
-
- sivasnr = item.get("Sivasnr")
- if not sivasnr:
- print(f"\nItem {index}: Missing 'Sivasnr' value, skipping")
- continue
-
- print(f"\nProcessing item {index}: Sivasnr = {sivasnr}")
-
- # Build XML filename and path
- xml_filename = f"{sivasnr}.xml"
- xml_path = os.path.join(svg_folder_path, xml_filename)
-
- if not os.path.exists(xml_path):
- print(f" XML file not found: {xml_path}")
- continue
-
- print(f" Found XML file: {xml_path}")
-
- # Process the XML file
- stats = process_xml_file(xml_path)
-
- if stats is None:
- print(" Processing failed")
- elif stats['modified']:
- print(" File successfully modified")
- print(f" - #ffe31b groups: {stats['ffe31b_groups']}")
- print(f" - #ec2525 groups: {stats['ec2525_groups']}")
- print(f" - Elements modified: {stats['elements_modified']}")
- else:
- print(" No modifications needed")
-
- print("\nProcessing complete")
-
- except FileNotFoundError:
- print("\nError: JSON file not found")
- except json.JSONDecodeError:
- print("\nError: Invalid JSON format")
- except Exception as e:
- print(f"\nUnexpected error: {str(e)}")
-
-if __name__ == "__main__":
- print("SVG XML Batch Modifier - Starting execution")
- main()
\ No newline at end of file
diff --git a/SVGs/Omniflo/python/OFWeiche/run_Modify_color_in_XML.bat b/SVGs/Omniflo/python/OFWeiche/run_Modify_color_in_XML.bat
deleted file mode 100644
index eb516ab..0000000
--- a/SVGs/Omniflo/python/OFWeiche/run_Modify_color_in_XML.bat
+++ /dev/null
@@ -1,12 +0,0 @@
-@echo off
-
-set OFWeiche_PATH=%~dp0
-
-set XML_PATH=C:\Program Files\RuleDesigner\RDConfigurator Fusion\WebApi\Editor2D\SSG\shapes\svg
-
-set JSON_PATH=%OFWeiche_PATH%JSON
-
-python 5_OFWeiche_SVG_XML_Modifier_Script.py
-
-
-pause
\ No newline at end of file