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 Tue Dec 11, 2018 12:37 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Nov 23, 2015 11:36 am 
Offline

Joined: Fri Aug 14, 2015 12:43 pm
Posts: 3
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?
viewtopic.php?f=18&t=1890&start=30#p4358
Do i just need to add something to the native export in order to cover the folder structure of that element?


Top
   
PostPosted: Thu Dec 03, 2015 11:38 am 
Offline
Frequent User
Frequent User
User avatar

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

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

Code:
# 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?


You do not have the required permissions to view the files attached to this post.

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

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


Top
   
PostPosted: Tue Sep 11, 2018 6:29 am 
Offline

Joined: Tue Sep 04, 2018 7:54 am
Posts: 4
M.Schaber wrote:
Hi,

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

Code:
# 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)


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

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


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