PLCGenerator.py
changeset 228 da7ddaf27cca
parent 227 c6fee379d446
child 232 cbdfef9b2020
equal deleted inserted replaced
227:c6fee379d446 228:da7ddaf27cca
   669         body = pou.getbody()
   669         body = pou.getbody()
   670         body_content = body.getcontent()
   670         body_content = body.getcontent()
   671         body_type = body_content["name"]
   671         body_type = body_content["name"]
   672         if body_type in ["IL","ST"]:
   672         if body_type in ["IL","ST"]:
   673             self.Program = [(ReIndentText(body_content["value"].gettext(), len(self.CurrentIndent)), 
   673             self.Program = [(ReIndentText(body_content["value"].gettext(), len(self.CurrentIndent)), 
   674                             (self.TagName, "body"))]
   674                             (self.TagName, "body", len(self.CurrentIndent)))]
   675         elif body_type == "FBD":
   675         elif body_type == "FBD":
   676             orderedInstances = []
   676             orderedInstances = []
   677             otherInstances = {"outVariables" : [], "block" : [], "connector" : []}
   677             otherInstances = {"outVariables" : [], "block" : [], "connector" : []}
   678             for instance in body.getcontentInstances():
   678             for instance in body.getcontentInstances():
   679                 if isinstance(instance, (plcopen.fbdObjects_outVariable, plcopen.fbdObjects_inOutVariable, plcopen.fbdObjects_block)):
   679                 if isinstance(instance, (plcopen.fbdObjects_outVariable, plcopen.fbdObjects_inOutVariable, plcopen.fbdObjects_block)):
   985                 transitionBody = transitionContent.getbody()
   985                 transitionBody = transitionContent.getbody()
   986                 previous_tagname = self.TagName
   986                 previous_tagname = self.TagName
   987                 self.TagName = self.ParentGenerator.Controler.ComputePouTransitionName(self.Name, transitionValues["value"])
   987                 self.TagName = self.ParentGenerator.Controler.ComputePouTransitionName(self.Name, transitionValues["value"])
   988                 if transitionType == "IL":
   988                 if transitionType == "IL":
   989                     transition_infos["content"] = [(":\n", ()),
   989                     transition_infos["content"] = [(":\n", ()),
   990                                                    (ReIndentText(transitionBody.gettext(), len(self.CurrentIndent)), (self.TagName, "body"))]
   990                                                    (ReIndentText(transitionBody.gettext(), len(self.CurrentIndent)), (self.TagName, "body", len(self.CurrentIndent)))]
   991                 elif transitionType == "ST":
   991                 elif transitionType == "ST":
   992                     transition_infos["content"] = [("\n", ()),
   992                     transition_infos["content"] = [("\n", ()),
   993                                                    (ReIndentText(transitionBody.gettext(), len(self.CurrentIndent)), (self.TagName, "body"))]
   993                                                    (ReIndentText(transitionBody.gettext(), len(self.CurrentIndent)), (self.TagName, "body", len(self.CurrentIndent)))]
   994                 elif transitionType == "FBD":
   994                 elif transitionType == "FBD":
   995                     for instance in transitionBody.getcontentInstances():
   995                     for instance in transitionBody.getcontentInstances():
   996                         if isinstance(instance, plcopen.fbdObjects_outVariable):
   996                         if isinstance(instance, plcopen.fbdObjects_outVariable):
   997                             connections = instance.connectionPointIn.getconnections()
   997                             connections = instance.connectionPointIn.getconnections()
   998                             if connections and len(connections) == 1:
   998                             if connections and len(connections) == 1: