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 Mon Aug 19, 2019 10:42 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Wed Feb 12, 2014 2:58 pm 
Offline

Joined: Tue Nov 19, 2013 1:20 pm
Posts: 17
hello,

I'm trying to modify the "ProjectInfoExample.py" example script, to write all Standard library/project attributes (of course only the ones which a writable, I know that the Project attribute *.project is read only).
In the example file there's company, title, version, default_namespace, author and SpecialDeviceId. But there are also IsEndUserLibrary, LanguageModulAttribute and SpecialDeviceId.
I wasn't able to find a Definition of the Standard attributes in the help file...

best regards


Top
   
PostPosted: Thu Feb 13, 2014 1:42 pm 
Offline
Frequent User
Frequent User
User avatar

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

I don't have your "ProjectInfoExample.py" example script. But my "ProjectInfoCreation.py" script which seems to circulate contains the following snippet:

Code:
# now we set a custom value...
info.values["SpecialDeviceId"] = "PLC0815_4711"

As the commment says, this is an example of how to set custom values which are not covered by the explicit API. There is no "registry" of valid values - an End-User can just define a value for his own company (by convention), and then access it e. G. via the generated IEC code. Also, OEMs can extend CODESYS with their own plugins, and thus define values which have "real" semantics for their plugins.

The api was modeled after the fields which were available in the CODESYS UI back then. As the project settings UI allows to set arbitrary values on the "Properties" tab page, the scripting API also provides this possibility via the dictionary interface.

Some of those values are recommended by the coding guidelines (which are included in the online help), for example, see the Section Libraries -> Guidelines for creating Libraries -> Library Development Summary -> CODESYS LibDevSummary V3.5.4.0 -> Concepts and Elements -> Library Properties defines the following properties:
Code:
         Name Type Description 
Required Company                Text    Serves for structuring (filter) in the “Add Library” dialog
Required Title                  Text    Name of the library
Required Version                Version Library verison
         Released               Bool    A library should not be modified after having been released
         Author                 Text    Author of the current library version
         DefaultNamespace       Text    World-wide unique prefix, for defining the scope of the symbols of the library
         Description            Text    Short description of the purpose of the library
         Placeholder            Text    which Placeholder should be used for referencing the library
         IsContainerLibrary     Bool    This library follwos the rules for a Container Library
         IsInterfaceLibrary     Bool    This library follows the rules for a Interface Library
         LanguageModelAttribute Text    The access on symbols of the library is only possible via Namespace/Prefix
         IsEndUserLibrary       Bool    This Library is especially designed for the needs of end users 

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

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


Last edited by M.Schaber on Fri Feb 14, 2014 10:16 am, edited 1 time in total.

Top
   
PostPosted: Fri Feb 14, 2014 8:52 am 
Offline

Joined: Tue Nov 19, 2013 1:20 pm
Posts: 17
I'd like to read (and if possible write) exactly These values. But when I try to execute the script Codesys replies:
'ScriptObject' object has no Attribute 'IsEndUserLibrary'
...

The same happens wit the languagemodelattribute and the specialdeviceid, is it possible to read/write These attributes?


Top
   
PostPosted: Fri Feb 14, 2014 9:10 am 
Offline
Frequent User
Frequent User
User avatar

Joined: Fri Mar 18, 2011 4:12 pm
Posts: 266
Yes, of course, you use the dictionary syntax, as it is shown in the example script:
Code:
# now we set a custom value...
info.values["SpecialDeviceId"] = "PLC0815_4711"


As I wrote, this dictionary syntax allows to read and write arbitrary values. But in that case, it also is your obligation to use the correct type (as it is when using the "Properties" page in the UI).

Internally, the project information object contains just a dictionary with strings as keys and objects as values. There is nothing special about values like "title" and "version" compared to the others. The only exception is that they have more convenient ways to configure them via explicit scripting API and UI form, in addition to the generic access via the "Properties" page and the dictionary syntax.

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

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


Top
   
PostPosted: Fri Feb 14, 2014 9:55 am 
Offline

Joined: Tue Nov 19, 2013 1:20 pm
Posts: 17
That works, thank you

only Thing, DefaultNamespace must be written whitout an underline or space.

default_namespace = info.values["DefaultNamespace"]


Top
   
PostPosted: Fri Feb 14, 2014 10:57 am 
Offline
Frequent User
Frequent User
User avatar

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

dblessin wrote:
DefaultNamespace must be written whitout an underline or space.

default_namespace = info.values["DefaultNamespace"]


Thanks for the hint, I did correct my table above, and I did inform our documentation department so they correct the online help.

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

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


Top
   
PostPosted: Wed Apr 30, 2014 4:31 pm 
Offline

Joined: Tue Apr 08, 2014 12:21 pm
Posts: 10
Hi,
where can i find the "ProjectInfoExample.py" or "ProjectInfoCreation.py" example script you mentioned in the previous post ?

Regards,
Dave


Top
   
PostPosted: Fri May 02, 2014 7:12 am 
Offline
Frequent User
Frequent User
User avatar

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

For the "ProjectInfoExample.py", you need to ask dblessin.

I did attach the "ProjectInfoCreation.py" file to this post.

HTH,
Markus


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
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 8 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