Configuration Browsing Variables / Symbols only To Browse the Variables / Symbols use the ITcSmTreeItem::VarCount(x) [ } 37] , ITcSmTreeItem::Var(x,n) [ } 37] pair of properties. A selection of the variable type (input variables or output variables) can be done by parameter. 5.1.3 Custom TreeItem Parameters The ITcSmTreeItem [ } 37] interface is supported by every TwinCAT tree item and has a very generic character. To support the specification of all the devices, boxes and terminals, together with many other different types of tree items, all custom parameters of a tree item are accessible via the XML representation of the tree item.
This XML-String can be accessed by the method ITcSmTreeItem::ProduceXml [ } 60] and its counterpart ITcSmTreeItem::ConsumeXml [ } 61] . This function pair has the same functionality as the "Export XML Description ..." and "Import XML Description ..." commands from the main menu of the TwinCAT IDE (see snapshot below). Fig. 3: TcSysMan_AutomationXmlParameters With this Import/Export functionset, good parts of any script or automation code can be tested and tailored conveniently, before it is developed within the coding language - simply by the process of exporting tree item data, changing its content and re-importing it.
Best practice is to export the XML content first, change its content, importing it within the IDE and then, if everything goes successfully, package it into the programming/script code for handling it via the methods ProduceXml and ConsumeXml. Using this workflow ensures that all changed properties and methods are valid (the Xml stream is self- documenting) and in which way they can be used (for example as Read-Only-Property, as Read-Write- Property or as a method trigger). Reading Properties In this example, the Network Adapter setting of an TwinCAT configuration should be detected (here an CX9001): Here the Adapter Settings are available within the DeviceDef specific part of the XML Data.
Automation Interface 20 Version: 1.2