tc_variant
Manage TwinCAT project variants: read, write, select active variant, and enable/disable tree items per variant.
Instructions
Project VARIANT management on the open solution (needs TCatSysManagerLib >= 3.3.0.0; older installs get_* return empty and set_*/disable surface a clear COM error). OFFLINE CONFIG ONLY — no confirm token needed; runtime needs a later activate/download; per-item disable/enable refuses TISC (safety) paths. Optional save:true does File.SaveAll once after a write. Actions: get_config (read-only) — returns the raw XML (round-trip this FIRST to capture the live shape before editing). get_current (read-only) — active variant name; empty string => no variant active / not configured. set_config (xml, save?) — replaces the WHOLE variant definition: a document with ..VariantName.. and/or standalone .. children (raw XML verbatim, schema not validated). select (variant, save?) — sets the active variant by name (e.g. "Variant3") or a group in bracket form (e.g. "[Group1]"); must already exist in the config. disable / enable (path, save?) — sets disabled state on a tree item FOR THE ACTIVE VARIANT; path uses ^ separators (e.g. TIID^Device 2 (EtherCAT)^Box 1, TIPC^MyPlc) and MUST NOT be under TISC. The readback disabled int may report SMDS_PARENT_DISABLED=2 (read-only state: disabled because an ancestor is) — never written, only echoed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml | No | ||
| path | No | ||
| save | No | ||
| action | Yes | ||
| variant | No |