Beckhoff Automation GmbH & Co. KG — 8.11 How to create/change a linkage of a nc axis, encoder or drive to an I/O device, box or terminal

How to Procedure The ProgId " TCatSysManager.TcSysManager " can be used to create an instance of the System Manager that implements the ITcSysManager [ } 30] interface. This interface has a LookupTreeItem [ } 35] method that returns a ITcSmTreeItem [ } 37] pointer to the "I/O Devices" tree item (use the abbreviation "TIID"). Sample (vbscript):

Set tsm = CreateObject("TCatSysManager.TcSysManager") Call tsm.OpenConfiguration("c:\test.wsm") Set Item = tsm.LookupTreeItem("TIID") Set xml = CreateObject("Msxml.DOMDocument") The following call to Item.ProduceXml scans the installed I/O devices (among other things) and returns a XML string that contains these information that will be stored in the XML document by the method xml.loadXml. Call xml.loadXml(Item.ProduceXml) The following line sets a DOM node list object that contains all found devices as DOM nodes Set devs = xml.selectNodes("TreeItem/DeviceGrpDef/FoundDevices/Device") For i = 0 To devs.length - 1 If the ItemSubType of the device corresponds to the type of device to update...

If devs(i).selectSingleNode("ItemSubType").nodeTypedValue = 48 Then ' 48 = IODEVICETYPE_FC7500 The AddressInfo node of that device will be extracted Set ainfo = devs(i).selectSingleNode("AddressInfo") A ITcSmTreeItem pointer of that device in the configuration will be evaluated Set dev = tsm.LookupTreeItem("TIID^MyDev") And finally the address info will be stored to the device Call dev.ConsumeXml(ainfo.xml) Call tsm.SaveConfiguration Exit For End If Next See Also How to...

section [ } 69] , ITcSysManager [ } 30] , LookupTreeItem [ } 35] , ITcSmTreeItem [ } 37] , ConsumeXml [ } 61] , ProduceXml [ } 60] Built on Tuesday, Mai 01, 2001 8.11 How to create/change a linkage of a nc axis, encoder or drive to an I/O device, box or terminal Requirements To create/change a linkage of a nc axis, encoder or drive to an I/O device, box or terminal in a configuration, an instance of the TwinCAT System Manager has to be created and a configuration has to be opened. Procedure The ProgId " TCatSysManager.TcSysManager " can be used to create an instance of the System Manager that implements the ITcSysManager [ } 30] interface. Automation Interface 76 Version: 1.2