Bug on FunctionBlock type variables management fixed
authorlbessard
Fri, 04 Jan 2008 17:47:58 +0100
changeset 143 015a34da60eb
parent 142 f5f43f009709
child 144 b67a5de5a24a
Bug on FunctionBlock type variables management fixed
plcopen/plcopen.py
--- a/plcopen/plcopen.py	Fri Jan 04 17:47:00 2008 +0100
+++ b/plcopen/plcopen.py	Fri Jan 04 17:47:58 2008 +0100
@@ -453,7 +453,7 @@
         var_type = PLCOpenClasses["dataType"]()
         derived_type = PLCOpenClasses["derived"]()
         derived_type.setName(type)
-        var_type.setValue(derived_type)
+        var_type.setContent("derived", derived_type)
         var.setType(var_type)
         content[-1]["value"].appendVariable(var)
     setattr(cls, "addPouVar", addPouVar)
@@ -477,8 +477,8 @@
             variables = varlist["value"].getVariable()
             for var in variables:
                 if var.getName() == name:
-                    var_type = var.getType().getValue()
-                    if isinstance(var_type, PLCOpenClasses["derived"]) and var_type.getName() == type:
+                    vartype_content = var.getType().getContent()
+                    if vartype_content["name"] == "derived" and vartype_content["value"].getName() == type:
                         variables.remove(var)
                         break
             if len(varlist["value"].getVariable()) == 0: