Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Automation SDK - Reset pins on a function after inserting

  • BobbieB

    BobbieB - 2015-05-19

    Ive figured out how to insert a "box" on to a CFC type POU, but after setting it to lets say "TON" I was expecting to see the pins appear.
    How do I reset teh box to show the pins? (I use the term reset, as its on the menu when I right click on the box).

    I am trying to write a component that allows logic to be written straight to a POU, and I have not foound any documentation on how to do this, so I am making random guesses at the moment.

    I am using the following to add the box on the CFC POU

    private _3S.CoDeSys.CFCObject.ICFCElement add_cfc_box(_3S.CoDeSys.CFCObject.ICFCImplementationObject2 impl, _3S.CoDeSys.CFCObject.KindOfCall type, string name, string instance, System.Drawing.Rectangle bound)
    _3S.CoDeSys.CFCObject.ICFCItem4 item = ComponentManager.Singleton.CreateInstance(objects_ids.GUID_CFCBOXELEMENT) as _3S.CoDeSys.CFCObject.ICFCItem4;
    _3S.CoDeSys.CFCObject.ICFCElement2 elem = item as _3S.CoDeSys.CFCObject.ICFCElement2;
    elem.KindOfCall = type;
    // name
    _3S.CoDeSys.CFCObject.ICFCText Name = ComponentManager.Singleton.CreateInstance(objects_ids.GUID_CFCTEXT) as _3S.CoDeSys.CFCObject.ICFCText;
    Name.Text = name;
    // instance
    _3S.CoDeSys.CFCObject.ICFCText Instance = ComponentManager.Singleton.CreateInstance(objects_ids.GUID_CFCTEXT) as _3S.CoDeSys.CFCObject.ICFCText;
    Instance.Text = instance;
    // position
    item.Bounds = bound;

            return elem;


  • timvh

    timvh - 2015-05-19

    I'm just guessing, but maybe you haven't added the standard library to your project yet.
    Then the compiler doesn't know about TON yet and doesn't know which inputs / outputs it has.

  • BobbieB

    BobbieB - 2015-05-20

    The library is already part of the project. I can add by hand in the editor.
    Also, the box I insert, if I double click on it,it correctly shows me information about it being a Timer, so I know the compiler understands what the block is used for.


Log in to post a comment.