Autogenerate Views inside the Perspective View Folder Structure (Self Aware SCADA)

I can offer some tips, but be aware that everything you do here is outside the realm of supported territory, so you will have to do a lot of the legwork yourself.

To start, you’ll need to get to the project.

from com.inductiveautomation.ignition.designer import IgnitionDesigner

context = IgnitionDesigner.getFrame().context

Will get you a DesignerContext.
DesignerContext has a method getProject(), which gives you a DesignableProject.

DesignableProject has a ton of utility methods. You will need to learn how our ProjectResource class works and how it stores data, and how resources are keyed by type and location.

For the actual resource, you will want to manually construct a ViewConfig instance with the appropriate children.

Once you have a view config, GSON-serialize it appropriately, store it with the correct resource data key in your ProjectResource, and then you’ll have new resources showing up in your designer. You’ll probably have to save in the designer, then reopen the project for the rest of Perspective to pick them up properly.

4 Likes