PLC-Variablentabellen exportieren - TIAPortal

TIA Portal Openness: API für die Automatisierung von Engineering-Workflows

ft:publication_title
TIA Portal Openness: API für die Automatisierung von Engineering-Workflows
Product
TIAPortal
Version
V20
Publication date
01/2025
Language
de-DE
PLC-Variablentabellen exportieren

Voraussetzung

Verwendung

Pro PLC-Variablentabelle wird eine XML-Datei exportiert.

Die Schnittstelle TIA Portal Openness API unterstützt den Export aller PLC-Variablentabellen aus der Systemgruppe und deren Untergruppen.

Programmcode

Ändern Sie den folgenden Programmcode, um alle PLC-Variablentabellen aus der Systemgruppe und deren Untergruppen zu exportieren:

Kopiert den nachfolgenden Programmcode in die Zwischenablage.

private static void ExportAllTagTables(PlcSoftware plcSoftware)

{

PlcTagTableSystemGroup plcTagTableSystemGroup = plcSoftware.TagTableGroup;

// Export all tables in the system group

ExportTagTables(plcTagTableSystemGroup.TagTables);

// Export the tables in underlying user groups

foreach(PlcTagTableUserGroup userGroup in plcTagTableSystemGroup.Groups)

{

ExportUserGroupDeep(userGroup);

}

}

private static void ExportTagTables(PlcTagTableComposition tagTables)

{

foreach(PlcTagTable table in tagTables)

{

table.Export(new FileInfo(string.Format(@"D:\Samples\{0}.xml”, table.Name)), ExportOptions.WithDefaults);

}

}

private static void ExportUserGroupDeep(PlcTagTableUserGroup group)

{

ExportTagTables(group.TagTables);

foreach(PlcTagTableUserGroup userGroup in group.Groups)

{

ExportUserGroupDeep(userGroup);

}

}