Implementing a script interface for the IO mapping configuration is one of the improvements in our ToDo-List (CDS-37756
), but it is not scheduled yet.
On the other hand, CODESYS already has a feature which may be helpful for your goal: For Devices in the context menu, there are two commands (see the attached screenshot) to allow the import and export of IO Mappings in CSV format.
Those commands can also be triggered by python scripts, for example:
dev = projects.primary.find("Device")
system.commands["device", "exportcsv"].execute("D:\\DeviceExport.csv", str(dev.handle), str(dev.guid))
The parameters are filename, projecthandle, objectguid, each of them as a string. For the import, the command is ["device", "importcsv"].
PS: The execute() function on the commands is intentionally not documented, but having a "backdoor" in cases like yours where the scripting API is missing functionality are exactly the reasons why we implemented it.
Check out the CODESYS store: http://store.codesys.com/CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions