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

Import of native file objects with folder

FloWil
2015-11-23
2018-09-11
  • FloWil - 2015-11-23

    I'm using the import_native method to import some files in native export format, by calling it on the project root object.
    Even though the files do have some project folder structure in them, import does not use them at all.
    Is there any way to make the import_native() method to behave like the import_xml() function concerning folders in the project view?

    EDIT:
    May this be part of the solution?
    l viewtopic.php?f=18&t=1890&start=30#p4358 l
    Do i just need to add something to the native export in order to cover the folder structure of that element?

     
  • Anonymous - 2015-12-03

    Originally created by: M.Schaber

    Hi,

    I just tested it locally, and it worked as expected. (I attached the export file as a zip archive .)

    \# create the import reporter
    class Handler(NativeImportHandler):
       def conflict(self, name, obj, guid):
          print("Object already exists: ",name)
          return NativeImportResolve.skip
       def progress(self, name, obj, exception):
          print("in progess: ", name)
       def skipped(self, list):
          for obj in list:
             print("Skipped: ", obj.get_name())
    def importFilter(name, guid,type,path):
                   return True;
    handler = Handler()        
    projects.primary.import_native("D:\\cdsproj\\misc\\untitled4.export", importFilter, handler)
    

    The export file was generated by exporting via the UI.

    Could you provide an export file which does not work as expected, and the STR how you generated it?

    Untitled4.zip [2.2 KiB]

     
  • aritra666 - 2018-09-11

    M.Schaber hat geschrieben:
    Hi,
    I just tested it locally, and it worked as expected. (I attached the export file as a zip archive Untitled4.zip.)

    \# create the import reporter
    class Handler(NativeImportHandler):
       def conflict(self, name, obj, guid):
          print("Object already exists: ",name)
          return NativeImportResolve.skip
       def progress(self, name, obj, exception):
          print("in progess: ", name)
       def skipped(self, list):
          for obj in list:
             print("Skipped: ", obj.get_name())
    def importFilter(name, guid,type,path):
                   return True;
    handler = Handler()        
    projects.primary.import_native("D:\\cdsproj\\misc\\untitled4.export", importFilter, handler)
    

    The export file was generated by exporting via the UI.
    Could you provide an export file which does not work as expected, and the STR how you generated it?

    While importing am getting the following error, using above method:
    (The object GUID '58addc41-f68b-4b7e-82a0-783ded3a2546' is not valid)

     

Log in to post a comment.