plcopen/plcopen.py
changeset 94 e7f5a251f251
parent 89 a6ff2b3fcc25
child 108 9aa1fdfb7cb2
--- a/plcopen/plcopen.py	Mon Sep 17 17:50:41 2007 +0200
+++ b/plcopen/plcopen.py	Mon Sep 17 17:51:05 2007 +0200
@@ -422,6 +422,19 @@
         content[-1]["value"].appendVariable(var)
     setattr(cls, "addPouVar", addPouVar)
     
+    def changePouVar(self, old_type, old_name, new_type, new_name):
+        content = self.interface.getContent()
+        for varlist in content:
+            variables = varlist["value"].getVariable()
+            for var in variables:
+                if var.getName() == old_name:
+                    var_type = var.getType().getValue()
+                    if isinstance(var_type, PLCOpenClasses["derived"]) and var_type.getName() == old_type:
+                        var.setName(new_name)
+                        var.getType().getValue().setName(new_type)
+                        return
+    setattr(cls, "changePouVar", changePouVar)
+    
     def removePouVar(self, type, name):
         content = self.interface.getContent()
         for varlist in content: