Is it possible to determine the of objects in the project tree while iterating over them?
I need to distinguish between POUs and Visualization objects for example.
 Â
forchildinfolderobject.get_children():
    ifchild.is_folder:
      print('Found folder: {}'.format(child.get_name()))
      export_folder(child)
    else:
      print(child.type)
child.type() will only return these guid, but from my current understanding i have no way tell what kind of object that is?
Thanks in advance
Florian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes so i saw the functions for testing for folder and devices.
The use case is exporting of the project, but on a per-file basis.
I basically need to have one POU/Visualisation in one exported file.
This is also why i am not using the recursive export on the project, because it will stop exporting when encountering a subfolder of project. I have this working already for everything code related by using PLCOpenXML-files.
Visualisations do not export to PLCOpenXML though at all as it seems?
So the idea is to export them seperately in native format.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
M.Keller hat geschrieben:
For POUs you could check the object for the property "has_textual_declaration" because all POU objects have an textual declaration.
BR
Martin
Is there a property than can be checked for Visualizations?
Regards,
Daniel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is it possible to determine the of objects in the project tree while iterating over them?
I need to distinguish between POUs and Visualization objects for example.
child.type() will only return these guid, but from my current understanding i have no way tell what kind of object that is?
Thanks in advance
Florian
Hi FloWil.
What's the use case behind your question?
Some objects, which are supported by the ScriptEngine, have a special property. For example, the device object has the property "is_device".
BR
Martin
Yes so i saw the functions for testing for folder and devices.
The use case is exporting of the project, but on a per-file basis.
I basically need to have one POU/Visualisation in one exported file.
This is also why i am not using the recursive export on the project, because it will stop exporting when encountering a subfolder of project. I have this working already for everything code related by using PLCOpenXML-files.
Visualisations do not export to PLCOpenXML though at all as it seems?
So the idea is to export them seperately in native format.
Hi FloWil.
For POUs you could check the object for the property "has_textual_declaration" because all POU objects have an textual declaration.
I think it is not part of the PLCopenXML specification.
BR
Martin
Hi Martin,
Is there a property than can be checked for Visualizations?
Regards,
Daniel
Hi qbarral.
Sorry, but no.
We have Scripting API for Text List and Image Pool but not for the Visual objects.
BR
Martin