Siemens.Collaboration.Net.TiaPortal.Openness.Extensions 19.0.1725480561

Prefix Reserved
dotnet add package Siemens.Collaboration.Net.TiaPortal.Openness.Extensions --version 19.0.1725480561                
NuGet\Install-Package Siemens.Collaboration.Net.TiaPortal.Openness.Extensions -Version 19.0.1725480561                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Siemens.Collaboration.Net.TiaPortal.Openness.Extensions" Version="19.0.1725480561" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Siemens.Collaboration.Net.TiaPortal.Openness.Extensions --version 19.0.1725480561                
#r "nuget: Siemens.Collaboration.Net.TiaPortal.Openness.Extensions, 19.0.1725480561"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Siemens.Collaboration.Net.TiaPortal.Openness.Extensions as a Cake Addin
#addin nuget:?package=Siemens.Collaboration.Net.TiaPortal.Openness.Extensions&version=19.0.1725480561

// Install Siemens.Collaboration.Net.TiaPortal.Openness.Extensions as a Cake Tool
#tool nuget:?package=Siemens.Collaboration.Net.TiaPortal.Openness.Extensions&version=19.0.1725480561                

TIA Portal Openness Extensions

Nuget Nuget
Nuget Nuget Nuget

Includes Nuget Nuget

Siemens Collaboration Openness Extensions provide extensions for Siemens Engineering types to help you write cleaner and more efficient code.

Installation

  • install package Siemens.Collaboration.Net.TiaPortal.Openness.Extensions and select a matching version (17.* = TIA Portal V17, 18.* = TIA Portal V18)
  • reload and build the project

Dependencies

By installing this package, the following packages are automatically installed and must not be installed individually:

  • TIA Portal Openness References
    All Siemens.Engineering assemblies are referenced automatically. Please see README for further documentation.

  • TIA Portal Openness Resolver
    Using Api.Global.Openness().Initialize() will resolve all Siemens.Engineering assemblies at runtime. Please see README for further documentation.

Extensions

TIA Portal Openness Extensions provide a lot of extensions for various Siemens Engineering types. The following chapters are an excerpt of the most frequently used extensions.

Hardware

Get all Device in a project (iterates through devices, device groups and ungrouped devices recursively)

IEnumerable<Device> devices = tiaProject.AllDevices()

Recursively get all DeviceItem of a Device

IEnumerable<DeviceItem> deviceItems = myDevice.AllDeviceItems()

Get all PlcSoftware instances in a project recursively

IEnumerable<PlcSoftware> plcSoftwares = tiaProject.AllPlcSoftwares()

Get all Startdrive devices in a project recursively

IEnumerable<Device> drives = tiaProject.AllStartdriveDevices()

Get all HMI devices (Advanced/Professional/Unified) in a project recursively

IEnumerable<Device> hmiDevices = tiaProject.AllHmiDevices()

Get all IO addresses used in an IoSystem

var addresses = ioSystem.GetIoAddresses();

Get all devices, containing device items with addresses in an IoSystem

IEnumerable<(Device Device, IEnumerable<(DeviceItem DeviceItem, IEnumerable<Address> Addresses)> deviceInfos = ioSystem.GetIoAddressInfos();

Software

If the given device is known to be a PLC, get the PlcSoftware of the device

PlcSoftware plcSoftware = device.AsPlc();

Get all blocks recursively

IEnumerable<PlcBlock> blocks = plcSoftware.BlockGroup.AllBlocks();

Parents

Get all parents of an IEngineeringObject

IEnumerable<IEngineeringObject> parents = engineeringObject.Parents();

Get first parent of type Device of an IEngineeringObject

Device device = engineeringObject.Parent<Device>();

Get TiaPortal instance

TiaPortal tiaPortal = engineeringObject.TiaPortalInstance();

Attributes

Get an attribute with type

string name = deviceItem.tAttribute<string>("Name"))
if (name is null)
  logger.Error("Attribute not found");

Try set an attribute

if (deviceItem.TrySetAttribute("Name", "My Device Item"))
  logger.Information("Name was set");
else
  logger.Error("Unable to set name of the device");

Try get an attribute

if (deviceItem.TryGetAttribute("Name", out var name))
  logger.Information($"The name is: {name}");
else
  logger.Error("Unable to read name of the device");

Transfer attributes from one device to another device

// get attribute infos of all attributes
var sourceAttributeInfo = deviceA.GetAllAttributeInfos(tiaPortal, accessMode, null, excludeTypes)

// change the target
var targetObjectAttributeInfo = sourceAttributeInfo.Copy(targetDevice)

// apply values
targetObjectAttributeInfo.ApplyValuesFrom(sourceAttributeInfo)

Misc

Serialize path to engineering object to string

string engineeringObjectPath = engineeringObject.GetPath();

Deserialize path of engineering object to engineering object

IEngineeringObject engineeringObject = engineeringObjectPath.ToEngineeringObject();
Device device = devicePath.ToEngineeringObject<Device>();

Get the version of specified product (default "TIA Portal Openness")

Version opennessVersion = tiaPortal.Version(); // 17.0.1.5 = V17 Service Pack 1 Update 5
Version startdriveVersion = tiaPortal.Version("SINAMICS Startdrive Advanced"); // 17.0.0.2 = V17 Update 2
Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Siemens.Collaboration.Net.TiaPortal.Openness.Extensions:

Package Downloads
Siemens.Collaboration.Net.TiaPortal.Openness.Startdrive.Extensions

Provides extension methods for SINAMICS Startdrive V19 openness development

Siemens.Collaboration.Net.TiaPortal.Openness.Hmi.Extensions

Provides extension methods for TIA Portal V19 openness development

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
19.0.1725480561 223 9/6/2024
18.0.1725480533 130 9/6/2024
18.0.1685432504 782 5/30/2023
17.0.1725480504 106 9/6/2024
17.0.1685432473 225 5/30/2023
17.0.1685386061 146 5/29/2023
16.0.1725480456 91 9/6/2024
16.0.1685432419 154 5/30/2023