In order to define a contextual action for seismic layers, you need to put your Python script in your Python directory under a directory called Contextual_XSection_Horizon_Layer.
Go to Tools->Options->Environment->Python Scripts (or Tools->Options->Python->Scripts in INTViewer 5.2) and click "Refresh from Disk". Your script should be listed automatically.
You will now be able to execute this script from the contextual menu of the horizon layer:
The following variables are defined by INTViewer for access in your script:
layer: the HorizonLayer upon which the contextual script will be executed.
keyValues: the map of key names with their associated values based on the layer's current selection
keyUnitSymbols: the map of key names with their associated unit symbols
deviceX: the X position of the mouse in device coordinates when the contextual menu was opened expressed as an integer
deviceY: the Y position of the mouse in device coordinates when the contextual menu was opened expressed as an integer
modelX: the X position of the mouse in model coordinates when the contextual menu was opened expressed as a double
modelY: the Y position of the mouse in model coordinates when the contextual menu was opened expressed as a double
This script will add a color map based on the Depth values and halve the original color map range.
This script is attached to the bottom of this article.
The result after the script executes should look something like the following.