# HG changeset patch # User laurent # Date 1248429346 -7200 # Node ID 7ea1f5094df34f3dfb1e18650c1ea8e484a7afe0 # Parent fcae4e40f296408095f9d8d011c89ced402b1c53 Adding support for testing type between element connected with connector/continuation diff -r fcae4e40f296 -r 7ea1f5094df3 Viewer.py --- 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): diff -r fcae4e40f296 -r 7ea1f5094df3 graphics/FBD_Objects.py --- 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