$Application ExitOnReturnOn

set kw(vtkTemp1) [$Application GetMainWindow]
set kw(vtkTemp44) [$kw(vtkTemp1) GetMainView]

if {[info exists argc]} { 
    set argcm1 [expr $argc - 1]
    for {set i 0} {$i < $argcm1} {incr i} {
        if {[lindex $argv $i] == "-D" && $i < $argcm1} {
		set DataDir [lindex $argv [expr $i + 1]]
        }
        if {[lindex $argv $i] == "-UC" && $i < $argcm1} {
            set rmui [$kw(vtkTemp44) GetRenderModuleUI]
            catch {$rmui SetCompositeThreshold 0}
        }
    }
} 

$kw(vtkTemp44) SetBackgroundColor 0 0 0
set kw(vtkTemp92) [$kw(vtkTemp1) GetPVSource GlyphSources Arrow0]
set kw(vtkTemp96) [$kw(vtkTemp1) GetPVSource GlyphSources Cone0]
set kw(vtkTemp100) [$kw(vtkTemp1) GetPVSource GlyphSources Sphere0]
set kw(vtkTemp101) [$kw(vtkTemp1) CreatePVSource SphereSource]
set kw(vtkTemp111) [$kw(vtkTemp101) GetPVWidget {Center}]
$kw(vtkTemp111) SetValue 0 0 2
$kw(vtkTemp101) AcceptCallback
set kw(vtkTemp137) [$kw(vtkTemp101) GetPVOutput]
$kw(vtkTemp137) SetLineWidth 1
$kw(vtkTemp137) SetPointSize 1
$kw(vtkTemp137) ChangeActorColor 0.501961 1.000000 0.000000
$kw(vtkTemp1) Open "$DataDir/Data/vox8_bin.vtk"
set kw(vtkTemp171) [$kw(vtkTemp1) GetCurrentPVSource]
set kw(vtkTemp172) [$kw(vtkTemp171) GetPVOutput]
$kw(vtkTemp172) DrawPoints
$kw(vtkTemp172) DrawSurface
$kw(vtkTemp172) DrawWireframe
$kw(vtkTemp172) ColorByProperty
$kw(vtkTemp1) ResetCameraCallback
set kw(vtkTemp186) [$kw(vtkTemp1) CreatePVSource Contour]
set kw(vtkTemp193) [$kw(vtkTemp186) GetPVWidget {Scalars}]
$kw(vtkTemp193) SetValue scalars
set kw(vtkTemp196) [$kw(vtkTemp186) GetPVWidget {Contour Values}]
$kw(vtkTemp196) RemoveAllValues
$kw(vtkTemp196) AddValue 0.100000
$kw(vtkTemp196) AddValue 0.300000
$kw(vtkTemp196) AddValue 0.500000
$kw(vtkTemp196) AddValue 0.700000
$kw(vtkTemp196) AddValue 0.900000
set kw(vtkTemp202) [$kw(vtkTemp186) GetPVWidget {Compute Normals}]
$kw(vtkTemp202) SetState 0
$kw(vtkTemp186) AcceptCallback
set kw(vtkTemp214) [$kw(vtkTemp186) GetPVOutput]
$kw(vtkTemp214) SetLineWidth 1
$kw(vtkTemp214) SetPointSize 1
$kw(vtkTemp214) ColorByCellField scalars 1
set kw(vtkTemp220) [$kw(vtkTemp1) CreatePVSource CubeSource]
set kw(vtkTemp239) [$kw(vtkTemp220) GetPVWidget {Center}]
$kw(vtkTemp239) SetValue 0 2 2
$kw(vtkTemp220) AcceptCallback
set kw(vtkTemp245) [$kw(vtkTemp220) GetPVOutput]
$kw(vtkTemp245) SetLineWidth 1
$kw(vtkTemp245) SetPointSize 1
$kw(vtkTemp245) DrawWireframe
$kw(vtkTemp245) SetLineWidth 2
$kw(vtkTemp245) SetLineWidth 3
$kw(vtkTemp245) SetLineWidth 4
set kw(vtkTemp251) [$kw(vtkTemp1) CreatePVSource SphereSource]
set kw(vtkTemp261) [$kw(vtkTemp251) GetPVWidget {Center}]
$kw(vtkTemp261) SetValue 2 0 2
$kw(vtkTemp251) AcceptCallback
set kw(vtkTemp287) [$kw(vtkTemp251) GetPVOutput]
$kw(vtkTemp287) SetLineWidth 1
$kw(vtkTemp287) SetPointSize 1
$kw(vtkTemp287) SetInterpolationToGouraud
$kw(vtkTemp287) SetInterpolationToFlat
$kw(vtkTemp287) SetAmbient .2
$kw(vtkTemp287) AmbientChanged

[$kw(vtkTemp1) GetMainView] SetCameraState 4.145 5.676 5.818  0.124 -0.063 0.701  -0.232 0.733 -0.640

# Retrace
update
$Application StopRecordingScript
[ $Application GetMainWindow ] DeleteAllSources
# Source the trace to regenerate the sources.
if {[catch {set channel [open test.tmp w]}] == 0 } {
   close $channel
   file delete -force test.tmp
   source "[$Application GetTraceFileName]"
}

# Fix the size of the image.
set RenWin1 [[[$Application GetMainWindow] GetMainView] GetRenderWindow]
$RenWin1 SetSize 300 300
$RenWin1 Render
update

for {set i  1} {$i < [expr $argc - 1]} {incr i} {
    if {[lindex $argv $i] == "-C"} {
	source [lindex $argv [expr $i + 1]]
	$Application SetExitStatus [CompareImage [[$Application GetMainWindow] GetMainView]]
    }
}
   
$Application Exit




