--- a/plcopen/plcopen.py Wed Aug 16 12:30:31 2017 +0300
+++ b/plcopen/plcopen.py Wed Aug 16 12:48:08 2017 +0300
@@ -152,6 +152,7 @@
def TextMatched(str1, str2):
return str1 and str2 and (str1.upper() == str2.upper())
+
PLCOpenParser = GenerateParserFromXSD(paths.AbsNeighbourFile(__file__, "tc6_xml_v201.xsd"))
PLCOpen_XPath = lambda xpath: etree.XPath(xpath, namespaces=PLCOpenParser.NSMAP)
@@ -188,6 +189,7 @@
</body>
</pou>""" % locals()
+
PLCOpen_v1_file = open(paths.AbsNeighbourFile(__file__, "TC6_XML_V10_B.xsd"))
PLCOpen_v1_xml = PLCOpen_v1_file.read()
PLCOpen_v1_file.close()
@@ -289,6 +291,7 @@
project_file.close()
return LoadProjectXML(project_xml)
+
project_pou_xpath = PLCOpen_XPath("/ppx:project/ppx:types/ppx:pous/ppx:pou")
@@ -296,6 +299,7 @@
root, error = LoadProjectXML(LOAD_POU_PROJECT_TEMPLATE % xml_string)
return project_pou_xpath(root)[0], error
+
project_pou_instances_xpath = {
body_type: PLCOpen_XPath(
"/ppx:project/ppx:types/ppx:pous/ppx:pou[@name='paste_pou']/ppx:body/ppx:%s/*" % body_type)
@@ -317,6 +321,7 @@
encoding='utf-8'))
project_file.close()
+
cls = PLCOpenParser.GetElementClass("formattedText")
if cls:
def updateElementName(self, old_name, new_name):
@@ -712,6 +717,7 @@
var_number += 1
return search_result
+
cls = PLCOpenParser.GetElementClass("configuration", "configurations")
if cls:
@@ -968,6 +974,7 @@
def _updateBaseTypeElementName(self, old_name, new_name):
self.baseType.updateElementName(old_name, new_name)
+
cls = PLCOpenParser.GetElementClass("dataType", "dataTypes")
if cls:
setattr(cls, "updateElementName", _updateBaseTypeElementName)
@@ -1043,6 +1050,7 @@
criteria, parent_infos))
return search_result
+
cls = PLCOpenParser.GetElementClass("subrangeSigned", "dataType")
if cls:
setattr(cls, "updateElementName", _updateBaseTypeElementName)
@@ -1077,6 +1085,7 @@
return type_content.getname()
return type_content_type.upper()
+
cls = PLCOpenParser.GetElementClass("pou", "pous")
if cls:
@@ -1926,6 +1935,7 @@
def _SearchInElement(self, criteria, parent_infos=[]):
return []
+
_connectionsFunctions = {
"bbox": {"none": _getBoundingBox,
"single": _getBoundingBoxSingle,
@@ -1958,6 +1968,7 @@
setattr(cls, "Search", _SearchInElement)
return cls
+
cls = _initElementClass("comment", "commonObjects")
if cls:
def setcontentText(self, text):
@@ -2044,6 +2055,7 @@
return _Search([("reference", self.variable)], criteria, parent_infos + [ld_element_type, self.getlocalId()])
return SearchInLDElement
+
cls = _initElementClass("contact", "ldObjects", "single")
if cls:
setattr(cls, "updateElementName", _UpdateLDElementName)
@@ -2310,6 +2322,7 @@
def _UpdateIOElementAddress(self, address_model, new_leading):
self.expression = update_address(self.expression, address_model, new_leading)
+
cls = _initElementClass("inVariable", "fbdObjects")
if cls:
setattr(cls, "updateElementName", _UpdateIOElementName)
@@ -2332,6 +2345,7 @@
def _SearchInConnector(self, criteria, parent_infos=[]):
return _Search([("name", self.getname())], criteria, parent_infos + ["connector", self.getlocalId()])
+
cls = _initElementClass("continuation", "commonObjects")
if cls:
setattr(cls, "Search", _SearchInConnector)
@@ -2495,6 +2509,7 @@
raise ValueError, _("\"%s\" is an invalid value!") % value
return items
+
cls = PLCOpenParser.GetElementClass("arrayValue", "value")
if cls:
arrayValue_model = re.compile("([0-9]+)\((.*)\)$")