Hi,
I need to export and import devices from one repository to another. I can see the export option in codesys, but i do not find the corresponding option in ScriptDeviceDescrition
to get the device I'm using this code:
foridinrange(0,DevRepList.__len__()):  #forsomereaseonforDevinDevRepListwontwork    ifDevRepList[id].name=="X-Soft":      XList=device_repository.get_all_devices(DevRepList[id])      for xDevinXList:        pass#doexport
Is it possible at all to export devices?
Thanks,
Nina
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
foridinrange(0, DevRepList.__len__()):Â Â # forsomereaseonforDevinDevRepListwontwork
    ifDevRepList[id].name=="X-Soft":
      XList=device_repository.get_all_devices(DevRepList[id])
      for xDevinXList:
        pass # doexport
About the first line of your code: Where does the come from?
Nina hat geschrieben:
Is it possible at all to export devices?
The export of device descriptions was added with CODESYS V3.5 SP10 and the Scripting API does not support it yet. I added an entry to our bug tracking so it will be implemented at some point.
BR
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
M.Keller hat geschrieben:
About the first line of your code: Where does the come from?
sorry, i forgot the first line:
DevRepList=device_repository.sourcesforidinrange(0, DevRepList.__len__()):Â Â # forsomereaseonforDevinDevRepListwontwork
   ifDevRepList[id].name=="X-Soft":
     XList=device_repository.get_all_devices(DevRepList[id])
     for xDevinXList:
      pass # doexport
Thanks for adding to jira
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The iteration of should work. I tested it with the following code and had no problem:
sources=device_repository.sourcesassert(len(sources)>0, "no repo sources")print("Available sources of the device repository:")forsrcinsources:
  print("- {}: {}".format(src.name, src.location_url))count=0print("Get all device descriptions from a specific source")sysRepoSource=sources["System Repository"]
devColl=device_repository.get_all_devices(sysRepoSource)fordevindevColl:
  printDeviceDesc(dev)
  count+=1
  ifcount>100:
    break
You find the complete source code as attachment.
BTW: You can get the repo source by name. The syntax for it is . It will return the matching repo source or if there is none with that name.
Hi,
I need to export and import devices from one repository to another. I can see the export option in codesys, but i do not find the corresponding option in ScriptDeviceDescrition
to get the device I'm using this code:
Is it possible at all to export devices?
Thanks,
Nina
Hi Nina.
About the first line of your code: Where does the come from?
The export of device descriptions was added with CODESYS V3.5 SP10 and the Scripting API does not support it yet. I added an entry to our bug tracking so it will be implemented at some point.
BR
Martin
sorry, i forgot the first line:
Thanks for adding to jira
Hi Nina.
The iteration of should work. I tested it with the following code and had no problem:
You find the complete source code as attachment.
BTW: You can get the repo source by name. The syntax for it is . It will return the matching repo source or if there is none with that name.
BR
Martin
device_repo_show_minimal.py [1.74 KiB]