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 Jun 25, 2019 8:54 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Export XML
PostPosted: Wed Mar 14, 2012 4:18 pm 
Offline

Joined: Wed Feb 22, 2012 2:29 pm
Posts: 7
I want to export the properties of the function block (FB) named "MX_DirectVarAxis".
The function block has properties and methods.


The following script does not work:

import sys

str_PathXmlFile = "C:\\TestScripts\\TestExp.xml"

# create the export reporter
class Reporter(ExportReporter):
def error(self, message):
system.write_message(Severity.Error, message)

def warning(self, message):
system.write_message(Severity.Warning, message)

def nonexportable(self):
print("non exportable")

@property
def aborting(self):
return False

# create the exporter instance.
reporter = Reporter()

proj = projects.primary

obj = proj.find("MX_DirectVarAxis", True)[0]

print obj.get_name()

obj.export_xml(reporter, str_PathXmlFile, True)


The script showed the following messages:

...
reporter = Reporter()
proj = projects.primary
obj = proj.find("MX_DirectVarAxis", True)[0]
print obj.get_name()
MX_DirectVarAxis
obj.export_xml(reporter, str_PathXmlFile, True)
calling(self: IronPython.NewTypes.System.Object#IExportReporter_1$1)
def aborting(self:)
return False
...


Top
   
 Post subject: Re: Export XML
PostPosted: Mon Mar 19, 2012 11:18 am 
Offline
Frequent User
Frequent User
User avatar

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

Lohr_DCIA-EHE1 wrote:
I want to export the properties of the function block (FB) named "MX_DirectVarAxis".
The function block has properties and methods.

The following script does not work:


As far as I can see, the script looks fine.

Quote:
The script showed the following messages:
...
reporter = Reporter()
proj = projects.primary
obj = proj.find("MX_DirectVarAxis", True)[0]
print obj.get_name()
MX_DirectVarAxis
obj.export_xml(reporter, str_PathXmlFile, True)
calling(self: IronPython.NewTypes.System.Object#IExportReporter_1$1)
def aborting(self:)
return False
...


That looks like a trace of a successfull run of the script.

Did you get any error messages or exceptions? Was the TestExp.xml file created?

_________________
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: Export XML
PostPosted: Tue Mar 20, 2012 10:15 am 
Offline

Joined: Wed Feb 22, 2012 2:29 pm
Posts: 7
The export-file has been created.

But the the properties and methods of the function block are missing. If I try to find a property and to export it as XML-File an error message of the reporter shows, that the property is not exportable.


Top
   
 Post subject: Re: Export XML
PostPosted: Tue Mar 20, 2012 11:04 am 
Offline
Frequent User
Frequent User
User avatar

Joined: Fri Mar 18, 2011 4:12 pm
Posts: 266
Lohr_DCIA-EHE1 wrote:
The export-file has been created.

But the the properties and methods of the function block are missing. If I try to find a property and to export it as XML-File an error message of the reporter shows, that the property is not exportable.


Properties alone are not exportable, as properties cannot exist without their parents. If you export manually (via the project menu "Export PLCOpenXML..." command), you cannot select a property without the parent node being selected.

However, POUs should be exported with all their properties etc. if the "recursive" parameter is set to True. In our internal test cases, it works(the PLCOpenXML files contain the properties).

If it is not working for you, it's best if you contact me via our support department, giving detailed steps to repeat (possibly including an example project archive).

_________________
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