Adding support for testing type between element connected with connector/continuation
--- a/Viewer.py Fri Jul 24 11:45:41 2009 +0200
+++ b/Viewer.py Fri Jul 24 11:55:46 2009 +0200
@@ -640,6 +640,14 @@
comments.sort(lambda x, y: cmp(x.GetId(), y.GetId()))
return blocks + wires + comments
+ def GetConnectorByName(self, name):
+ for block in self.Blocks.itervalues():
+ if isinstance(block, FBD_Connector) and\
+ block.GetType() == CONNECTOR and\
+ block.GetName() == name:
+ return block
+ return None
+
def RefreshVisibleElements(self, xp = None, yp = None):
x, y = self.CalcUnscrolledPosition(0, 0)
if xp is not None:
@@ -672,6 +680,12 @@
iec_path = "%s.%s%d_%s"%(self.InstancePath, block.GetType(), block.GetId(), connectorname)
elif isinstance(block, FBD_Variable):
iec_path = "%s.%s"%(self.InstancePath, block.GetName())
+ elif isinstance(block, FBD_Connector):
+ connection = self.GetConnectorByName(block.GetName())
+ if connection is not None:
+ connector = connection.GetConnector()
+ if len(connector.Wires) == 1:
+ iec_path = self.GetElementIECPath(connector.Wires[0][0])
elif isinstance(element, LD_Contact):
iec_path = "%s.%s"%(self.InstancePath, element.GetName())
elif isinstance(element, SFC_Step):
--- a/graphics/FBD_Objects.py Fri Jul 24 11:45:41 2009 +0200
+++ b/graphics/FBD_Objects.py Fri Jul 24 11:55:46 2009 +0200
@@ -816,6 +816,10 @@
return self.Type
def GetConnectionResultType(self, connector, connectortype):
+ if self.Type == CONTINUATION:
+ connector = self.Parent.GetConnectorByName(self.Name)
+ if connector is not None:
+ return connector.Connector.GetConnectedType()
return connectortype
# Changes the connection name