tc_cpp
Manage TwinCAT C++ projects: create, import, build, publish modules, and regenerate code from TMC files.
Instructions
TwinCAT C++ projects/modules under TIXC (paths use ^ separators). C++ ONLY — TISC (safety) untouched; runtime needs a later activate/download. VS-hosted-safe: create/open go purely through ITcSmTreeItem.CreateChild on TIXC (no New/Open/SaveConfiguration). Actions: create_project (name, template, before?) — CreateChild a new C++ project node under TIXC from a wizard; template = "TwinCAT C++ Project Wizard" | "TcVersionedDriverWizard" | "TcModuleCyclicCallerWizard" (or a full template .vcxproj/.tczip path — if a wizard NAME is rejected, fall back to the file path). create_module (projectPath = TIXC^, name, template? default "TwinCAT Class Wizard", before?) — CreateChild a module/class on an existing C++ project. open (file = existing .vcxproj/.tczip, subType? 0 copy into solution dir (default) /1 move/2 use-in-place, before?) — import an existing C++ project; the project is NOT renamed (CreateChild name is empty). tmc_codegen (projectPath) — offline StartTmcCodeGenerator (regenerates C++ from the .tmc; no runtime impact). set_props (projectPath, bootProjectEncryption? None|Target, saveProjectSources?) — offline config edit via ConsumeXml (at least one prop required). build (projectName = the .vcxproj DTE project Name/UniqueName, config? default "Release|TwinCAT RT (x64)", waitForFinish? default true, timeoutMs? default 1800000) — compile a single C++ project via SolutionBuild2.BuildProject; compiles only, does NOT deploy. publish (projectPath, confirm) — GUARDED, requires confirm="ALLOW_CPP_PUBLISH" and defaults to no-op: builds the module for ALL platforms and exports the deployable/shippable driver artifacts (long-running); does NOT itself activate/restart the runtime. CAVEAT: the ConsumeXml wrapper element for C++ project params is from a doc summary (Set-TreeItemXml surfaces GetLastXmlError, so a wrong element fails loudly); ProduceXml the project node once to confirm element names before relying on tmc_codegen/set_props/publish.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | ||
| name | No | ||
| action | Yes | ||
| before | No | insert before this sibling | |
| config | No | ||
| confirm | No | ||
| subType | No | ||
| template | No | ||
| timeoutMs | No | ||
| projectName | No | ||
| projectPath | No | ||
| waitForFinish | No | ||
| saveProjectSources | No | ||
| bootProjectEncryption | No |