File: eleState.tcl

package info (click to toggle)
vtk7 7.1.1%2Bdfsg2-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 127,396 kB
  • sloc: cpp: 1,539,584; ansic: 124,382; python: 78,038; tcl: 47,013; xml: 8,142; yacc: 5,040; java: 4,439; perl: 3,132; lex: 1,926; sh: 1,500; makefile: 126; objc: 83
file content (65 lines) | stat: -rw-r--r-- 1,829 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package require vtk
package require vtkinteraction

# This example demonstrates the use of the linear extrusion filter and
# the USA state outline vtk dataset. It also tests the triangulation filter.

# get the interactor ui

# Create the RenderWindow, Renderer and both Actors
vtkRenderer ren1
vtkRenderWindow renWin
    renWin AddRenderer ren1
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

# create pipeline - read data
#
vtkPolyDataReader reader
    reader SetFileName "$VTK_DATA_ROOT/Data/usa.vtk"

# okay, now create some extrusion filters with actors for each US state
vtkMath math
for {set i 0} {$i < 51} {incr i} {
    vtkGeometryFilter extractCell$i
	extractCell$i SetInputConnection [reader GetOutputPort]
        extractCell$i CellClippingOn
        extractCell$i SetCellMinimum $i
        extractCell$i SetCellMaximum $i
    vtkTriangleFilter tf$i
	tf$i SetInputConnection [extractCell$i GetOutputPort]
    vtkLinearExtrusionFilter extrude$i
	extrude$i SetInputConnection [tf$i GetOutputPort]
	extrude$i SetExtrusionType 1
	extrude$i SetVector 0 0 1
	extrude$i CappingOn
	extrude$i SetScaleFactor [math Random 1 10]
    vtkPolyDataMapper mapper$i
	mapper$i SetInputConnection [extrude$i GetOutputPort]
    vtkActor actor$i
	actor$i SetMapper mapper$i
	[actor$i GetProperty] SetColor [math Random 0 1] \
		[math Random 0 1] [math Random 0 1]

    ren1 AddActor actor$i
}

ren1 SetBackground 1 1 1
renWin SetSize 500 250

set cam1 [ren1 GetActiveCamera]
$cam1 SetClippingRange 10.2299 511.497
$cam1 SetPosition -119.669 -25.5502 79.0198
$cam1 SetFocalPoint -115.96 41.6709 1.99546
$cam1 SetViewUp -0.0013035 0.753456 0.657497

# render the image
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
renWin Render


# prevent the tk window from showing up then start the event loop
wm withdraw .