Samples | PLC CX-12345 172.17.60.153.1.1 172.17.60.153 3.1.4020 Windows 7 6.5 PLC | PLC 6.5.1 How to create a PLC project | How to create a PLC project A new PLC project is created on the PLC node TIPC via CreateChild . You can use either a standard template or your own .plcproj template file. Requirements A TwinCAT solution is open C# sample ITcSmTreeItem plcNode = sysManager.LookupTreeItem("TIPC"); // Simple: use standard template ITcSmTreeItem plcProject = plcNode.CreateChild("PLC1", 0, "", "Standard PLC Template"); // Explicit path — named form (object[]):
object[] vInfoNamed = new object[] { new string[] { "path", @"C:\tmp\Template.plcproj" }, new string[] { "pathType", "template" } // "template" or "existing" }; ITcSmTreeItem plcProjectFromTemplate = plcNode.CreateChild("NewPlcFromTmplt", 0, "", vInfoNamed); // Explicit path — positional form (string[]):
string[] vInfoPositional = new string[] { @"C:\tmp\ExistingProject.plcproj", "existing" }; ITcSmTreeItem plcExisting = plcNode.CreateChild("ExistingPLC", 0, "", vInfoPositional); PowerShell sample $plcNode = $sysManager.LookupTreeItem("TIPC") # Standard template $plcProject = $plcNode.CreateChild("PLC1", 0, "", "Standard PLC Template") The vInfo parameter distinguishes between "template" for creating a new PLC from a template and "existing" for inserting an existing project. When you click "template" , a copy of the template is created in the project folder. The project is referenced at "existing" . The named and positional forms are equivalent.
Standard template paths TwinCAT includes two standard templates. Both are represented by a template file in the TwinCAT directory. Up to TwinCAT 3.1 4024 TE1000 225 Version: 1.7.0 Template name Template file Standard PLC template C:/TwinCAT3/.xComponents/Plc/ PlcTemplate/Plc TemplatesStandard/PLC Template.plcproj