Exporting PLC library signatures
ITcPlcLibraryManager2 allows you to export the type signatures of all referenced libraries in a PLC project as XML. The ProduceAllLibrarySignatures() method returns a structured description of the public types in each referenced library, including function blocks, global variables, and data types. The result is an XML string that can be saved directly or processed further.
Requirements
- A PLC project is available
C# sample
ITcSmTreeItem plcProject = sysManager.LookupTreeItem(@"TIPC^PLC1^PLC1 Project^References");
ITcPlcLibraryManager2 libManager = (ITcPlcLibraryManager2)plcProject;
// Export signatures of all referenced libraries
string allSignaturesXml = libManager.ProduceAllLibrarySignatures();
System.IO.File.WriteAllText(@"C:\Export\LibSignatures.xml", allSignaturesXml);
PowerShell sample
$plcProject = $sysManager.LookupTreeItem("TIPC^PLC1^PLC1 Project")
# Export all library signatures (late binding)
$xml = $plcProject.ProduceAllLibrarySignatures()
$xml | Out-File "C:\Export\LibSignatures.xml" -Encoding UTF8
Output sample
<Library>
<LibraryName>Tc2_Standard</LibraryName>
<Version>3.4.7.0</Version>
<Distributor>Beckhoff Automation GmbH</Distributor>
<TypeSignatures>
<TypeSignature type="FunctionBlock">
<Name>RS</Name>
<Comment> Bistable function block (reset dominant)</Comment>
<Inputs>
<Input>
<Name>SET</Name>
<DataType>BOOL</DataType>
<Comment> Input to set Q1</Comment>
</Input>
<Input>
<Name>RESET1</Name>
<DataType>BOOL</DataType>
<Comment> Input to reset Q1 (reset dominant)</Comment>
</Input>
</Inputs>
<Outputs>
<Output>
<Name>Q1</Name>
<DataType>BOOL</DataType>
</Output>
</Outputs>
</TypeSignature>
.
.
.
<TypeSignature type="VarGlobal">
<Name>Global_Version</Name>
<Comment> This function has been automatically generated from the project information.</Comment>
<Constants>
<Constant>
<Name>stLibVersion_Tc2_Standard</Name>
<DataType>ST_LibVersion</DataType>
</Constant>
</Constants>
</TypeSignature>
</TypeSignatures>
</Library>
<Library>
<LibraryName>Tc3_GlobalTypes_Global</LibraryName>
<Version>1.0.0.0</Version>
<Distributor>Beckhoff Automation GmbH</Distributor>
<TypeSignatures>
<TypeSignature type="Type">
<Name>OTCID</Name>
</TypeSignature>
<TypeSignature type="Type">
<Name>UXINT</Name>
</TypeSignature>
.
.
.
<TypeSignature type="FunctionBlock">
<Name>TcBaseModuleRegistered2</Name>
<Comment> inheritate this object to add your function block as TcCOM object to the TwinCAT system
hint: ensure that the offered methods are threadsafe and have got HRESULT as return data type</Comment>
<Outputs>
<Output>
<Name>objID</Name>
<DataType>OTCID</DataType>
<Comment> own object ID is created during init</Comment>
</Output>
</Outputs>
</TypeSignature>
<TypeSignature type="VarGlobal">
<Name>Global_Version</Name>
<Comment> This function has been automatically generated from the project information.</Comment>
<Constants>
<Constant>
<Name>stLibVersion_Tc3_Module</Name>
<DataType>ST_LibVersion</DataType>
</Constant>
</Constants>
</TypeSignature>
</TypeSignatures>
</Library>