How to export/import the information of a child of a tree item

Requirements

To export/import the information of a child of a tree item in a configuration, an instance of the TwinCAT System Manager must be created, and a configuration has to be opened. The LookupTreeItem method of the ITcSysManager interface returns a ITcSmTreeItem interface pointer implemented by the parent tree item referenced by the parents pathname.

This interface contains an ExportChild and an ImportChild method of the tree item.

Procedure

The ProgId "TCatSysManager.TcSysManager" can be used to create an instance of the System Manager that implements the ITcSysManager interface. This interface has a LookupTreeItem method that returns a ITcSmTreeItem pointer to a specific tree item given by its pathname. To export the information of a tree item "TIID^Device 1 (FC310x)^Box 1 (BK3100)" the following vbscript code can be used:

Sample (vbscript):

dim tsm
dim item
set tsm = CreateObject("TCatSysManager.TcSysManager")
call tsm.OpenConfiguration("c:\twincat\myConfig.wsm")
set item = tsm.LookupTreeItem("TIID^Device 1(FC310x)")
call item.ExportChild("Box 1 (BK3100)","c:\twincat\box1.tce")

To import the information of a tree item as a child of "TIID^Device 1 (FC310x)" the following vbscript code can be used:

dim tsm
dim item
set tsm = CreateObject("TCatSysManager.TcSysManager")
call tsm.OpenConfiguration("c:\twincat\myConfig.wsm")
set item = tsm.LookupTreeItem("TIID^Device 1(FC310x)")
call item.ImportChild("c:\twincat\box1.tce")

The ImportChild method has same optional parameters that are described in the documentation of that method.

See Also

How to... section, ITcSysManager, LookupTreeItem, ITcSmTreeItem, ExportChild, ImportChild

Built on Tuesday, Mai 01, 2001