$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] == "-UC" && $i < $argcm1} {
            set rmui [$kw(vtkTemp16) GetRenderModuleUI]
            catch {$rmui SetCompositeThreshold 0}
        }
    }
} 

$kw(vtkTemp16) SetBackgroundColor 0 0 0
set kw(vtkTemp213) [$kw(vtkTemp1) CreatePVSource RTAnalyticSource]
$kw(vtkTemp213) AcceptCallback
set kw(vtkTemp273) [$kw(vtkTemp1) CreatePVSource Probe]
[$kw(vtkTemp273) GetShowXYPlotToggle] SetState 1
set kw(vtkTemp341) [$kw(vtkTemp273) GetPVWidget {Probe object}]
$kw(vtkTemp341) SetCurrentValue {Line}
$kw(vtkTemp273) AcceptCallback
set kw(vtkTemp300) [$kw(vtkTemp273) GetPVOutput]
$kw(vtkTemp300) ColorByPointField {RTData} 1
$kw(vtkTemp300) ColorByPointField {RTData} 1
set kw(vtkTemp280) [$kw(vtkTemp341) GetPVWidget {Line}]
[ $kw(vtkTemp280) GetLineWidget ] SetVisibility 1
[ $kw(vtkTemp280) GetLineWidget ] SetPoint1 -10.00000 -10.00000 -10.00000
[ $kw(vtkTemp280) GetLineWidget ] SetPoint2 3.59489 6.26422 6.41830
[ $kw(vtkTemp280) GetLineWidget ] SetResolution 10
[$kw(vtkTemp273) GetShowXYPlotToggle] SetState 1
$kw(vtkTemp273) AcceptCallback
$kw(vtkTemp300) ColorByPointField {RTData} 1
$kw(vtkTemp300) ColorByPointField {RTData} 1
[$kw(vtkTemp273) GetShowXYPlotToggle] SetState 1
$kw(vtkTemp273) AcceptCallback
$kw(vtkTemp300) ColorByPointField {RTData} 1
$kw(vtkTemp300) ColorByPointField {RTData} 1
[ $kw(vtkTemp280) GetLineWidget ] SetPoint1 -10.00000 -10.00000 -10.00000
[ $kw(vtkTemp280) GetLineWidget ] SetPoint2 3.59489 6.26422 6.41830
[ $kw(vtkTemp280) GetLineWidget ] SetResolution 50
[$kw(vtkTemp273) GetShowXYPlotToggle] SetState 1
$kw(vtkTemp273) AcceptCallback
$kw(vtkTemp300) ColorByPointField {RTData} 1
$kw(vtkTemp300) ColorByPointField {RTData} 1
[ $kw(vtkTemp280) GetLineWidget ] SetVisibility 0
[$kw(vtkTemp273) GetShowXYPlotToggle] SetState 0
$kw(vtkTemp273) AcceptCallback
$kw(vtkTemp300) ColorByPointField {RTData} 1
[$kw(vtkTemp273) GetShowXYPlotToggle] SetState 1
$kw(vtkTemp273) AcceptCallback
$kw(vtkTemp300) ColorByPointField {RTData} 1
[$kw(vtkTemp273) GetShowXYPlotToggle] SetState 0
$kw(vtkTemp273) AcceptCallback
$kw(vtkTemp300) ColorByPointField {RTData} 1
set kw(vtkTemp314) [$kw(vtkTemp1) CreatePVSource TubeFilter]
$kw(vtkTemp314) AcceptCallback
set kw(vtkTemp319) [$kw(vtkTemp314) GetPVWidget {NumberOfSides}]
$kw(vtkTemp319) SetValue 6
$kw(vtkTemp314) 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
