$Application ExitOnReturnOn

set pv(vtkTemp1) [$Application GetMainWindow]
set pv(vtkTemp43) [$pv(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 [$pv(vtkTemp43) GetRenderModuleUI]
            catch {$rmui SetCompositeThreshold 0}
        }
    }
} 
    
# Test the new feature of multiple cut values.

$pv(vtkTemp43) SetBackgroundColor 0 0 0
set pv(vtkTemp89) [$pv(vtkTemp1) GetPVSource GlyphSources Arrow0]
set pv(vtkTemp93) [$pv(vtkTemp1) GetPVSource GlyphSources Cone0]
set pv(vtkTemp97) [$pv(vtkTemp1) GetPVSource GlyphSources Sphere0]
set pv(vtkTemp98) [$pv(vtkTemp1) CreatePVSource SphereSource]
set pv(vtkTemp110) [$pv(vtkTemp98) GetPVWidget {Center}]
$pv(vtkTemp110) SetValue 0 0 4
$pv(vtkTemp98) AcceptCallback
set pv(vtkTemp182) [$pv(vtkTemp1) CreatePVSource Clip]
$pv(vtkTemp182) AcceptCallback

set pv(vtkTemp192) [$pv(vtkTemp182) GetPVWidget {Clip Function}]
set pv(vtkTemp191) [$pv(vtkTemp192) GetPVWidget {Plane}]
$pv(vtkTemp191) SetNormal 0.80121 0.53206 0.27383
$pv(vtkTemp182) AcceptCallback
$pv(vtkTemp191) SetCenter 0 0 4.5
$pv(vtkTemp182) AcceptCallback
set pv(vtkTemp213) [$pv(vtkTemp1) CreatePVSource Cut]
set pv(vtkTemp214) [$pv(vtkTemp213) GetPVWidget {Cut Function}]
set pv(vtkTemp222) [$pv(vtkTemp214) GetPVWidget {Plane}]
$pv(vtkTemp222) SetNormal -0.26920 0.86444 -0.42458
set pv(vtkTemp227) [$pv(vtkTemp213) GetPVWidget {Cut Values}]
$pv(vtkTemp227) RemoveAllValues
$pv(vtkTemp227) AddValue 0.000000
$pv(vtkTemp227) AddValue 0.100000
$pv(vtkTemp227) AddValue 0.200000
$pv(vtkTemp227) AddValue 0.300000
$pv(vtkTemp213) AcceptCallback
set pv(vtkTemp249) [$pv(vtkTemp1) CreatePVSource TubeFilter]
set pv(vtkTemp263) [$pv(vtkTemp249) GetPVWidget {NumberOfSides}]
$pv(vtkTemp263) SetValue 8
set pv(vtkTemp269) [$pv(vtkTemp249) GetPVWidget {Radius}]
$pv(vtkTemp269) SetValue 0.01
$pv(vtkTemp249) AcceptCallback
$pv(vtkTemp1) SetCurrentPVSource $pv(vtkTemp182)
$pv(vtkTemp1) ShowCurrentSourceProperties
$pv(vtkTemp191) SetNormal -0.80121 -0.53206 -0.27383
$pv(vtkTemp182) AcceptCallback
[$pv(vtkTemp182) GetPVOutput] DrawSurface
$pv(vtkTemp1) SetCurrentPVSource $pv(vtkTemp213)
$pv(vtkTemp1) ShowCurrentSourceProperties
$pv(vtkTemp1) SetCurrentPVSource $pv(vtkTemp249)
$pv(vtkTemp1) ShowCurrentSourceProperties
set pv(vtkTemp283) [$pv(vtkTemp1) CreatePVSource ElevationFilter]
set pv(vtkTemp297) [$pv(vtkTemp283) GetPVWidget {Line}]
$pv(vtkTemp297) SetPoint1 0 -1 0
$pv(vtkTemp297) SetPoint2 0 1 0
$pv(vtkTemp283) AcceptCallback

# 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





