diff -r ec5d7af033d8 -r 2b18a72dcaf0 graphics/FBD_Objects.py --- a/graphics/FBD_Objects.py Wed Sep 19 15:20:59 2007 +0200 +++ b/graphics/FBD_Objects.py Wed Sep 19 17:23:15 2007 +0200 @@ -26,7 +26,7 @@ from GraphicCommons import * from plcopen.structures import * - +from plcopen.structures import IsOfType #------------------------------------------------------------------------------- # Function Block Diagram Block @@ -138,6 +138,22 @@ def GetInputTypes(self): return tuple([input.GetType() for input in self.Inputs]) + def GetConnectionResultType(self, connector): + resulttype = None + for input in self.Inputs: + name = input.GetName() + if input != connector and (name.startswith("IN") or name in ["MN", "MX"]): + inputtype = input.GetConnectedType() + if resulttype is None or inputtype is not None and IsOfType(inputtype, resulttype): + resulttype = inputtype + for output in self.Outputs: + name = output.GetName() + if output != connector and name == "OUT": + outputtype = output.GetConnectedType() + if resulttype is None or outputtype is not None and IsOfType(outputtype, resulttype): + resulttype = outputtype + return resulttype + # Returns all the block connectors def GetConnectors(self): return {"inputs" : self.Inputs, "outputs" : self.Outputs}