Siemens.Collaboration.Net.TiaPortal.Openness.Extensions
18.0.1725480533
Prefix Reserved
See the version list below for details.
dotnet add package Siemens.Collaboration.Net.TiaPortal.Openness.Extensions --version 18.0.1725480533
NuGet\Install-Package Siemens.Collaboration.Net.TiaPortal.Openness.Extensions -Version 18.0.1725480533
<PackageReference Include="Siemens.Collaboration.Net.TiaPortal.Openness.Extensions" Version="18.0.1725480533" />
paket add Siemens.Collaboration.Net.TiaPortal.Openness.Extensions --version 18.0.1725480533
#r "nuget: Siemens.Collaboration.Net.TiaPortal.Openness.Extensions, 18.0.1725480533"
// Install Siemens.Collaboration.Net.TiaPortal.Openness.Extensions as a Cake Addin #addin nuget:?package=Siemens.Collaboration.Net.TiaPortal.Openness.Extensions&version=18.0.1725480533 // Install Siemens.Collaboration.Net.TiaPortal.Openness.Extensions as a Cake Tool #tool nuget:?package=Siemens.Collaboration.Net.TiaPortal.Openness.Extensions&version=18.0.1725480533
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.1.1725480204)
- Siemens.Collaboration.Net.NotifyModel (>= 3.0.1725479290)
- Siemens.Collaboration.Net.TiaPortal.Openness.Resolver (>= 1.1.1725480302)
- Siemens.Collaboration.Net.TiaPortal.Packages.Openness (>= 18.0.1701253559)
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 | 234 | 9/6/2024 |
18.0.1725480533 | 136 | 9/6/2024 |
18.0.1685432504 | 784 | 5/30/2023 |
17.0.1725480504 | 107 | 9/6/2024 |
17.0.1685432473 | 227 | 5/30/2023 |
17.0.1685386061 | 147 | 5/29/2023 |
16.0.1725480456 | 94 | 9/6/2024 |
16.0.1685432419 | 155 | 5/30/2023 |