Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{alias:gvar}
h2. Name

*gvar* — Get Geocap variables and status

h2. Syntax
{panel:|borderStyle=solid|borderWidth=1|bgColor=#FFFFAA}

*set var \[gvar _variable_]*

{panel}

h2. Description

The *gvar* command in the context *set var \[gvar _variable_]* will transfer the Geocap variable or status of the variable into the the Tcl variable; in this case *var*. The *gvar* command is used in advanced scripting when reading internal Geocap variables or status is necessary.

h2. Arguments
There is a long list of variables that can be attached to the *gvar* command as an argument.

The following variables are sometimes called the @ variables because one can create a list by the command *lst @*.

*ran*
{indent}Result from random draw.{indent}
*xmin*
{indent}Minimum x value of active data.{indent}
*xmax*
{indent}Maximum x value of active data.{indent}
*ymin*
{indent}Minimum y value of active data.{indent}
*ymax*
{indent}Maximum y value of active data.{indent}
*zmin*
{indent}Minimum z value of active data.{indent}
*zmax*
{indent}Maximum z value of active data.{indent}
*xwin*
{indent}Minimum x of graphical window.{indent}
*xwax*
{indent}Maximum x of graphical window.{indent}
*ywin*
{indent}Minimum y of graphical window.{indent}
*ywax*
{indent}Maximum y of graphical window.{indent}
*zwin*
{indent}Minimum z of graphical window.{indent}
*zwax*
{indent}Maximum z of graphical window.{indent}
*posx*
{indent}x position of manipulator.{indent}
*posy*
{indent}y position of manipulator.{indent}
*posz*
{indent}z position of manipulator.{indent}
*numpoint*
{indent}Number of points in active data.{indent}
*numcell*
{indent}Number of cells in active data.{indent}
*numscalar*
{indent}Number of scalars in active data.{indent}
*nrow*
{indent}Number of elements in a row in active grid.{indent}
*ncol*
{indent}Number of elements in a column in active grid.{indent}
*nlay*
{indent}Number of layers in active grid.{indent}
*xinc*
{indent}x increment of active grid.{indent}
*yinc*
{indent}y increment of active grid.{indent}
*zinc*
{indent}z increment of active grid.{indent}
*dispnum*
{indent}Display list number.{indent}
*rc*
{indent}Return code from system: 0=error 1=OK.{indent}
*cellid*
{indent}Cell id from graphical cursor intersection.{indent}
*pointid*
{indent}Point id from graphical cursor intersection.{indent}
*files*
{indent}File number in *get* and *put*.{indent}
filetype*
{indent}Filetype number of active data.{indent}
*hasscalar*
{indent}Returns 0 if active data has not scalars; 1 if has scalars.{indent}
*isgrid*
{indent}Return 0 if not; 1 if grid.{indent}
*volume*
{indent}Volume number from *vol* command.{indent}
*lookup*
{indent}Lookup value from *lok* command.{indent}
*zsmin*
{indent}Minimum z scalar value from active data.{indent}
*zsmax*
{indent}Maximum z scalar value from active data.{indent}
*zcmin*
{indent}Minimum z cell scalar value from active data.{indent}
*zcmax*
{indent}Maximum z cell scalar value from active data.{indent}
*standev*
{indent}Standard deviation from statistical calculation.{indent}
*mean*
{indent}Mean value from statistical calculation.{indent}
*var*
{indent}Free variable used by some commands.{indent}
*window*
{indent}Window number of active graphical window.{indent}
*wintot*
{indent}Total number of windows.{indent}
*viewports*
{indent}Total number of viewports.{indent}
*activeview*
{indent}Active viewport number.{indent}
*actorid*
{indent}Actor id of graphical display element.{indent}
*xval*
{indent}x curosor position.{indent}
*yval*
{indent}y cursor positon.{indent}
*zval*
{indent}z cursor position set in a 3D cube.{indent}
*sval*
{indent}Scalar value of cursor position.{indent}
*seed*
{indent}Seed value in statitical calculation.{indent}
*median*
{indent}Median value from statistical calculation.{indent}
*mode*
{indent}Mode value from statistical calculation.{indent}
*skewness*
{indent}Skewness value from statistical calculation.{indent}
*kurtosis*
{indent}Kurtosis value from statistical calculation.{indent}
*correlation*
{indent}Correlation value from statistical calculation.{indent}
*horizons*
{indent}Number of horizons read into workspace.{indent}
*data*
{indent}Data flag of active data: 0=error 1=OK.{indent}
*upd*
{indent}Up / down flag : up=1 down=-1 .{indent}
*cubetype*
{indent}2D or 3D cube flag.{indent}
*levels*
{indent}Number of contour levels.{indent}
*area*
{indent}Area of area calculation.{indent}
*distance*
{indent}Distance of distance calculation.{indent}
*value*
{indent}Used by various value output.{indent}
*putnum*
{indent}Number of files saved in put.{indent}
*lc*
{indent}Loop counter.{indent}
*utmzone*
{indent}Utm zone of active zone.{indent}
*hemis*
{indent}active hemisphere.{indent}
*numlookup* // number of lookup curves
{indent}Number of lookup curves in lookup calculation.{indent}
*numpolygon* // number of polygon curves
{indent}Number of polygon curves in lookup calculation.{indent}
*zorigo*
{indent}z origo value of image.{indent}
*slope*
{indent}Slope of regression curve.{indent}
*intercept*
{indent}Interception of regression curve.{indent}
*rangelo*
{indent}Low range value of 3D cube.{indent}
*rangehi*
{indent}High range value of 3D cube.{indent}
*newactorid*
{indent}New (current) actor id of graphical display element.{indent}
*diagonal*
{indent}Diagonal of the graphical window.{indent}
*oldx*
{indent}x position of previous cursor.{indent}
*oldy*
{indent}y position of previous cursor.{indent}
*oldz*
{indent}z position of previous cursor.{indent}
*angle*
{indent}Angle of rotated dataset.{indent}
*locori*
{indent}Has local origo in dataset.{indent}

The following list represents additional system variables.

*datalist* 
{indent}List of all datasets in workspace including active.{indent}
*hilist* 
{indent}List of all datasets in workspace not including active.{indent}
{indent}{indent}
*hi* | *hiname* _name_ 
{indent}Test if _name_ present in hicore names.{indent}
*gridlist*    
{indent}List of only workspace grid names.{indent}
*polylist* // only hicore polydata names   
{indent}List of only workspace polydata names.{indent}
*list* _name_
{indent}List of only workspace _name_ data.{indent}
*value* *x|y|z|s* _number_
{indent}Get x,y,z or s value at _number_ position in active data{indent}
*field*
{indent}Get a list of all field data.{indent}
*fieldnum*
{indent}Get a list of all numeric field data.{indent}
*name* | *dataname" | *filename*
{indent}Get the saved data name of active data.{indent}
*numeric* _fielddata_   
{indent}Check if _fielddata_ is numeric. 0 if not numeric, 1 if numeric.{indent}
*type"* | *datatype" *  
{indent}Check data type of active data.{indent}
*data* 
{indent}Check if valid data is present in active. 0 if invalid, 1 if valid{indent}
*undef* 
{indent}Check if polydata contains undefined values.{indent}
*rotation*
{indent}Check if grid or cube have rotation.{indent}
*fdata" | *fd* _name_ 
{indent}Get a list of field data in _name_.{indent}
*fdata" | *fd*  *exist* _name_ 
{indent}Check if  field data _name_ exists.{indent}
*number* _variable_    
{indent}Check if _variable_ is numeric. 0 if not numeric, 1 if numeric.{indent}
*replaceblank* _string_
{indent}Replace all blanks in _string_.{indent}
*actorid* 
{indent}Return the actor id of the last graphic display action.{indent}
*numcom*    
{indent}Get the number of components in active data.{indent}
*xscreen* 
{indent}Get x size in pixels of screen.{indent}
*yscreen* 
{indent}Get y size in pixels of screen.{indent}
*dimension* 
{indent}Get dimension of dataset: grid or cube.{indent}
*scalar* 
{indent}Get existence of scalars in active data. 0 if not present, 1 if present.{indent}
*numundef* 
{indent}Get number of undefined in a grid.{indent}

 
h2. Examples
The following example show the use of gvar command. 

The task is to split a dataset into cells with 3 points in each cell. It uses advanced Geocap programming.
{noformat:|borderWidth=1|bgColor=#eeeeee}
set numpoi [gvar numpoint] ; # get number of points
set n3 [expr $numpoi / 3]
set pp [points x y z] ; # transfer all points to the pp variable as a list
dhi data ; # delete data in workspace
set i 0
for {set j 0} {$j < $n3} {incr j} {
    for {set k 0} {$k < 3} {incr k} {
        set a [lindex $pp $i] ; # get the x coordinate
        incr i
        set b [lindex $pp $i] ; # get the y coordinate
        incr i
        set c [lindex $pp $i] ; # get the z coordinate
        eval sta $a $b $c ; # stack the coordinates
        incr i
    }
    rea ter ; # read the stack
    mhi data app ; # append data into workspace
}
 
# The result is saved in workspace data
{noformat}


{pagebreak}