beckhoff TE1000 TwinCAT 3 — 6.5.13 Opening an existing PLC project

Samples | PLC 1 : Move project to the solution directory 2 : Use the original project location (in this case, pass "" as the project name parameter) These values correspond to the Yes, No, and Cancel buttons in the corresponding dialog box in TwinCAT XAE. Alternatively, a PLC project archive ( .tpzip file) can be specified as a path. C#: ITcSmTreeItem plc = systemManager.LookupTreeItem("TIPC"); ITcSmTreeItem newProject = plc.CreateChild("NameOfProject", 1, "", pathToProjectOrTpzipFile); PowerShell:

$plc = $systemManager.LookupTreeItem("TIPC") $newProject = $plc.CreateChild("NameOfProject", 1, "", pathToProjectOrTpzipFile) Saving a PLC project as a library To save a PLC project as a PLC library, use the ITcPlcIECProject::SaveAsLibrary() method. C#: iecProject.SaveAsLibrary(pathToLibraryFile, false); PowerShell: $plcProject.SaveAsLibrary(pathToLibraryFile, $false) The second parameter determines whether the library should be automatically installed in the default repository after saving.

Using online functions (Login, StartPlc, StopPlc, ResetCold, ResetOrigin) The Automation Interface also supports PLC online functions, such as logging into a PLC runtime and starting, stopping, or resetting the PLC program. These functions are accessible via ProduceXml() and ConsumeXml() on an ITcPlcIECProject node. XML structure: false false false false C#: string xml = " true Commands> "; ITcSmTreeItem plcProject = systemManager.LookupTreeItem("TIPC^NameOfProject^NameOfProject Project"); plcProject.ConsumeXml(xml); Description of the XML nodes: TE1000 240 Version:

1.7.0 XML Description LoginCmd true = log in during PLC runtime LogoutCmd true = log out of PLC runtime StartCmd true = start the PLC program currently loaded into runtime StopCmd true = stop the PLC program currently loaded into runtime