2025-05-16 18:05:34 +04:00
2025-05-16 18:05:34 +04:00
2025-05-16 18:05:34 +04:00
2025-05-16 18:05:34 +04:00
2025-05-16 18:05:34 +04:00
2025-05-16 18:05:34 +04:00
2025-05-16 18:05:34 +04:00
2025-05-16 18:05:34 +04:00
2025-05-16 18:05:34 +04:00
2025-05-16 22:24:40 +04:00
2025-05-16 18:05:34 +04:00

TagProps Transformer

This tool transforms tag properties in JSON files by replacing the first value in the tagProps array with a path based on the element's name, an MCM number, and a device type.

MCM Folder Organization

The tool can also organize tags according to MCMs (Master Control Modules) in your Ignition project. This process will:

  1. Process all MCM folders in your Detailed-Views directory
  2. Update view.json files with proper tag paths
  3. Generate a consolidated tags.json file with all MCM tag structures

Usage for MCM Organization

python process_tags.py "C:\Program Files\Inductive Automation\Ignition\data\projects\YOUR_PROJECT\com.inductiveautomation.perspective\views\Detailed-Views" -o "outputs"

Replace YOUR_PROJECT with your actual Ignition project name.

Example:

python process_tags.py "C:\Program Files\Inductive Automation\Ignition\data\projects\MTN6_SCADA\com.inductiveautomation.perspective\views\Detailed-Views" -o "outputs"

This will:

  1. Scan all MCM folders in the Detailed-Views directory
  2. Process each view.json file in the MCM folders
  3. Update the view.json files with proper tag paths
  4. Generate a consolidated tags.json file in the outputs directory

Output Structure

The generated tags.json file will contain:

  • All MCMs from your Detailed-Views folder
  • Properly organized tag structures for each MCM
  • Merged tags for MCMs that have multiple folders (e.g., MCM02 with both "Fluid Inbound Merges 5-7" and "Fluid Inbound Upper")

Single File Transformation

For transforming individual JSON files:

python tag_transformer.py <input_file.json> <mcm_number> [device_type]

Example:

python tag_transformer.py sample_input.json 07 Conveyor

This will:

  1. Read the input JSON file (sample_input.json)
  2. For each element in the JSON, replace only the first value in the tagProps array with System/MCM07/Conveyor/[ElementName]
  3. Output the transformed JSON to the console

Auto Device Type Detection

If you don't specify a device type, the script will automatically determine the device type based on the element name:

  • If the name contains EPC followed by "End" (e.g., EPCEnd, EPC_End, EPC1_End, EPC2_End_1), the device type will be EPC_End
  • If the name contains EPC followed by a number (e.g., EPC1, EPC2, EPC_1), the device type will be EPC
  • If the name contains EPC followed by "Line" (e.g., EPCLine, EPC_Line), the device type will be EPC_Line
  • For all other cases, the device type will be status

Example:

python tag_transformer.py sample_input.json 07

Output Format

The output will be a valid JSON array with the same structure as the input, but with the first value in each tagProps array replaced with the generated path.

Saving Output to a File

To save the output to a file, you can redirect the console output:

python tag_transformer.py sample_input.json 07 Conveyor > output.json

Requirements

  • Python 3.6+
  • No additional dependencies required
Description
No description provided
Readme 219 KiB
Languages
Python 100%