$Application ExitOnReturnOn

set kw(vtkTemp1) [$Application GetMainWindow]
set kw(vtkTemp16) [$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(vtkTemp16) GetRenderModuleUI]
            catch {$rmui SetCompositeThreshold 0}
        }
    }
} 

set kw(vtkTemp224) [$kw(vtkTemp1) CreatePVSource ConeSource]
$kw(vtkTemp224) AcceptCallback
set kw(vtkTemp260) [$kw(vtkTemp1) CreatePVSource ElevationFilter]
set kw(vtkTemp999) [$kw(vtkTemp260) GetPVWidget {Line}]
$kw(vtkTemp999) SetPoint1 0 0 0
$kw(vtkTemp999) SetPoint2 0 0 1
$kw(vtkTemp260) AcceptCallback
set kw(vtkTemp294) [$kw(vtkTemp260) GetPVOutput]
set kw(vtkTemp336) [$kw(vtkTemp1) GetPVColorMap {Elevation} 1]
$kw(vtkTemp336) SetColorSchemeToBlueRed
$kw(vtkTemp336) SetColorSchemeToGrayscale
$kw(vtkTemp336) SetColorSchemeToRedBlue
$kw(vtkTemp336) SetScalarBarVisibility 1
$kw(vtkTemp294) DrawWireframe
$kw(vtkTemp294) SetPointSize 3
$kw(vtkTemp294) SetLineWidth 3
$kw(vtkTemp294) DrawPoints
$kw(vtkTemp294) DrawSurface
$kw(vtkTemp294) SetInterpolationToFlat
$kw(vtkTemp294) SetInterpolationToGouraud
$kw(vtkTemp294) ColorByProperty
$kw(vtkTemp294) ChangeActorColor 1.000000 0.070588 1.000000
$kw(vtkTemp294) ColorByPointField {Elevation} 1
$kw(vtkTemp294) SetColorRange 0.100000 0.433010
$kw(vtkTemp294) SetColorRange 0.200000 0.433010
$kw(vtkTemp294) SetColorRange 0.000000 0.433010
$kw(vtkTemp294) SetColorRange 0.300000 0.433010
$kw(vtkTemp336) SetColorSchemeToBlueRed
$kw(vtkTemp294) SetColorRange 0.300000 0.433010
$kw(vtkTemp336) SetColorSchemeToRedBlue
$kw(vtkTemp294) SetColorRange 0.300000 0.433010
$kw(vtkTemp294) SetColorRange 0.300000 0.433010
$kw(vtkTemp294) SetCubeAxesVisibility 1
$kw(vtkTemp294) SetScalarBarVisibility 1

set kw(vtkTemp300) [$kw(vtkTemp1) CreatePVSource Glyph]
$kw(vtkTemp294) SetColorRange 0.300000 0.433010
set kw(vtkTemp97) [$kw(vtkTemp1) GetPVSource GlyphSources Arrow0]
set kw(vtkTemp320) [$kw(vtkTemp300) GetPVWidget {Glyph}]
$kw(vtkTemp320) SetCurrentValue $kw(vtkTemp97)
set kw(vtkTemp309) [$kw(vtkTemp300) GetPVWidget {OrientScale}]
$kw(vtkTemp309) SetOrientMode Vector
$kw(vtkTemp309) SetScaleFactor 1
$kw(vtkTemp300) AcceptCallback


$kw(vtkTemp1) SetCurrentPVSourceCallback $kw(vtkTemp260)
$kw(vtkTemp1) SetCurrentPVSourceCallback $kw(vtkTemp300)
set kw(vtkTemp308) [$kw(vtkTemp300) GetPVWidget {OrientScale}]
$kw(vtkTemp308) SetScaleMode "Vector Magnitude"
$kw(vtkTemp300) AcceptCallback
$kw(vtkTemp308) SetScaleMode "Vector Components"
$kw(vtkTemp300) AcceptCallback
$kw(vtkTemp308) SetScaleMode "Data Scaling Off"
$kw(vtkTemp300) AcceptCallback
$kw(vtkTemp308) SetScaleMode "Scalar"
$kw(vtkTemp308) SetScaleFactor 1
$kw(vtkTemp300) AcceptCallback

set kw(vtkTemp339) [$kw(vtkTemp300) GetPVOutput]
$kw(vtkTemp336) SetColorSchemeToBlueRed
$kw(vtkTemp336) SetColorSchemeToRedBlue
$kw(vtkTemp1) ShowAnimationProperties
set kw(vtkTemp67) [$kw(vtkTemp1) GetAnimationInterface]
set kw(vtkTemp1032) [$kw(vtkTemp67) GetSourceEntry 0]
$kw(vtkTemp1032) SetPVSource $kw(vtkTemp300)
$kw(vtkTemp67) SetCurrentTime 0
update

# 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
