I am trying to automate the hardware configuration in TIA Portal V17 with the help of Python & TIA Openness API. I have created a subnet & connected all the network interfaces to the subnet as shown below:
#creating a list of all found network interfaces on all stations in the station list
n_interfaces = []
for device in myproject.Devices:
device_item_aggregation = device.DeviceItems[1].DeviceItems
for deviceitem in device_item_aggregation:
network_service = tia.IEngineeringServiceProvider(deviceitem).GetService[hwf.NetworkInterface]()
if type(network_service) is hwf.NetworkInterface:
n_interfaces.append(network_service)
# Creating subnet and IO system on the first item in the list
# Connects to subnet for remaining devices, if IO device it gets assigned to the IO system
for n in n_interfaces:
if n_interfaces.index(n) == 0:
subnet = n_interfaces[0].Nodes[0].CreateAndConnectToSubnet("Profinet")
ioSystem = n_interfaces[0].IoControllers[0].CreateIoSystem("PNIO");
else:
n_interfaces[n_interfaces.index(n)].Nodes[0].ConnectToSubnet(subnet)
if (n_interfaces[n_interfaces.index(n)].IoConnectors.Count) >> 0:
n_interfaces[n_interfaces.index(n)].IoConnectors[0].ConnectToIoSystem(ioSystem);
Could anyone say how to achieve port to port connections (under Topology view)?
Thanks in advance.
Regards, Mukara