--- a/PLCControler.py Mon Jun 04 02:04:29 2012 +0200
+++ b/PLCControler.py Wed Jun 06 16:57:58 2012 +0200
@@ -1964,8 +1964,8 @@
for instance in element.getinstances():
if isinstance(instance, (plcopen.sfcObjects_step, plcopen.commonObjects_connector, plcopen.commonObjects_continuation)):
names[instance.getname()] = True
- i = 1
- while names.get(name.upper(), False):
+ i = 0
+ while name is None or names.get(name.upper(), False):
name = (format%i)
i += 1
return name
@@ -2020,7 +2020,7 @@
blocktype = instance.gettypeName()
if element_type == "function":
return _("FunctionBlock \"%s\" can't be pasted in a Function!!!")%blocktype
- blockname = self.GenerateNewName(tagname, blockname, "Block%d", debug=debug)
+ blockname = self.GenerateNewName(tagname, blockname, "%s%%d"%blocktype, debug=debug)
exclude[blockname] = True
instance.setinstanceName(blockname)
self.AddEditedElementPouVar(tagname, blocktype, blockname)