Problem:
Interactively I can specify streamtrace start positions by giving the IJK location within a zone. How do I do this in a macro?
Solution:
It is possible to define a streamtrace starting position using IJK coordinates in a macro if you use the $!GETFIELDVALUE command to get the XYZ coordinates for a IJK location.
Heres some example macro code:
## These variables define the IJK starting position:
$!VARSET |Istart| = 12
$!VARSET |Jstart| = 13
$!VARSET |Kstart| = 1
## Since $!$GETFIELDVALUE only accepts 1D arrays for
## the index this function converts IJK into a 1D index value:
$!VARSET |1DArrayIndex| = ( |Istart| + |MAXI|*(|Jstart|-1) + |MAXI|*|MAXJ|*(|Kstart|-1) )
## These 3 $!GETFIELDVALUES assume that variables 1
##2 and 3 are your X Y and Z axis variables:
$!GETFIELDVALUE |Xstart| VAR = 1 ZONE = 1 INDEX = |1DArrayIndex|
$!GETFIELDVALUE |Ystart| VAR = 2 ZONE = 1 INDEX = |1DArrayIndex|
$!GETFIELDVALUE |Zstart| VAR = 3 ZONE = 1 INDEX = |1DArrayIndex|
You can then insert the |Xstart| and |Ystart| macro variables into the $!STREAMTRACE ADD command in your macro.