[OpendTect_Users] Automizing repetitive tasks in OpendTect 4.2.0c with the Command Driver plugin
Jaap Glas
Jaap.Glas at dgbes.com
Fri Aug 5 10:23:38 CEST 2011
Dear OpendTect user,
The latest patch of OpendTect (4.2.0c), currently available from our download
center, comes with a major upgrade of the Command Driver plugin. The plugin
has evolved from a record and play-back facility for user-interface actions
into a full-fledged script language. Newly supported features include
variables, assignment, a large set of built-in logical, numerical and string
operators and functions, control flow commands (if, for, while, etc.), and
a still increasing set of question commands about the status of almost any
user-interface element (e.g. IsButtonOn, NrMenuItems, CurListItem, GetInput).
This Command Driver functionality offers many new possibilities for heavy
OpendTect users to make their work easier and more efficient. Probably
the biggest profit to yield is in automizing repetitive tasks:
One of the recurring user questions about OpendTect is whether there is
a quick(er) way to do some kind of repetitive task. Loading a huge amount
of wells, importing multiple 2D line SEG-Y data, etc. Such a service can
only be offered by OpendTect itself if the task is very simple, common
and straightforward. For example, OpendTect does offer the possibility to
select multiple horizons with the mouse in order to load them in one go.
However, if the repetitive task is more complex, unique, or variant,
your workflow can still be automized by means of a command script.
The current Command Driver capabilities can be demonstrated best by
automizing a case sent to the Users Mailing List a few months ago
by Magnus Lidgren:
http://lists.opendtect.org/pipermail/users/2011-April/000425.html
His scene contained a big number of 2D lines, and a number of attributes
on each line. He needed to generate a picture for every attribute of every
2D line, and wanted to avoid doing that manually.
Automizing such a repetitive task consists of three stages. Firstly, the
Command Recorder is applied to record the mouse and keyboard actions needed
to perform the task once. Secondly, a text editor is used to modify the
recorded script. Some of the recorded actions have to be generalized,
and a few new commands have to be added to make the script iterative.
These commands are listed in Table III of Appendix B of the user manual:
http://www.opendtect.org/rel/doc/User/base/command_driver_manual.htm#ctrlflowcmds
Thirdly, the Command Driver is applied to run the modified script, initially
to debug it and finally to perform the repetitive task. Both the originally
recorded and the modified command script are listed below. The whole example
has been described in Appendix B of the user manual:
http://www.opendtect.org/rel/doc/User/base/command_driver_manual.htm#reptask
Do not hesitate to contact me if you need assistance when automizing your
(first) repetitive task, or doing anything else in OpendTect where you
suppose the Command Driver may prove its use. Furthermore, if you have
any suggestion for a command or function you think is still missing in
our script language, please let me know.
Best regards,
Jaap Glas.
--
-- dr. Jaap C. Glas
-- Software Engineer
-- dGB Earth Sciences
-- Nijverheidstraat 11-2
-- 7511 JM Enschede, The Netherlands
-- jaap.glas at dgbes.com
-- http://www.dgbes.com
-- Tel: +31 534315155, Fax: +31 534315104
==============================================================================
Recorded command script that makes a snapshot of one attribute on one 2D line.
==============================================================================
[OpendTect Main Window]
TreeMenu "2D Seismics`LS 5k`i5007`Seis" "Display in a 2D Viewer as`VD"
[2D Viewer - Line: i5007]
Button "Save image"
[Create snapshot]
Button "Screen" On
Input "Select filename" "/d43/jaap/surveys/Demo2D/Snapshots/dump.png" Hold
Button "Ok"
[2D Viewer - Line: i5007]
Close
[OpendTect Main Window]
==============================================================================
==============================================================================
Modified command script after it has been generalized and made iterative.
==============================================================================
For setidx = 1
For nameidx = 1
For attridx = 1
[OpendTect Main Window]
res ~ TreeMenu "2D Seismics`*#$setidx$`*#$nameidx$`*#$attridx$" \
"Display in a 2D Viewer as`VD"
If res==FAILURE ; Break ; Fi
pic_name = strCat( wildcard(1), "_", wildcard(2), "_" )
pic_name = strCat( pic_name, wildcard(3), ".png" )
[2D Viewer - Line: *]
Button "Save image"
[Create snapshot]
Button "Screen" On
Input "Select filename" "$SNAPSHOTSDIR$/$pic_name$" Hold
Button "Ok"
[2D Viewer - Line: *]
Close
[OpendTect Main Window]
Rof
If attridx==1 ; Break ; Fi
Rof
If nameidx==1 ; Break ; Fi
Rof
==============================================================================
More information about the Users
mailing list