siemens/tia-portal-ai-extensions/tags-and-tagtables

Claude Code and agent skill by siemens/tia-portal-ai-extensions

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Tags and tag tables management in TIA Portal. Use when accessing, creating, renaming PLC tags, exporting/importing tag tables to XML, and finding tags by name.

Install

npx vskill@latest install siemens/tia-portal-ai-extensions/tags-and-tagtables

SKILL.md

Tags and TagTables

Overview

Tags and TagTables provide the mechanism for defining and managing PLC variables in TIA Portal. A PlcSoftware contains a TagTableGroup which organizes PlcTagTable instances (e.g., default tag tables, HW tags). Each tag table holds a collection of PlcTag objects that represent individual variables accessible from blocks. Tags can be accessed by name, edited in-place, exported to XML for bulk modification, and re-imported.

Required Namespaces

csharp
using Siemens.Engineering;
using Siemens.Engineering.SW;
using Siemens.Engineering.SW.Tags;

Required Assemblies

  • Siemens.Engineering.Base.dll
  • Siemens.Engineering.Step7.dll

Common Patterns

Access TagTable and PlcTag from PlcSoftware

Description: Navigate from PlcSoftware to its tag tables and individual tags. The TagTableGroup exposes all tag tables associated with the PLC software. Tags are accessed via the Tags property of a specific tag table.

Example:

csharp
var myTagTable = plcSoftware.TagTableGroup.TagTables.FirstOrDefault(x => x.Name == "DemocaseAppTagTable");
var myTag = myTagTable.Tags.FirstOrDefault();

Key Types and Methods:

  • PlcSoftware.TagTableGroup — the root container for all tag tables
  • TagTableCollection — enumerable collection of tag tables
  • PlcTagTable.Tags — collection of tags within a tag table
Edit Tag Name In-Place

Description: Modify the name of an existing PlcTag directly by setting its Name property. This is an in-place mutation on the engineering object.

Example:

csharp
if (myTag != null)
{
myTag.Name = "NewTagName2";
}

Key Types and Methods:

  • PlcTag.Name — settable property for the tag's symbolic name
Export TagTable to XML and Re-Import

Description: Export an entire tag table to XML, modify the XML using standard .NET XML APIs (e.g., XDocument), then re-import the modified XML back into the project. Useful for bulk tag transformations or migration scenarios.

Example:

csharp
myTagTable.Export(new FileInfo(tempPath), ExportOptions.WithDefaults);
// ... modify XML with XDocument ...
plcSoftware.TagTableGroup.TagTables.Import(new FileInfo(tempPath), ImportOptions.Override);

Key Types and Methods:

  • PlcTagTable.Export(FileInfo, ExportOptions) — writes tag table to XML file
  • TagTableCollection.Import(FileInfo, ImportOptions) — imports tag table from XML file
Find Tag by Name via Collection.Find

Description: Use the Find(string) method on a PlcTagCollection to locate a specific tag by its name. This is more efficient than iterating manually and handles name lookup internally.

Example:

csharp
var connectedTag = plcSoftware.TagTableGroup.TagTables
.First(x => x.Name.ToLower().Contains("default")).Tags.Find("test");

Key Types and Methods:

  • PlcTagCollection.Find(string) — returns the tag with the specified name or null
Create Tag Tables and Tags Idempotently
csharp
var table = group.TagTables.Find(tableName) ?? group.TagTables.Create(tableName);
table.Tags.Find("Speed")?.Delete(); // idempotent regeneration
var tag = table.Tags.Create("Speed", "Int", "%MW100");

Key points:

  • PlcTagComposition.Create(name, dataTypeName, logicalAddress). The address format is %<area><byte>[.<bit>], for example %I187.0, %Q10.0, %MW100, %M50.3.
  • Tag names are unique per PLC across all tag tables. Tags.Create throws "An attempt was made to create an object that already exists" on a clash in any table, so include the table name in diagnostics.
  • To find a table anywhere below a PlcTagTableGroup, recurse through group.Groups. Search one scope only (PLC root or a SW-Unit's tag-table group), because SW-Units have isolated groups (see `sw-units`).
  • Not every tag attribute applies to every tag. Wrap optional per-attribute SetAttribute calls in try/catch, log the failure and continue, rather than aborting a whole table.
Create and Manage User Constants

Description: User constants are named values stored in tag tables, usable in PLC code and array bounds. Use Find before Create to avoid duplicates.

Example:

csharp
// Find existing constant
var constant = table.UserConstants.Find("MAX_AXES");
// Create if not found
if (constant == null)
constant = table.UserConstants.Create("MAX_AXES", "Int", "10");
// Update value of an existing constant
constant.Value = "12";

Key Types and Methods:

  • PlcTagTable.UserConstants — collection of user constants in the tag table
  • UserConstants.Find(name) — returns null if not found
  • UserConstants.Create(name, dataType, value) — creates and returns the new constant
  • PlcUserConstant.Value — settable property for the constant's current value

User constants are referenced in array bounds and PLC code as "CONST_NAME" (with quotes).

Quick Reference

Method/PatternPurpose
plcSoftware.TagTableGroup.TagTablesAccess all tag tables in the PLC software
PlcTagTable.Tags.FirstOrDefault()Get the first tag from a tag table
PlcTag.Name = "..."Rename an existing tag in-place
PlcTagTable.Export(path, ExportOptions)Export tag table to XML file
TagTableCollection.Import(path, ImportOptions)Import tag table from XML file
PlcTagCollection.Find(name)Find a tag by its symbolic name
PlcTagTable.UserConstants.Find(name)Find a user constant by name
PlcTagTable.UserConstants.Create(name, dataType, value)Create a new user constant
PlcUserConstant.ValueRead or update the constant's value

Related Files

  • `blocks` — blocks reference tags through their interface members
  • `devices-and-hardware` — hardware tags are auto-generated from device configuration

Exception Handling

  • EngineeringException may be thrown when exporting/importing tag tables if the file path is invalid or the XML is malformed
  • Null checks should be performed after Find() calls since they return null when the tag is not found

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/siemens/tia-portal-ai-extensions/tags-and-tagtables/badge)](https://verified-skill.com/skills/siemens/tia-portal-ai-extensions/tags-and-tagtables)

Something wrong with this skill or its page? Tell us.