491 return customblocktype |
491 return customblocktype |
492 return None |
492 return None |
493 setattr(cls, "GetCustomBlockType", GetCustomBlockType) |
493 setattr(cls, "GetCustomBlockType", GetCustomBlockType) |
494 |
494 |
495 # Return Block types checking for recursion |
495 # Return Block types checking for recursion |
496 def GetCustomBlockTypes(self, exclude = ""): |
496 def GetCustomBlockTypes(self, exclude = "", onlyfunctions = False): |
497 type = None |
497 type = None |
498 if exclude != "": |
498 if exclude != "": |
499 pou = self.getpou(exclude) |
499 pou = self.getpou(exclude) |
500 if pou is not None: |
500 if pou is not None: |
501 type = pou.getpouType() |
501 type = pou.getpouType() |
502 customblocktypes = [] |
502 customblocktypes = [] |
503 for customblocktype in self.CustomBlockTypes: |
503 for customblocktype in self.CustomBlockTypes: |
504 if customblocktype["name"] != exclude and not self.ElementIsUsedBy(exclude, customblocktype["name"]) and not (type == "function" and customblocktype["type"] != "function"): |
504 if customblocktype["name"] != exclude and not self.ElementIsUsedBy(exclude, customblocktype["name"]) and not (onlyfunctions and customblocktype["type"] != "function"): |
505 customblocktypes.append(customblocktype) |
505 customblocktypes.append(customblocktype) |
506 return customblocktypes |
506 return customblocktypes |
507 setattr(cls, "GetCustomBlockTypes", GetCustomBlockTypes) |
507 setattr(cls, "GetCustomBlockTypes", GetCustomBlockTypes) |
508 |
508 |
509 # Return Function Block types checking for recursion |
509 # Return Function Block types checking for recursion |
510 def GetCustomFunctionBlockTypes(self, exclude = ""): |
510 def GetCustomFunctionBlockTypes(self, exclude = ""): |
511 type = None |
|
512 if exclude != "": |
|
513 pou = self.getpou(exclude) |
|
514 type = pou.getpouType() |
|
515 customblocktypes = [] |
511 customblocktypes = [] |
516 for customblocktype in self.CustomBlockTypes: |
512 for customblocktype in self.CustomBlockTypes: |
517 if customblocktype["name"] != exclude and not self.ElementIsUsedBy(exclude, customblocktype["name"]) and not (type == "function" and customblocktype["type"] != "function"): |
513 if customblocktype["name"] != exclude and not self.ElementIsUsedBy(exclude, customblocktype["name"]): |
518 customblocktypes.append(customblocktype["name"]) |
514 customblocktypes.append(customblocktype["name"]) |
519 return customblocktypes |
515 return customblocktypes |
520 setattr(cls, "GetCustomFunctionBlockTypes", GetCustomFunctionBlockTypes) |
516 setattr(cls, "GetCustomFunctionBlockTypes", GetCustomFunctionBlockTypes) |
521 |
517 |
522 # Return Block types checking for recursion |
518 # Return Block types checking for recursion |