API 5 API | API This chapter documents all classes and methods of the TwinCAT Automation Interface. The interfaces provided can be divided into two different “levels”. Level 1 includes the two main interfaces of the Automation Interface— ITcSysManager and ITcSmTreeItem —through which all operations can be performed. The ITcSmTreeItem interface is a generic interface that can be used for all elements within a TwinCAT project. Level 2 includes specialized interfaces that provide advanced functions for specific ITcSmTreeItems, but these are not available for all elements in the TwinCAT project (e.g., ITcPlcPou).
Versioning of Interfaces Over the years, the Automation Interface has been enhanced with additional features to provide access to new TwinCAT functionalities. For compatibility reasons, the new functions will be made available in a new version of the interface (e.g., ITcSysManagerX). The new versions of the interface are incremented by the number X. When starting a new Automation Interface project, it is a good idea to work with the latest version of the interface. Return values All methods of the COM interfaces in the Automation Interface return an HRESULT. Below is an overview of the HRESULT return values from the Automation Interface. Within .NET, these are represented by exceptions.
Level 1 interfaces Level 2 interfaces TE1000 34 Version: 1.7.0 Name Type Description S OK _ HRESULT The function was executed successfully. E FAIL _ HRESULT The function fails. E ACCESSDENIED _ HRESULT The current document in the System Manager instance is locked. This is the case when at least one reference to the System Manager object or one of the Tree Items is open. E INVALIDARG _ HRESULT The specified parameter is invalid. E POINTER _ HRESULT The return pointer's address is invalid. TSM E ITEMNOTFOUND _ _ HRESULT The path name does not refer to an existing Tree Item. TSM E INVALIDITEMSUBTYP _ _ E HRESULT The specified SubType is invalid.
Main class Description Available since ITcSysManager [} 36] Base class for creating and parameterizing a TwinCAT configuration. TwinCAT 2.11 ITcSmTreeItem [} 55] Represents a Tree Item within a TwinCAT configuration. TwinCAT 2.11 Helper class Description Available since ITcPlcLibraryManager [} 113] Defines methods and properties for PLC library management. TwinCAT 3.1 ITcPlcPou [} 103] Defines methods and properties for working with PLC POUs. TwinCAT 3.1 ITcPlcDeclaration [} 127] Defines methods for reading and writing to the declaration area of a PLC POU. TwinCAT 3.1 ITcPlcImplementation [} 121] Defines methods for reading and writing to the implementation area of a PLC POU.
TwinCAT 3.1 ITcPlcProject [} 102] Defines methods and properties related to a PLC project, such as setting the project as a boot project. TwinCAT 3.1