Deleting devices

daniel-REC
2012-07-20
2012-08-17
  • daniel-REC - 2012-07-20

    Hello all,

    Does someone know how to delete particular device from project list using script?

     
  • Anonymous - 2012-07-20

    Originally created by: M.Schaber

    Hi, Daniel,

    daniel_REC hat geschrieben:
    Does someone know how to delete particular device from project list using script?

    proj = projects.primary
    dev = proj.find("Device", "EtherCAT_Master", "EK1100")[0]
    dev.remove()
    

    This only works if the device descriptions permit removing of that particular device - on other words, if you can delete it using the UI in the same situation.

    For Slots, you can call the unplug() method.

     
  • daniel-REC - 2012-07-23

    Thank You,

    Also, is there a way to move module in device tree up or down, using script?
    My devices tree looks like this:
    - CIFX_PB
    - UR20_FBC_PB_DP
    - UR20_8DO_P
    - UR20_4DO_P

    I was trying to run script:

    proj = projects.primary
    app = proj.active_application
    onlineapp = online.create_online_application(app)

    dev = proj.find("UR20_FBC_PB_DP", True)
    obj = proj.find("UR20_4DO_P", True)
    obj[0].move(dev[0],0)

    but in response I have error: "This device cannot be added or inserted here"

     
  • Anonymous - 2012-08-17

    Originally created by: M.Schaber

    Hi, Daniel,

    daniel_REC hat geschrieben:
    Also, is there a way to move module in device tree up or down, using script?
    My devices tree looks like this:
    - CIFX_PB
    - UR20_FBC_PB_DP
    - UR20_8DO_P
    - UR20_4DO_P
    I was trying to run script:
    proj = projects.primary
    app = proj.active_application
    onlineapp = online.create_online_application(app)
    dev = proj.find("UR20_FBC_PB_DP", True)
    obj = proj.find("UR20_4DO_P", True)
    obj[0].move(dev[0],0)
    but in response I have error: "This device cannot be added or inserted here"

    If the device descriptions allow that movement, and the indices are set correctly, it should work that way. Actually, I did experiment a little bit, and it worked on my side.

     

Log in to post a comment.