this is an improved version that doesn't throw an exception if the property already exists def CreateAllProperties(fbname, shouldAddMonitor = False): # get current project project = projects.primary # find the function block fb = project.find(fbname, True)[0] # get the declaration text declaration = fb.textual_declaration # iterate all lines in the declaration for i in range(declaration.linecount): line = declaration.get_line(i) # get this declaration line stripped = line.strip() # strip out white...
def CreateAllProperties(fbname): # get current project project = projects.primary # find the function block fb = project.find(fbname, True)[0] # get the declaration text declaration = fb.textual_declaration # iterate all lines in the declaration for i in range(declaration.linecount): line = declaration.get_line(i) # get this declaration line stripped = line.strip() # strip out white space in this line endofline = stripped.find(";") stripped = stripped[0:endofline] # discards anything past the ";"...
CreateProperties from variable declaration in FB
update project information
Print all libraries and their dependencies
alternatively check the sim is enabled beforehand and turn it on if not yet enabled devs = proj.find('testdev') if len(devs) > 0: # check if sim is enabled cur_sim_mode = devs[0].get_simulation_mode() print(cur_sim_mode) # enable sim conditionally if not cur_sim_mode: devs[0].set_simulation_mode(True)
Home
Home
Home
Home
See attached file for result
update project information
Just remove the line.
Nice
just an old habit to add such future imports, just remove the line
Hi Aliazzz, thanks a lot! I did myself not know how to customize the project information. But what was the future import good for? it doesn't seem to be used anywhere.
update project information
Update Device
Home
Install missing libraries
Install missing libraries
Home
Installation of missing libraries
Installation of missing libraries
Handle Answers of Dialogs
Handle Answers of Dialogs
Disable System Prompts and Dialogs
Disable System Prompts and Dialogs
Searching for an object example
This wiki page has a section on help.codesys.com currently it links only to the section that details the available classes and functions. Scripting Engine There is another section not yet mentioned in the wiki article. It is in another area of help.codesys.com that scripters might find useful, and that is: CODESYS Development System > Using Scripts edit: clarified content. I guess it is a pull request to add the 'other' section of help.codesys.com
as well the api list already mentioned, help.codesys.com also has details on how to script. CODESYS Development System > Using Scripts
Searching for an object example
Login and monitor variable
Add device to project
Switch device to simulation mode
Home
Home
I think it is important to note that Visual Studio Community is not able to be used legally in all scenarios. If you use it only for creating open source content you are fine (right now), but in all other cases I would check the "Usage" section of this link https://visualstudio.microsoft.com/vs/community/ [History, maybe not relevant] At one point Visual Studio Express was available and free in all use cases. Now your free options are Visual Studio Community (for some use cases) and Visual Studio...
Home
Create an FB
Export as PLCOpen XML
Modify Properties / Compiler defines
SVN checkout
SVN commit
SVN update
Check compile errors of libraries
Iterate over the device tree
Iterate over the device tree
Comes from a forum user, who didn't define a license: https://forum.codesys.com/viewtopic.php?t=7626
Check compile errors of libraries
Add Device with Task Configuration
SVN update
SVN commit
SVN checkout
Modify Properties / Compiler defines
Export as PLCOpen XML
Create an FB
Create an FB
Iterate over the device tree
Open and close a project
Home
Home
Home
Home
Home