plcopen/plcopen.py
changeset 89 a6ff2b3fcc25
parent 77 346a43f179a5
child 94 e7f5a251f251
equal deleted inserted replaced
88:bac6435df86f 89:a6ff2b3fcc25
   440     def hasBlock(self, name):
   440     def hasBlock(self, name):
   441         if self.getBodyType() in ["FBD", "LD", "SFC"]:
   441         if self.getBodyType() in ["FBD", "LD", "SFC"]:
   442             for instance in self.getInstances():
   442             for instance in self.getInstances():
   443                 if isinstance(instance, PLCOpenClasses["block"]) and instance.getInstanceName() == name:
   443                 if isinstance(instance, PLCOpenClasses["block"]) and instance.getInstanceName() == name:
   444                     return True
   444                     return True
   445             for transition in self.transitions.getTransition():
   445             if self.transitions:
   446                 result = transition.hasBlock(name)
   446                 for transition in self.transitions.getTransition():
   447                 if result:
   447                     result = transition.hasBlock(name)
   448                     return result
   448                     if result:
   449             for action in self.actions.getAction():
   449                         return result
   450                 result = action.hasBlock(name)
   450             if self.actions:
   451                 if result:
   451                 for action in self.actions.getAction():
   452                     return result
   452                     result = action.hasBlock(name)
       
   453                     if result:
       
   454                         return result
   453         return False
   455         return False
   454     setattr(cls, "hasBlock", hasBlock)
   456     setattr(cls, "hasBlock", hasBlock)
   455     
   457     
   456     def addTransition(self, name, type):
   458     def addTransition(self, name, type):
   457         if not self.transitions:
   459         if not self.transitions: