Can I Paste Binding using Python

I love the Copy/Paste of bindings in the designer. Is that functionality exposed to Python?

I’m trying to write code to expose some of the design-time specified bindings in a tag history binding at runtime. My idea was to make the changes at design time, copy/paste the bindings for those into a text editor and then copy/paste each of them into my script using “system.util.jsonDecode”. Then I was going to try to paste that binding to the property using code (if possible)

I’m trying to do this in Perspective. I realize I could just stack 2 different chart objects inside a coordinate container and toggle visibility and programaticaly set dimensions of the charts using bindings to the root container and then throw that whole mess into a responsive container to achieve a responsive layout but I’m trying to build a more elegant layout. Basically, I’m trying to avoid building something I will be scratching my head over down the road.

Sounds like what you’re trying to do would be better done with a Breakpoint container. You can define breakpoints that cause completely different layouts to be used depending on display size.

I know this would be a lovely feature, to set bindings runtime, but I don’t know if you can actually do that in a script.

Some threads that might help you are:


(unfortunately sometimes) Ignition just isn’t C where this would be trivial

1 Like

I might be missing something with breakpoint containers. I have used them to switch between layouts based on the dimensions of the container but I’m trying to effectively either programatically adjust the static parts of a historic binding on a chart or swap out a chart in real time configuration with a chart in historic configuration. So the dimensions would be static.

Is there a way to toggle breakpoints based on something other than dimensions?

The second link shows me that I need to look into layout options. Thanks for that.

The other poster’s comment about the breakpoint container has me looking at other containers. I think maybe tab container (assuming I can hide the tabs) or maybe a carousel.

Just an update in case anyone else is trying to do this.

You can take a tab control and put a realtime version of your chart on one tab and a historical version on another tab. Then you set tabs to have size of 0,0. Then you set bindings so your user can select the UI mode they want to use.

It’s a little awkward of a layout but it lets you prevent layout issues when switching chart modes and lets you have an auto-stretch functionality on the chart without scripting (just put a flex container in the tab and tell your chart to grow).