ParamManagerScripts/backend/script_groups/S7_DB_Utils
Miguel 884166b60e Add S7 data block and JSON documentation generator
- Created a new data block file `reconstructed_s7_source_stat.txt` containing structured data for HMI Blender parameters.
- Implemented a Python script `x5.py` to generate Markdown documentation from parsed S7 JSON data, including formatting for UDTs and DBs.
- The script includes functions for formatting data types, offsets, and generating tables for members, as well as handling current values and comments.
2025-05-17 14:48:28 +02:00
..
DB_Parser.py Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
data.json Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
db1001_data.db.txt Add S7 data block and JSON documentation generator 2025-05-17 14:48:28 +02:00
db1001_format.csv Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
db1001_format.db.txt Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
description.json Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
documentation_db_HMI_Blender_Parameters.md Add S7 data block and JSON documentation generator 2025-05-17 14:48:28 +02:00
esquema_group.json Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
esquema_work.json Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
log_x1.txt Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
log_x2.txt Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
log_x3.txt Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
parsed_s7_data.json Add S7 data block and JSON documentation generator 2025-05-17 14:48:28 +02:00
parsed_s7_data_stat.json Add S7 data block and JSON documentation generator 2025-05-17 14:48:28 +02:00
readme.md Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
reconstructed_s7_source.txt Add S7 data block and JSON documentation generator 2025-05-17 14:48:28 +02:00
reconstructed_s7_source_stat.txt Add S7 data block and JSON documentation generator 2025-05-17 14:48:28 +02:00
script_config.json Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
scripts_description.json Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
work_dir.json Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
x1.py Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
x2.py Add x4.py for S7 source code generation and documentation 2025-05-17 14:06:22 +02:00
x3.py Add S7 data block and JSON documentation generator 2025-05-17 14:48:28 +02:00
x4.py Add S7 data block and JSON documentation generator 2025-05-17 14:48:28 +02:00
x5.py Add S7 data block and JSON documentation generator 2025-05-17 14:48:28 +02:00

readme.md

How to work with config setup Example

script_root = os.path.dirname( os.path.dirname(os.path.dirname(os.path.dirname(file))) ) sys.path.append(script_root) from backend.script_utils import load_configuration

if name == "main": """ Load configuration from script_config.json in the current script directory.

Returns:
    Dict containing configurations with levels 1, 2, 3 and working_directory

Example usage in scripts:
    from script_utils import load_configuration

    configs = load_configuration()
    level1_config = configs.get("level1", {})
    level2_config = configs.get("level2", {})
    level3_config = configs.get("level3", {})
    working_dir = configs.get("working_directory", "")

""""

configs = load_configuration()
working_directory = configs.get("working_directory")

# Acceder a la configuración específica del grupo
group_config = configs.get("level2", {})

# Leer parámetros con valores por defecto (usando los defaults del esquema como guía)
# Parámetros necesarios para x4
cfg_scl_output_dirname = group_config.get("scl_output_dir", "scl_output")
cfg_xref_output_dirname = group_config.get("xref_output_dir", "xref_output")
cfg_xref_source_subdir = group_config.get("xref_source_subdir", "source")

Directory structure for Tia Portal scripts

<working_directory>/ ├── <Project_Name>_CAx_Export.aml ├── <PLC1_Name>/ │ ├── ProgramBlocks_XML/ │ │ └── ... (archivos XML de bloques) │ ├── ProgramBlocks_SCL/ │ │ └── ... (archivos SCL de bloques) │ ├── ProgramBlocks_CR/ │ │ └── ... (archivos XML de referencias cruzadas de bloques) │ ├── PlcTags/ │ │ └── ... (archivos XML de tablas de tags) │ ├── PlcTags_CR/ │ │ └── ... (archivos XML de referencias cruzadas de tablas de tags) │ ├── PlcDataTypes_CR/ │ │ └── ... (archivos XML de referencias cruzadas de UDTs) │ ├── SystemBlocks_CR/ │ │ └── ... │ └── SoftwareUnits_CR/ │ └── ... │ └── Documentation/ │ └── Source │ └── ... (archivos md de bloques de programa) │ └── JSON │ └── ... (archivos JSON temporales) │ └── xref_calls_tree.md │ └── xref_db_usage_summary.md │ └── xref_plc_tags_summary.md │ └── full_project_representation.md │ └── <Project_Name>_CAx_Export_Hardware_Tree.md

├── <PLC2_Name>/ │ ├── ProgramBlocks_XML/ │ │ └── ... │ └── ... └── ...