tc_module
List, create, and configure TcCOM module instances. Use XML for parameters and symbols, enable DataArea symbols, and assign to task execution contexts. Configuration-time only, no runtime activation.
Instructions
TcCOM module objects under TIRC^TcCOM Objects (paths use ^ separators). CONFIG-TIME ONLY — no INIT/PREOP/SAFEOP/OP transitions (not an Automation Interface feature); nothing here activates config, downloads, or touches the runtime/safety system. Actions: list (read-only) — enumerate module instances via ITcModuleManager3, returns {count,modules:[{moduleTypeName,moduleInstanceName,classId,oid,objectId,parentOid}]} (oids are DECIMAL; XAE shows hex). create (name, by="classid"|"name", id, before?) — CreateChild under TcCOM Objects: by=classid -> subType 0, id = module GUID/ClassID e.g. {8f5fdcff-...}; by=name -> subType 1, id = registered module type name e.g. "NewModule"; a malformed/ghost child is cleaned up and reported as an error. get_xml (path) — ProduceXml of the instance (Parameters / DataAreas / Symbols, with current CreateSymbol/CreateSymbols flags). set_xml (path, xml, returnXml?) — ConsumeXml escape hatch for parameters not exposed as typed properties. enable_symbols (path, parameters?, dataAreas?, returnXml?) — convenience toggle: sets CreateSymbol=true on Parameter nodes and/or CreateSymbols=true on DataArea AreaNo nodes via ProduceXml/ConsumeXml. CAVEAT: the XPath/attribute names are from a how-to summary, NOT verified against a literal ProduceXml dump — call get_xml on a real module first and fall back to set_xml if the toggle reports changed:false. To wire module DataArea symbols to PLC/IO/other-module variables (symbols must already exist via enable_symbols), use tc_link link/unlink. set_context (path, taskObjectId, contextId?) — assign the instance to a task's execution context; taskObjectId/contextId are DECIMAL oids (XAE shows hex). GUARDED: changes the activated mapping/runtime context, requires confirm="ALLOW_TWINCAT_MODULE_CONTEXT" and defaults to no-op.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| by | No | ||
| id | No | ||
| xml | No | ||
| name | No | ||
| path | No | ||
| action | Yes | ||
| before | No | insert before this sibling under TcCOM Objects | |
| confirm | No | ||
| contextId | No | ||
| dataAreas | No | ||
| returnXml | No | ||
| parameters | No | ||
| taskObjectId | No | decimal ObjectId of the target task (XAE shows it in hex) |