attach checkedBlockDict variable to the body object
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 13 Jan 2017 15:08:40 +0300
changeset 1629 80eee3c5a057
parent 1628 6309efe91289
child 1630 f0030c3cd6ab
attach checkedBlockDict variable to the body object
plcopen/plcopen.py
--- a/plcopen/plcopen.py	Fri Jan 13 15:03:35 2017 +0300
+++ b/plcopen/plcopen.py	Fri Jan 13 15:08:40 2017 +0300
@@ -1562,7 +1562,7 @@
 cls = PLCOpenParser.GetElementClass("body")
 if cls:
     cls.currentExecutionOrderId = 0
-    checkedBlocksDict = {}
+    cls.checkedBlocksDict = {}
     def resetcurrentExecutionOrderId(self):
         object.__setattr__(self, "currentExecutionOrderId", 0)
     setattr(cls, "resetcurrentExecutionOrderId", resetcurrentExecutionOrderId)
@@ -1579,7 +1579,7 @@
                                             PLCOpenParser.GetElementClass("connector", "commonObjects"), 
                                             PLCOpenParser.GetElementClass("continuation", "commonObjects"))):
                     element.setexecutionOrderId(0)
-            checkedBlocksDict.clear()
+            self.checkedBlocksDict.clear()
         else:
             raise TypeError, _("Can only generate execution order on FBD networks!")
     setattr(cls, "resetexecutionOrder", resetexecutionOrder)
@@ -1602,12 +1602,12 @@
         if self.content.getLocalTag() == "FBD":
             localid = link.getrefLocalId()
             instance = self.getcontentInstance(localid)
-            checkedBlocksDict[localid] = True
+            self.checkedBlocksDict[localid] = True
             if isinstance(instance, PLCOpenParser.GetElementClass("block", "fbdObjects")) and instance.getexecutionOrderId() == 0:
                 for variable in instance.inputVariables.getvariable():
                     connections = variable.connectionPointIn.getconnections()
                     if connections and len(connections) == 1:
-                        if (checkedBlocksDict.has_key(connections[0].getrefLocalId()) == False):
+                        if (self.checkedBlocksDict.has_key(connections[0].getrefLocalId()) == False):
                             self.compileelementExecutionOrder(connections[0])
                 if instance.getexecutionOrderId() == 0:
                     instance.setexecutionOrderId(self.getnewExecutionOrderId())