Siemens.Collaboration.Net.TiaPortal.Openness.Extensions
17.0.1685386061
Prefix Reserved
See the version list below for details.
dotnet add package Siemens.Collaboration.Net.TiaPortal.Openness.Extensions --version 17.0.1685386061
NuGet\Install-Package Siemens.Collaboration.Net.TiaPortal.Openness.Extensions -Version 17.0.1685386061
<PackageReference Include="Siemens.Collaboration.Net.TiaPortal.Openness.Extensions" Version="17.0.1685386061" />
paket add Siemens.Collaboration.Net.TiaPortal.Openness.Extensions --version 17.0.1685386061
#r "nuget: Siemens.Collaboration.Net.TiaPortal.Openness.Extensions, 17.0.1685386061"
// Install Siemens.Collaboration.Net.TiaPortal.Openness.Extensions as a Cake Addin #addin nuget:?package=Siemens.Collaboration.Net.TiaPortal.Openness.Extensions&version=17.0.1685386061 // Install Siemens.Collaboration.Net.TiaPortal.Openness.Extensions as a Cake Tool #tool nuget:?package=Siemens.Collaboration.Net.TiaPortal.Openness.Extensions&version=17.0.1685386061
TIA Portal Openness Extensions
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
UsingApi.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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- Siemens.Collaboration.Net.DuckTyping (>= 1.0.1685385647)
- Siemens.Collaboration.Net.NotifyModel (>= 2.0.28)
- Siemens.Collaboration.Net.TiaPortal.Openness.Resolver (>= 1.0.1685385809)
- Siemens.Collaboration.Net.TiaPortal.Packages.Openness (>= 17.0.1682585500)
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 | 217 | 9/6/2024 |
18.0.1725480533 | 128 | 9/6/2024 |
18.0.1685432504 | 778 | 5/30/2023 |
17.0.1725480504 | 104 | 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 |