Trying to use scripts to scan the POUs in a folder in the object tree in order to use the names of the POUs in another location, just as a way to automate some programming tasks. Problem I'm running into is I can't find the right attribute to call to flag an object in the tree as a POU. I've tried the closest thing I could find which is .is_fb but it returns with an error saying it's not an attribute of ScriptObject. Any help pointing me in the right direction would be greatly appreciated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
You can check the export.py file of this github repo, it generates text files for every POU in a project (and more).
To do so, it iterates over every object in a project recursively, starting with the tree returned by projects.primary.get_children().
I hope this can help you,
BR
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Trying to use scripts to scan the POUs in a folder in the object tree in order to use the names of the POUs in another location, just as a way to automate some programming tasks. Problem I'm running into is I can't find the right attribute to call to flag an object in the tree as a POU. I've tried the closest thing I could find which is .is_fb but it returns with an error saying it's not an attribute of ScriptObject. Any help pointing me in the right direction would be greatly appreciated.
Hello,
You can check the
export.py
file of this github repo, it generates text files for every POU in a project (and more).To do so, it iterates over every object in a project recursively, starting with the tree returned by
projects.primary.get_children()
.I hope this can help you,
BR