insert Task_configuration and Symbol_configuration

hhz
2017-06-02
2017-09-27
  • hhz - 2017-06-02

    Hello support team,

    I have tried to insert a POU, Task config and symbol config into the new project with the following modified example script of "taskconfig-example.py" by Martin:

    \#
    \# Main program
    \#
    proj = projects.primary
    found = proj.find('Application', True)
    assert(found, 'Application not found')
    app = found[0]
    print(app)
    \# add POU
    pou = app.create_pou(mypou)
    \# Create task configuration
    taskconfig = app.create_task_configuration()
    assert(taskconfig, 'task config was not created')
    \# add symbol config
    taskconfig = app.create_symbol_configuration()
    

    after executed the script, I can create POU under connector "Application" successfully. but creating Task and Symbol config were failed. CDY show error "'Script Object' object hast no attribute 'create_task_configuration' .( the same error message in case of creating Symbol config).

    Have any idea, what is wrong with above script? or the CDY version does not support the methods?

    Thanks for Help!
    hhz

     
  • mkeller - 2017-06-06

    Hi hhz.

    hhz hat geschrieben:
    Have any idea, what is wrong with above script? or the CDY version does not support the methods?

    Both features are available for CODESYS V3.5 SP10 or newer.

    BR
    Martin

     
  • hhz - 2017-06-08

    Hi Martin,

    Thanks!

    I have test it with SP10 . Adding POU and Task config work, but Symbol config done not work.
    Error diagnose hows no attribute "create_symbol_configuration()".

    Is the script commands wrong?

    BR.

     
  • mkeller - 2017-06-08

    Hi hhz.

    hhz hat geschrieben:
    Is the script commands wrong?

    Where did you get that command? It is wrong. See my example below.

    from System import Guid
    optimizedCalculator = Guid('{0141eb75-141b-4ea1-9a8c-75f952b22a6c}')
    app = projects.primary.active_application
    symbol = app.create_symbol_config(False, False, optimizedCalculator)
    print('Symbol config created')
    

    BR
    Martin

     
  • hhz - 2017-06-08

    Thanks ! now it works well.

     
  • WousV - 2017-09-27

    Thanks for the help on the taskconfig, but the creating of a symbol config doesn't work for me.

    I have run your example code in SP10 (well, KeMotion 3.10a, but it uses CoDeSys 3.5.10 under the hood), but it gives me the AttributeError that the ScriptObject has no 'create_symbol_config' attribute.
    I've checked the scriptengine.dll and did an API-dump and it has the command 'create_symbol_config', with the two bools and the Guid as parameters, but it doesn't seem to use it.
    I've downloaded and installed CoDeSys 3.5.11P2 (x64) and it has no problem creating a symbol configuration from script.
    Relevant part of my code:

    Β  Β  app=projects.primary.active_application
    Β  Β  print(app.is_application, app.is_active_application) # True True
    Β  Β  symconf = app.create_symbol_config(False, False, Guid.Empty)
    
    ```Using
    

    optimizedCalculator = Guid('{0141eb75-141b-4ea1-9a8c-75f952b22a6c}')

    ```and giving optimizedCalculator as parameter instead of Guid.Empty does not affect the issue of the AttributeError arising. Neither does changing the bools to True.

    How can this be resolved?

    Edit:
    I manually made a symbol configuration and I printed it. It does not qualify as a ScriptSymbolConfigObject (not even as a NoSymbolConfigObject) and using symconf.is_symbol_config gives an AttributeError. I can't do anything with it beyond basic ScriptObject-handling (such as get_name, guid, remove, etc...)

    Testing the same script with a project in SP11P2 works flawlessly and it shows up as a ScriptSymbolConfigObject and the corresponding methods work with no issue.
    This seems to be an issue with the implementation of CoDeSys 3.5.10 by KEBA in KeMotion 3.10a. Is there a way I can check whether this is the case by comparing some SP11P2 dll's with those from KeMotion?
    I'm also wondering why the commands do show up in the API dump.

    BR

    Wouter

     
  • mkeller - 2017-09-27

    Hi Wouter.

    WousV hat geschrieben:
    How can this be resolved?
    Edit:
    I manually made a symbol configuration and I printed it. It does not qualify as a ScriptSymbolConfigObject (not even as a NoSymbolConfigObject) and using symconf.is_symbol_config gives an AttributeError. I can't do anything with it beyond basic ScriptObject-handling (such as get_name, guid, remove, etc...)
    Testing the same script with a project in SP11P2 works flawlessly and it shows up as a ScriptSymbolConfigObject and the corresponding methods work with no issue.
    This seems to be an issue with the implementation of CoDeSys 3.5.10 by KEBA in KeMotion 3.10a. Is there a way I can check whether this is the case by comparing some SP11P2 dll's with those from KeMotion?
    I'm also wondering why the commands show up in the API dump.

    The Scripting API for the SymbolConfig is implemented in the plug-in ScriptDriverSymbolcConfigObject. If the plug-in is installed and loaded with the profile you should be able to use it.

    In CODESYS you can see what plug-ins are loaded but I don't know if there is a way in KeMotion. I think you should contact the support from KEBA and ask them for help.

    BR
    Martin

     

Log in to post a comment.