Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017 Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
<== Date ==> <== Thread ==>

Subject: Re: Set the PV value in different interface through script
From: "Kasemir, Kay" <kasemirk@ornl.gov>
To: "xus@mail.ustc.edu.cn" <xus@mail.ustc.edu.cn>, "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Mon, 4 Dec 2017 14:15:29 +0000
Hi:

> I am using DisplayBuilder to create a main interface, through the different ActionButtons in the main interface, I can enter into different sub-interface.
> Now, I want to add an ActionButton adding an "Execute Script" > action on the main interface, which  can write PV values to different sub-interface when pushing the button.
> I have learned Css Applications> Display> Scripts in Help Content, but did not find a suitable method. Is it possible to change PV value by giving the PV name in the script?

If you decide to create a PV within a script, note that it is then your responsibility to wait until the PV connects,
to handle errors, and to finally release the PV when the script is done using the PV.

Typically, widgets do that work for you, and they do it very effectively.
A widget like the Text Entry widget connects to its PV on startup,
then monitors the value and connection state, indicating problems via the border,
and finally disconnects when the display is closed.

When you use scripts, they typically receive PVs via their pvs[] array, and the display builder
maintains those PV connections for you.
The Display Builder script_util/script_util.bob & write_pv.py example shows how a script can find the PV of other widgets in the display and then write a value to that PV.
Again in that example the widgets maintain the PV connection, and the script just uses those PVs which are already connected.

I just added an example for a script that connects to a PV, writes a value, and then disconnects.
See  https://github.com/kasemir/org.csstudio.display.builder/blob/master/org.csstudio.display.builder.model/examples/script_util/write_any_pv.py

Still, you might want to reconsider your use case.
A display should know the PVs to which it writes.

-Kay

References:
Set the PV value in different interface through script xus

Navigate by Date:
Prev: Set the PV value in different interface through script xus
Next: RE: EPID bumpless restart Crisp, Daniel
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
Navigate by Thread:
Prev: Set the PV value in different interface through script xus
Next: Limit (between 0.1 and 86400) of Archiver Appliance sampling period for PVs Wang, Lin
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
ANJ, 05 Dec 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·