EPICS Controls 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  <20162017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: CSS Boy scripting, clear XY-Graph automatically
From: "Kasemir, Kay" <[email protected]>
To: Hinxx <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Fri, 5 Feb 2016 14:25:55 +0000
Hi:

If you can avoid scripts, that’s best because scripts slow the user interface thread down and details of the script API cannot be guaranteed to stay the same as CSS evolves.
In a cynical way, I’d say that if you have to ask how to do a script, you should avoid it because you’ll have trouble maintaining it in the long run.

In your specific example, when the script is attached to a button, the “widget” variable is obviously set to the button. As Hinko explained, you’d first have to locate the actual XYGraph widget, for example via its name in display.getWidget("GridWires”).
That call performs a linear search over all widgets by name, inside the script, on the user interface thread.
In practice, that’s probably “good enough”, but if you do a  lot of that, all of CSS gets slowed down.

An alternate approach would be to have your “Clear” button write to a PV loc://do_clear(1).
In the XYGraph, you can then attach a script that’s triggered by the same  loc://do_clear(1) PV, and that script already has “widget” set to the XYGraph, so just "widget.clearGraph()” would work.

Ideally, there might be a way to handle all this in an IOC:
XYGraph only displays waveform PVs which are accumulating data in the IOC,
and the “Clear” button writes to some PV on the IOC which then clears the waveforms there.
So the CSS displays is really just a display, all the logic (accumulate samples of the scan, save samples to file, clear samples, ..) is on an IOC.

Thanks,
Kay


> On Feb 4, 2016, at 4:48 AM, Hinxx <[email protected]> wrote:
> 
> Hi Christian,
> 
> if you attached the script to the button you should do something like this in your script ("GridWires" is the widget name set in CSS):
> 
> importPackage(Packages.org.csstudio.opibuilder.scriptUtil);
> 
> var w = display.getWidget("GridWires");
> ConsoleUtil.writeInfo("widget: " + w);
> w.clearGraph();
> ConsoleUtil.writeInfo("widget: " + w + " cleared!");
> 
> 
> Hope this helps,
> Hinko
> 
> On 02/03/2016 12:03 PM, Christian Pauly wrote:
>> Dear experts,
>> again i could really need some help:
>> 
>> I have created a CSS GUI display to control Scans based on the sscan record.
>> The scan is started by pressing an "Action Button", and the scan data are immediately displayed using the XYGraph widget. So far very nice.
>> 
>> But now i want to clear the graph everytime i start a new scan by pressing the "scan" button. I guess i should simply attach a script to the button, containing basically only the "clearGraph()" command -
>> 
>> But i have no clue how to write this script.
>> 
>> I tried a single line:
>> "widget.clearGraph()", but always get the error message "clearGraph" is not defined.
>> 
>> How does it work ???
>> 
>> Thanks for any help -
>> Christian
> 
> 



References:
CSS Boy scripting, clear XY-Graph automatically Christian Pauly
Re: CSS Boy scripting, clear XY-Graph automatically Hinxx

Navigate by Date:
Prev: RE: Omega iR2 Temperature controller Mazanec Tomáš
Next: asyn: drvInfo string vs. EPICS record name Phil Atkin
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: CSS Boy scripting, clear XY-Graph automatically Hinxx
Next: Show areaDetector image with BOY IntensityGraph Phil Atkin
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 15 Jul 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·