beckhoff TE1000 TwinCAT 3 — 6.7.1 Creating and handling TcCOM modules

Samples | TcCOM Adding TcCOM modules To add existing TcCOM modules to your TwinCAT configuration, these modules must be recognizable by TwinCAT. This can be achieved using one of the following methods: Copy the TcCOM modules to the TWINCAT3.XDIR”\CustomConfig\Modules\ folder. Edit TWINCAT3.XDIR”\Config\Io\TcModuleFolders.xml to add a path to a folder of your choice and place the modules inside that folder. Either of these methods is sufficient to make the TcCOM modules recognizable to TwinCAT. A TcCOM module is identified by its GUID or its name: This GUID can be used to add a TcCOM module to a TwinCAT configuration using the ITcSmTreeItem::CreateChild() method.

The GUID can be determined in TwinCAT XAE via the properties page of a TcCOM module. Alternatively, you can determine the GUID using the TMC file of the TcCOM module. ... Let's assume we already have a TcCOM module that is registered in TwinCAT and is recognized by TwinCAT. We would now like to add this TcCOM module, which has the GUID {8F5FDCFF- EE4B-4EE5-80B1-25EB23BD1B45}, to the TwinCAT configuration. This can be done as follows: Code snippet (C#):

Dictionary tcomModuleTable = new Dictionary (); tcomModuleTable.Add("TempContr",Guid.Parse("{8f5fdcff-ee4b-4ee5-80b1-25eb23bd1b45}")); ITcSmTreeItem tempController = tcComObjects.CreateChild("Test", 0, "", tcomModuleTable["TempContr"]); Code snippet (PowerShell): $tcomModuleTable = @{} $tcomModuleTable.Add("TempContr", "{8f5fdcff-ee4b-4ee5-80b1-25eb23bd1b45}") $tempController = $tcComObjects.CreateChild("Test", 0, "", $tcomModuleTable["TempContr"]) Please note that the “vInfo” parameter of the “ITcSmTreeItem::CreateChild()” method contains the GUID of the TcCOM module, which is used to identify the module in the list of all registered TcCOM modules on this system. TE1000 274 Version: 1.7.0