It is possobile to create a POU and the logic in with script ?

Chag
2018-05-25
2019-04-09
  • Chag - 2018-05-25

    I know that we can create a declaration and also a program in Text ( ST ). But can we create POU in other languages and add or modify logic in it ?

     
  • Halim - 2019-03-20

    Hello Codesys Support,

    I'm interested in the answer for this question as well. I'm trying to create a Program POU in FBD. I want to create instances of the FBs POUs in the PRG with the script.

    I know it is possible as the following instruction works when I put language to None. I just seem not able to find the correct parameter to feed the language parameter. It should be a GUID value which I do not know how to generate.

    mypou = app.create_pou(name="autoPRG", type=PouType.Program, language= '???', return_type=None, base_type=None, interfaces=None)

    Any advice?

    BR,
    Halim

     
  • mkeller - 2019-03-22

    Hi Halim.

    Halim hat geschrieben:
    I'm interested in the answer for this question as well. I'm trying to create a Program POU in FBD. I want to create instances of the FBs POUs in the PRG with the script.
    I know it is possible as the following instruction works when I put language to None. I just seem not able to find the correct parameter to feed the language parameter. It should be a GUID value which I do not know how to generate.
    mypou = app.create_pou(name="autoPRG", type=PouType.Program, language= '???', return_type=None, base_type=None, interfaces=None)

    On our Web Help go to Scripting Engine -> IecLanguageObjectContainer and search in the page for "ScriptImplementationLanguage". The properties of that class return the necessary GUID for the different languages but as far as I know we only support to edit ST.

    BR
    Martin

     
  • Halim - 2019-03-28

    Thanks Martin for the reply. I tried it before posting the question but, it looks indeed that the fbd language is not supported. I will have to do it in ST then.

    Maybe another off-topic question regarding the syntax of python. The chm file in the codesys online help folder is for c#. Is there a similar chm for python syntax? or an online place for findin the correct syntax for python scripts?

    Thanks in advance for your reply.

    BR,
    Halim

     
  • mkeller - 2019-04-05

    Hi Halim.

    Halim hat geschrieben:
    Maybe another off-topic question regarding the syntax of python. The chm file in the codesys online help folder is for c#. Is there a similar chm for python syntax? or an online place for findin the correct syntax for python scripts?

    The C# syntax in the CHM file for the Scripting API is historical because it was the easiest way to get some documentation. You get used to it but we have a new documentation which is based on a manually created python stub.

    You find it on our web help under the topic Scripting Engine

    BR
    Martin

     
  • Halim - 2019-04-09

    Thanks again Martin

     

Log in to post a comment.