$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}
        }
    }
} 


$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]

$pv(vtkTemp1) Open "$DataDir/Data/blow data.vtk"
set pv(vtkTemp100) [$pv(vtkTemp1) GetCurrentPVSource]

set pv(vtkTemp157) [$pv(vtkTemp1) CreatePVSource RotationalExtrusionFilter]
set pv(vtkTemp175) [$pv(vtkTemp157) GetPVWidget {Angle}]
$pv(vtkTemp175) SetValue 90
set pv(vtkTemp178) [$pv(vtkTemp157) GetPVWidget {Translation}]
$pv(vtkTemp178) SetValue 10
set pv(vtkTemp181) [$pv(vtkTemp157) GetPVWidget {DeltaRadius}]
$pv(vtkTemp181) SetValue 15
$pv(vtkTemp157) AcceptCallback

$pv(vtkTemp1) ResetCameraCallback

# 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
