Dev.to AI 🤖 Ai 👁 0

CODESYS AI Practice — Import/Export Files

In CODESYS v3, code lives inside the project — a binary file. AI cannot open or edit it. In the AI era we need a way for AI to operate on the files inside the project. Goal Close the loop: project ⇄ text ⇄ A

CODESYS AI Practice — Import/Export Files

In CODESYS v3, code lives inside the project — a binary file. AI cannot open or edit it.

In the AI era we need a way for AI to operate on the files inside the project.

Goal

Close the loop: project ⇄ text ⇄ AI.

Export POUs to text, let the AI edit them, import them back into the project.

Constraints

  • CODESYS must stay the source of truth for the project structure
  • Import must not corrupt an existing project
  • Prefer a small, scriptable tool over a heavy IDE plugin

Approach

  1. Export selected POUs (declaration + implementation) to plain text files
  2. Edit the text (AI or human)
  3. Import: backup, compare, write back, save

Creating or deleting POUs is not supported in this pass — only updating existing ones.

Export, edit, import loop

Exported project tree

Import pipeline

Import does four things before touching the live project:

  1. Backup — snapshot first
  2. Compare — diff bodies
  3. Write back — set POU code
  4. Save — persist the project

Import pipeline: backup, compare, write back, save

Notes

  • Update only: creating or deleting POUs is not supported in this version
  • Declarations and implementations are paired per POU
  • After import, rebuild in CODESYS to verify

Repository and tooling details follow the same codesys-sync / codesys-connect series used elsewhere on this blog.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.