beckhoff TwinCAT 3 — 16.3 Creating and handling C++ projects and modules

Appendix | Creating and handling C++ projects and modules Instead of the template file, you must use the path to the C++ project (or its vcxproj file) that must be added. Alternatively, you can also use a C++ project archive (tczip file). Code snippet (C#): ITcSmTreeItem cpp = systemManager.LookupTreeItem("TIXC"); ITcSmTreeItem newProject = cpp.CreateChild("NameOfProject", 1, "", pathToProjectOrTczipFile); Code snippet (PowerShell): $cpp = $systemManager.LookupTreeItem("TIXC") $newProject = $cpp.CreateChild("NameOfProject", 1, "", $pathToProjectOrTczipFile) Please note that C++ projects cannot be renamed, so the original project name must be specified. (cf.

Renaming TwinCAT C++ projects [ } 216] ) Creating module instances TcCOM Modules could be created at the System -> TcCOM Modules node. Please see documentation there [ } 333] . The same procedure could also be applied to the C++ project node to add TcCOM instances at that place ( $newProject at the code on top of this page.). Calling the TMC Code Generator The TMC Code Generator can be called to generate the C++ code according to the changes in the TMC file or the C++ project. Code snippet (C#): string startTmcCodeGenerator = @" true "; cppProject.ConsumeXml(startTmcCodeGenerator); Code snippet (PowerShell):

$startTmcCodeGenerator = @" true " $cppProject.ConsumeXml($startTmcCodeGenerator) TwinCAT 3 331 Version: 1.19.1