CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Sun Oct 20, 2019 4:52 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Deleting devices
PostPosted: Fri Jul 20, 2012 10:27 am 
Offline

Joined: Wed Jul 18, 2012 11:42 am
Posts: 15
Hello all,

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


Top
   
 Post subject: Re: Deleting devices
PostPosted: Fri Jul 20, 2012 10:37 am 
Offline
Frequent User
Frequent User
User avatar

Joined: Fri Mar 18, 2011 4:12 pm
Posts: 266
Hi, Daniel,

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


Code:
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.

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
 Post subject: Re: Deleting devices
PostPosted: Mon Jul 23, 2012 6:23 am 
Offline

Joined: Wed Jul 18, 2012 11:42 am
Posts: 15
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"


Top
   
 Post subject: Re: Deleting devices
PostPosted: Fri Aug 17, 2012 11:48 am 
Offline
Frequent User
Frequent User
User avatar

Joined: Fri Mar 18, 2011 4:12 pm
Posts: 266
Hi, Daniel,

daniel_REC wrote:
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.

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited