Vis5D Scripting Last updated: 2 October 1998
While Tcl experience is recommended for writing Vis5D scripts, some short but useful scripts can be written without any real Tcl knowledge.
Note that the Tcl package does not have to be installed on your computer in order to use Vis5D's script interface. If it is not installed, Vis5D uses a small, built-in interpreter which can execute very simple Tcl scripts. However, if you want to take full advantage of Vis5D's Tcl interface you should install Tcl on your computer.
To obtain and install Tcl see the instructions on the
Tcl page.
We recommend using Tcl version 7.4 at this time since version 7.5
has a bug which effects Vis5D.
After Tcl has been installed you can enable the full Tcl support in Vis5D
by following these instructions:
The set command assigns a value to a variable. Its syntax is:
The value of a variable is obtained by preceding the name with a $ sign.
Example:
Lines which start with the # symbol are considered to be comments and
ignored.
The built-in interpeter cannot evaluate mathematical expressions or
execute control structures like loops, conditionals or subroutines. The
Tcl package must be installed to execute scripts with those constructs.
You may also execute a script file when you start vis5d with the
If it exists, the startup file
The second command tells vis5d to actually compute the horizontal colored
slice graphic of "SPD" for all time steps.
The third command tells vis5d to actually display the colored slice.
Vis5D Tcl commands are of the form:
vis5d_command $ctx/$dtx/$grp arguments
That is, a command name followed by one context variable, followed by zero
or more arguments.
Return value is either VIS5D_ON or VIS5D_OFF indicating the current
status of the mode flag.
2. Setting up full Tcl support
If you do not have Tcl installed on your computer and only plan to use
simple Vis5D Tcl scripts you may skip this section.
If all goes well vis5d will compile and link with Tcl support. If
there are errors be sure that you've correctly specified the location
of the include and library files described above.tcl.h
include file and the
libtcl.a
library file are located. /usr/local/include
and /usr/local/lib are common.ln -s tcl7.4.h tcl.h
and
ln -s libtcl7.4.a libtcl.a
if this wasn't done when Tcl
was installed.src/Makefile
as follows
#Tcl support: uncomment and edit to enable
#TCL_INCLUDE = -DTCL -I/usr/local/include
#TCL_LIB = -L/usr/local/lib -ltcl
Remove the leading #
on the 2nd and 3rd lines and change
the /usr/local/include and /usr/local/lib
parts to reflect the location of Tcl on your computer. You should
have something like this:
#Tcl support: uncomment and edit to enable
TCL_INCLUDE = -DTCL -I/usr/local/include
TCL_LIB = -L/usr/local/lib -ltcl
make
followed by your operating
system configuration. Type make
alone to see a list of
possibilities.
3. The built-in interpreter
When Tcl is not installed Vis5D uses a simple built-in interpreter. It
only understands the Tcl set and source commands,
the Vis5D-specific commands, variable substitution and comments.
set var value
Where var is a variable name and value is
a number or a character string. Examples:
set temperature 280.0
set month February
set message "Press any key"
Note that multi-word strings must be surrounded by double-quotation marks.
set time 4
vis5d_set_timestep $dtx $time
The source command reads Tcl commands from another file.
Its syntax is:
source file
Where file is the name of another Tcl file.
4. Accessing the Tcl interface in Vis5D
On Vis5D's control panel there are two buttons labeld SCRIPT..
and INTERP... The first button is used to execute a Tcl script
from a file and the second button is used to interactively type in
Tcl commands.
Script files
When you click on the SCRIPT.. button a file selector
window will appear. Select the Tcl script you want to execute
and click on OK. If an error occurs while executing
the script a pop-up window will tell you
so. Also, look in your shell window for error messages.-script
command line option. For example
vis5d LAMPS.v5d -script foo.tcl
executes foo.tcl
automatically upon startup.Interactive Tcl commands
When you click on the INTERP.. button Vis5D will halt. In your
shell window the vis5d>
prompt will appear. You can now
type in Tcl commands. Type exit
when finished.vis5d.tcl
is
automatically executed before you get the vis5d>
prompt.
One use of this file is to load macros or functions that you always use.
5. Examples of basic Vis5D Tcl commands
We begin with some simple examples which could be executed either from
a script file or typed in by hand.Example 1
Suppose we have an isosurface of temperature (variable name "T")
displayed in vis5d and we want to color it red. The following Tcl
command will do that:
vis5d_set_color $dtx VIS5D_ISOSURF $ctx "T" 1.0 0.0 0.0 1.0
The command name is vis5d_set_color
. The arguments are:
$dtx
- this specifies the display context. Don't worry
about its meaning now, it will be explained more later.
VIS5D_ISOSURFACE
- this identifies what kind of graphic
to color.
$ctx
- this specifies the data context. Don't worry
about its meaning now, it will be explained more later.
"T"
- this specified which isosurface to color
1.0 0.0 0.0 1.0
- this is the RGBA color of the isosurface.
Each number is in the range 0.0 to 1.0. The first three numbers are
the red, green, and blue color components and the last number is the
opacity or transparency where 0.0 is completely transparent and 1.0
is completely opaque.
Example 2
Suppose we simply want to set the currently displayed timestep to be
the fourth in the dataset.
vis5d_set_timestep $dtx 3
This command should be self explanatory except for the fact that we
specified 3 instead of perhaps 4. The reason is Vis5D begins counting
timesteps starting at zero, not one. Therefore timestep number 3 is
actually the fourth timestep.Example 3
Suppose we want to compute and display a horizontal colored slice
of wind speed (variable name "SPD") at vertical grid level 2. The
following commands will do that.
vis5d_set_chslice $ctx "SPD" 2.0
vis5d_make_chslice $ctx VIS5D_ALL_TIMES "SPD"
vis5d_enable_graphics $ctx VIS5D_CHSLICE "SPD" VIS5D_ON
The first command sets the position of the colored slice to grid level 2.0Example 4
To print the current parameters of the horizontal contour slice of SPD:
puts [ vis5d_get_hslice $ctx "SPD" ]
6. Basic Tcl syntax
This section gives examples of basic Tcl language constructs by comparing
them to C and Fortran syntax. See a Tcl language reference for more
information.Comments
C: /* this is a comment */
Fortran: C this is a comment
Tcl: # this is a comment
Assigments
C: x = 1.0;
Fortran: x = 1.0
Tcl: set x 1.0
Expressions and assignments
C: average = (a+b)/2.0;
Fortran: average = (a+b)/2.0
Tcl: set average [ expr ($a+$b)/2.0 ]
For Loops
C:
for (i=1;i<=10;i++) {
body of loop
}
Fortran:
do i=1,10
body of loop
enddo
Tcl:
for {set i 1} {$i <= 10} { set i [expr $i+1] } {
body of loop
}
Conditionals
C:
if (x<0.0) {
y = 0.0;
}
else if (x>100.0) {
y = 100.0;
}
else {
y = x;
}
Fortran:
if x .lt. 0 then
y = 0.0
else if x .gt. 100 then
y = 100.0
else
y = x
end if
Tcl:
if {$x<0.0} {
set y 0.0
} elseif {$x>100.0} {
set y 100.0
} else {
set y $x
}
Printing
C:
puts( "Hello world!\n" ); /* string */
printf( "i=%d\n", i ); /* integer */
printf( "x=%f\n", x ); /* real (float) */
Fortran:
print *,"Hello world!"
print *,i
print *,x
Tcl:
puts "Hello world!"
puts $i
puts $x
7. Vis5D Tcl command structure
All of the Vis5D Tcl commands start with the prefix vis5d_
and all of the Vis5D Tcl constants start with the prefix
VIS5D_
. This makes it easy to spot Vis5D-specific
commands in a script and prevents confusion with other Tcl identifiers.A note on $ctx/$dtx/$grp and Vis5D contexts
Vis5D's internal core supports multiple contexts of three different types.
The $ctx represents the data context. The $ctx can be thought of as a Vis5D
file read into memory plus all the associated graphics. The $dtx is the
display context, it contains information on how the data from $ctxs are
displayed on the 3-D graphics window. The $grp represents the group context.
The $grp contains information about $dtxs that are linked together. In
many cases there may be multiple contexts of any one type. For example,
two Vis5d files can be viewed in one 3D graphics window, two $ctxs and
one $dtx. One could also view four Vis5d files in four different graphics
windows, four $ctxs and four $dtxs. With multiple contexts the nomenclature
would change, it might be $ctx1, $ctx2, etc.
Note: In cases where only one Vis5d file is used, $ctx can be used
in place of $dtx.
A note on variable and timestep numbers
Many of the Vis5D Tcl commands take timestep and/or physical variable
parameters. Be aware that timesteps are numbered starting at 0. Similarly,
variables are numbered starting with 0. Also, wherever a physical variable
argument is expected you may supply either a number or a name.
8. Command reference
In this section we document each of the Vis5D Tcl commands. Programmers
should note that the Vis5D Tcl commands are a subset of the Vis5D API
functions described in the Vis5D API document. More of the API functions
may be made available as Tcl commands in the future.General Commands
vis5d_terminate
Timestep Commands
When there are multiple $ctxs attached to a $dtx the time steps are
merged in such a way that a $dtx time step contains one time step from
each data context. The same is true when multiple data contexts are attached
to a group context.
vis5d_get_ctx_numtimes data_context
vis5d_get_dtx_numtimes display_context
vis5d_get_grp_numtimes group_context
vis5d_get_ctx_time_stamp data_context timestep
vis5d_get_dtx_time_stamp display_context timestep
vis5d_set_ctx_time_stamp data_context timestep data time
vis5d_set_dtx_timestep display_context timestep
vis5d_set_grp_timestep group_context timestep
vis5d_get_ctx_timestep data_context
vis5d_get_dtx_timestep display_context
vis5d_get_grp_timestep group_context
File Commands
vis5d_get_v5dfilename data_context
vis5d_get_context_name data_context
vis5d_load_v5dfile display_context memory filename ctxname
vis5d_destroy_data_context data_context
vis5d_save_to_v5dfile data_context filename
Physical Variable Commands
vis5d_get_numvars data_context
vis5d_get_var_name data_context varnum
vis5d_get_var_units data_context varnum
vis5d_get_var_type data_context var
vis5d_get_var_range data_context var
vis5d_set_var_range data_context var min max
vis5d_set_sound_vars display_context temp dewpt
uwind vwind var1 var2 var3
vis5d_get_sound_vars display_context
vis5d_set_sound_vars_and_owners display_context tempctx temp dewptctx dewpt
uwindctx uwind vwindctx vwind var1ctx var1 var2ctx var2 var3ctx var3
vis5d_get_sound_vars_and_owners display_context
vis5d_set_wind_vars_and_owners display_context uvarctx uvar vvarctx vvar wvarctx
wvar u2varctx u2var v2varctx v2var w2varctx w2var trjuctx trju trjvctx
trjv trjwctx trjw
vis5d_get_wind_vars_and_owners display_context
Group Commands
vis5d_set_display_group display_context group_context
vis5d_get_display_group display_context
vis5d_get_num_of_dtxs_in_group group_context
Display Functions
vis5d_set_display_matrix rows columns
vis5d_get_display_matrix
vis5d_assign_display_to_data data_context display_context
vis5d_get_num_of_ctxs_in_display display_context
Grid Commands
The display grid or 'virtual' grid
defines the 3-D space where the graphics are mapped to. The values defining the
display grid may be changed where as the data grids remains static.
vis5d_get_ctx_grid_rows data_context
vis5d_get_dtx_grid_rows display_context
vis5d_get_ctx_grid_columns data_context
vis5d_get_dtx_grid_columns display_context
vis5d_get_ctx_grid_levels data_context var
vis5d_get_dtx_grid_levels display_context
vis5d_set_dtx_grid_rows display_context numrows
vis5d_set_dtx_grid_columns display_context numcols
vis5d_set_dtx_grid_levels display_context numlevs
vis5d_verylarge_mode data_context flag
vis5d_open_gridfile data_context filename readflag
Map projection and vertical coordinate system commands
vis5d_get_ctx_projection data_context
vis5d_get_dtx_projection display_context
vis5d_get_ctx_vertical data_context
vis5d_get_dtx_vertical display_context
vis5d_set_dtx_projection_and_vertical display_context proj_arg proj_value level
vis5d_get_curved display_context
Topography, Map and Texture Commands
vis5d_check_topo display_context
vis5d_check_map display_context
vis5d_check_textureo display_context
vis5d_get_topo_range display_context
vis5d_reset_topo_colors display_context
vis5d_set_topo_color_var_and_owner display_context varctx var
vis5d_init_map display_context mapfilename
vis5d_init_topo display_context topofilename
vis5d_init_texture display_context texturefilename
vis5d_init_firstarea display_context area_number
vis5d_init_sequence display_context sequencefilename
Cloning, External Functions and Expression Commands
vis5d_make_clone_variable data_context clonename var
vis5d_compute_ext_func display_context funcname
vis5d_make_expr_var display_context expression
Rendering Commands
vis5d_draw_frame display_context
vis5d_draw_3d_only display_context animflag
vis5d_draw_sounding_only display_context redraw_background
int vis5d_init_samescale display_context
vis5d_map_sndwindow display_context show
vis5d_invalidate_dtx_frames display_context
vis5d_graphics_mode display_context graphic mode
Returns 1 if graphic is displayed, 0 if graphic is not displayed or an
error message if any parameters are invalid.
vis5d_enable_graphics data_context graphic number mode
Returns 1 if graphic is displayed, 0 if graphic is not displayed or an
error message if any parameters are invalid.
vis5d_get_volume_and_owner display_context
vis5d_set_volume_and_owner display_context varctx var
vis5d_set_color display_context graphic numberctx number red green blue alpha
vis5d_set_color display_context graphic number red green blue alpha
vis5d_set_color_table_entry display_context graphic varctx var entry r g b a
vis5d_set_color_table_entry display_context graphic var entry r g b a
vis5d_set_legends display_context position size
vis5d_set_logo_size display_context size
vis5d_alpha_mode display_context mode
vis5d_font display_context fontname [size]
vis5d_get_font_height display_context
vis5d_linewidth display_context width
vis5d_resize_contour_font data_context sizefactorx sizefactory
Clipping Functions
vis5d_set_hclip display_context number level
vis5d_set_vclip display_context number r1 c1 r2 c2
vis5d_get_hclip display_context number
vis5d_get_vclip display_context number
3-D View Commands
vis5d_set_matrix display_context matrix
vis5d_get_matrix display_context
vis5d_set_ortho_view display_context view
vis5d_set_view display_context xrot yrot zrot scale xtrans ytrans ztrans
vis5d_get_view display_context
vis5d_set_camera display_context perspective frontclip zoom
vis5d_get_camera display_context
Isosurface, Slice, and Trajectory Commands
vis5d_set_isosurface data_context var isolevel
vis5d_get_isosurface data_context var
vis5d_set_isosurface_color_var_and_owner data_context isovar colorvarctx colorvar
vis5d_make_isosurface data_context time var urgent
vis5d_set_hslice data_context var interval low high level
Note that this function does not actually compute the slice.
vis5d_get_hslice data_context var
vis5d_set_hslice
.
vis5d_make_hslice data_context time var urgent
vis5d_set_vslice data_context var interval low high r0 c0 r1 c1
Note that this function does not actually compute the slice.
vis5d_get_vslice data_context var
vis5d_set_vslice
.
vis5d_make_vslice data_context time var urgent
vis5d_set_chslice data_context var level
Note that this function does not actually compute the slice.
vis5d_get_chslice data_context var
vis5d_set_chslice
.
vis5d_make_chslice data_context time var urgent
vis5d_set_cvslice data_context var r0 c0 r1 c1
Note that this function does not actually compute the slice.
vis5d_get_cvslice data_context var
vis5d_set_cvslice
.
vis5d_make_cvslice data_context time var urgent
vis5d_set_hwindslice display_context slicenum density scale level
Note that this function does not actually compute the slice.
vis5d_get_hwindslice display_context slicenum
vis5d_set_hwindslice
.
vis5d_make_hwindslice display_context dtx_time slice urgent
vis5d_set_vwindslice display_context slicenum density scale r0 c0 r1 c1
Note that this function does not actually compute the slice.
vis5d_get_vwindslice display_context slicenum
vis5d_set_vwindslice
.
vis5d_make_vwindslice display_context dtx_time slice urgent
vis5d_set_hstreamslice display_context slicenum density level
Note that this function does not actually compute the slice.
vis5d_get_hstreamslice display_context slicenum
vis5d_set_hstreamslice
.
vis5d_make_hstreamslice display_context dtx_time slice urgent
vis5d_set_vstreamslice display_context slicenum density r0 c0 r1 c1
Note that this function does not actually compute the slice.
vis5d_get_vstreamslice display_context slicenum
vis5d_set_vstreamslice
.
vis5d_make_vstreamslice display_context dtx_time slice urgent
vis5d_print_traj display_context traj_num
vis5d_make_traj display_context row column level dtx_time trajset
vis5d_set_traj display_context step length ribbonflag
vis5d_get_traj display_context
vis5d_set_traj
vis5d_delete_last_traj display_context
vis5d_delete_traj_set display_context set
vis5d_set_trajectory_color_var_and_owner display_context set varctx var
vis5d_make_timestep_graphics display_context timestep
vis5d_free_graphics data_context
Text Label Commands
vis5d_make_label display_context x y text
vis5d_delete_label display_context x y
Cursor Commands
vis5d_get_cursor display_context
vis5d_set_cursor display_context x y z
3-D Window Commands
vis5d_get_image_formats
vis5d_save_window filename format
vis5d_save_snd_window display_context filname format
vis5d_print_window
vis5d_print_snd_window display_context
vis5d_resize_BIG_window width height
vis5d_resize_3d_window display_context width height
vis5d_moveresize_BIG_window xpos ypos width height
vis5d_moveresize_3d_window display_context xpos ypos width height
Coordinate Conversion Commands
A $ctx may have a different graphics and/or grid coordinate system than
the $dtx it is attached to. In the following functions a PRIME will
indicate that the coordinate system is defined by the $dtx. If the PRIME
is omitted then the coordinate system is defined by the $ctx.
vis5d_xyz_to_grid data_context time var {x y z}
vis5d_xyzPRIME_to_gridPRIME display_context time var {x y z}
vis5d_grid_to_xyz data_context time var {row col lev}
vis5d_gridPRIME_to_xyzPRIME display_context time var {row col lev}
vis5d_xyz_to_geo data_context time var {x y z}
vis5d_xyzPRIME_to_geo display_context time var {x y z}
vis5d_geo_to_xyz data_context time var {lat lon hgt}
vis5d_geo_to_xyzPRIME display_context time var {lat lon hgt}
vis5d_grid_to_geo data_context time var {row col lev}
vis5d_gridPRIME_to_geo display_context time var {row col lev}
vis5d_rowcol_to_latlon data_context time var {row col}
vis5d_rowcolPRIME_to_latlon display_context time var {row col}
vis5d_latlon_to_rowcol data_context time var {lat lon}
vis5d_latlon_to_rowcolPRIME display_context time var {lat lon}
vis5d_geo_to_grid data_context time var {lat lon hgt}>/CODE>
vis5d_geo_to_gridPRIME display_context time var {lat lon hgt}>/CODE>
Commands Useful with -pipe command line option
vis5d_locate_dtx window x_location y_location
vis5d_name_ctx ContextName
vis5d_iconify display_context
vis5d_deiconify display_context
vis5d_set_name_value name value
vis5d_get_name_value name
Miscellaneous Commands
vis5d_save display_context filename
source filename
vis5d_sleep time
9. Example scripts
This section contains a number of example scripts. The
Tcl package must be installed to execute them.
Example 1: Save a time series of GIF images
If only one v5dfile is loaded this script will generate a GIF image file for each timestep in your
dataset. Near the top is the basename
variable which is
used to name the GIF files. You may want to change it.
# movie.tcl
# A Vis5d Tcl script for saving a whole time series of images
# You may need to change these:
set base "frame"
set ext ".gif"
set format VIS5D_GIF
set numtimes [ vis5d_get_dtx_numtimes $ctx ]
for {set time 1} {$time<=$numtimes} {set time [expr $time+1]} {
vis5d_set_dtx_timestep $ctx [expr $time-1]
vis5d_draw_frame $ctx
set name $base$time$ext
vis5d_save_window $name $format
}
# At this point you may want to invoke a Unix utility to convert a
# series of GIF files into an MPEG animation file.....
Example 2: Save a time series of GIF images with two v5d files
The following example includes two v5d files and each data set is attached
to one display. In order to animate both data sets correctly they have
been grouped. The result is similar to example 1.
# movie2.tcl
# A Vis5d Tcl script for saving a whole time series of images
# with multiple data sets.
# You may need to change these:
set base "frame"
set ext ".gif"
set format VIS5D_GIF
set ctx0 0
set ctx1 1
set dtx0 0
set dtx1 1
set grp 1
vis5d_set_display_group 0 1
vis5d_set_display_group 1 1
set numtimes [ vis5d_get_grp_numtimes $grp ]
for {set time 1} {$time<=$numtimes} {set time [expr $time+1]} {
vis5d_set_grp_timestep $grp [expr $time-1]
vis5d_draw_frame $dtx0
vis5d_draw_frame $dtx1
set name $base$time$ext
vis5d_save_window $name $format
}
Example 3: Generate a column of wind trajectories
This script generates a column of trajectories, one for each grid level,
at the cursor's current latitude/longitude.
# trajcol.tcl
# Generate a column of trajectories at the cursor's lat/lon
# for the current timestep.
# Which trajectory set should the trajectories be put in:
set trajset 0
# This is a bit tricky: we need to know how many grid levels are
# present for trajectory tracing. We query the variables used for
# trajectory tracing and then call vis5d_get_ctx_grid_levels to find out
# how many grid levels are present for the U rajectory component.
# Note: element 14 of the wind_vars list is the traj U variable.
set wind_vars [ vis5d_get_wind_vars $ctx ]
set traj_uvar [ lindex $wind_vars 14 ]
set traj_levs [ vis5d_get_ctx_grid_levels $ctx $traj_uvar ]
# Get current timestep
set curtime [ vis5d_get_dtx_timestep $ctx ]
# Get the current cursor position as (row,col).
set cursor_xyz [ vis5d_get_cursor $ctx ]
set cursor_rcl [ vis5d_xyz_to_grid $ctx $curtime $traj_uvar $cursor_xyz ]
set row [ lindex $cursor_rcl 0 ]
set col [ lindex $cursor_rcl 1 ]
# Loop over grid levels making a trajectory for each level.
for {set lev 0} {$lev < $traj_levs} {set lev [expr $lev+1]} {
vis5d_make_traj $ctx $row $col $lev $curtime $trajset
}
Example 3: Genenerate a column of wind trajectories for two data sets in one display
This script is the same as the above except there are two data sets sharing the same
display( two $ctxs attached to the same $dtx ). The second set of trajectories is
also colored yellow instead of white.
# trajcol.tcl
# Generate a column of trajectories at the cursor's lat/lon
# for the current timestep for both data sets which are in the
# same display.
# Which trajectory set should the trajectories be put in:
set trajset 0
set dtx 0
set ctx0 0
set ctx1 1
#set the wind vars for the first data set ctx0, assuming there number
#0 1 and 2 for U V and W.
vis5d_set_wind_vars $dtx -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 1 0 2
# use the levels of the display grid (not data grid), so it's not
# dependent on the variable.
set traj_levs [ vis5d_get_dtx_grid_levels $dtx ]
# Get current timestep
set curtime [ vis5d_get_dtx_timestep $dtx ]
# Get the current cursor position in display grid coordinates
# (not data grid coordinates) as (row,col).
set cursor_xyz [ vis5d_get_cursor $dtx ]
set cursor_rcl [ vis5d_xyzPRIME_to_gridPRIME $dtx $curtime 0 $cursor_xyz ]
set row [ lindex $cursor_rcl 0 ]
set col [ lindex $cursor_rcl 1 ]
# Loop over grid levels making a trajectory for each level.
for {set lev 0} {$lev < $traj_levs} {set lev [expr $lev+1]} {
vis5d_make_traj $dtx $row $col $lev $curtime $trajset
puts "calculating trajset0 for ctx0 at level $lev"
}
#now set the wind vars for the second data set and repeat the above logic.
vis5d_set_wind_vars $dtx -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 0 1 1 1 2
set trajset 1
for {set lev 0} {$lev < $traj_levs} {set lev [expr $lev+1]} {
vis5d_make_traj $dtx $row $col $lev $curtime $trajset
puts "calculating trajset1 for ctx1 at level $lev"
}
Example 4: Display a horizontal contour slice of W
# wslice.tcl
# Display a horizontal contour line slice of W (vertical wind) at the
# middle altitude using dashed lines for negative values. Draw the
# slice in yellow.
# You can change these:
set wvar "W"
set interval -0.05
# The color specified in RGBA:
set red 1.0
set green 1.0
set blue 0.0
set alpha 1.0
# Get min and max W values
set minmax [ vis5d_get_var_range $ctx $wvar ]
set low_val [ lindex $minmax 0 ]
set high_val [ lindex $minmax 1 ]
# Compute location of middle grid level
set num_levels [ vis5d_get_ctx_grid_levels $ctx $wvar ]
set level [ expr $num_levels / 2.0 ]
# set the color
vis5d_set_color $ctx VIS5D_HSLICE $ctx $wvar $red $green $blue $alpha
# setup slice parameters
vis5d_set_hslice $ctx $wvar $interval $low_val $high_val $level
# compute the slice
vis5d_make_hslice $ctx VIS5D_ALL_TIMES $wvar 0
# display it!
vis5d_enable_graphics $ctx VIS5D_HSLICE $wvar VIS5D_ON
Example 5: Spin and zoom the 3-D box
# spin.tcl
# Spin and zoom the 3-D box
# spin
for {set angle 0} {$angle <= 360} {set angle [expr $angle + 10]} {
vis5d_set_view $ctx -60.0 0.0 $angle 1.0 0.0 0.0 0.0
vis5d_draw_frame $ctx
vis5d_sleep 100
}
# zoom in
for {set scale 1.0} {$scale <= 1.8} {set scale [expr $scale + 0.1]} {
vis5d_set_view $ctx -60.0 0.0 0.0 $scale 0.0 0.0 0.0
vis5d_draw_frame $ctx
vis5d_sleep 100
}
# zoom out
for {set scale 1.8} {$scale >= 1.0} {set scale [expr $scale - 0.1]} {
vis5d_set_view $ctx -60.0 0.0 0.0 $scale 0.0 0.0 0.0
vis5d_draw_frame $ctx
vis5d_sleep 100
}
Example 6: Invoking scripts from cron via shell scripts
You can invoke a Vis5D script from cron via a shell script like this (note
that Vis5D needs an open display):
#!/bin/csh
setenv DISPLAY your_x_display.your_department.your_university.edu:0
vis5d your_file.v5d -script your_script.tcl ...
Other links:
Vis5D,
API document,
Scripting document,
Bill Hibbard,