File: TestPolyDataPieces.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 (117 lines) | stat: -rw-r--r-- 2,613 bytes parent folder | download | duplicates (5)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package require vtk
package require vtkinteraction




vtkMath math
math RandomSeed 22

vtkSphereSource sphere
sphere SetPhiResolution 32
sphere SetThetaResolution 32

vtkExtractPolyDataPiece extract
extract SetInputConnection [sphere GetOutputPort]

vtkPolyDataNormals normals
normals SetInputConnection [extract GetOutputPort]

vtkPieceScalars ps
ps SetInputConnection [normals GetOutputPort]

vtkPolyDataMapper mapper
mapper SetInputConnection [ps GetOutputPort]
mapper SetNumberOfPieces 2

vtkActor actor
actor SetMapper mapper

vtkSphereSource sphere2
sphere2 SetPhiResolution 32
sphere2 SetThetaResolution 32

vtkExtractPolyDataPiece extract2
extract2 SetInputConnection [sphere2 GetOutputPort]

vtkDataSetAttributes attributes
vtkPolyDataMapper mapper2
mapper2 SetInputConnection [extract2 GetOutputPort]
mapper2 SetNumberOfPieces 2
mapper2 SetPiece 1
mapper2 SetScalarRange 0 4
mapper2 SetScalarModeToUseCellFieldData
mapper2 SetColorModeToMapScalars
mapper2 ColorByArrayComponent [attributes GhostArrayName] 0
mapper2 SetGhostLevel 4
# check the pipeline size
extract2 UpdateInformation
vtkPipelineSize psize
if {[psize GetEstimatedSize extract2 0 0] > 100} {
   puts stderr "ERROR: Pipeline Size increased"
}
if {[psize GetNumberOfSubPieces 10 mapper2] != 1} {
   puts stderr "ERROR: Number of sub pieces changed"
}


vtkActor actor2
actor2 SetMapper mapper2
actor2 SetPosition 1.5 0 0

vtkSphereSource sphere3
sphere3 SetPhiResolution 32
sphere3 SetThetaResolution 32

vtkExtractPolyDataPiece extract3
extract3 SetInputConnection [sphere3 GetOutputPort]

vtkPieceScalars ps3
ps3 SetInputConnection [extract3 GetOutputPort]

vtkPolyDataMapper mapper3
mapper3 SetInputConnection [ps3 GetOutputPort]
mapper3 SetNumberOfSubPieces 8
mapper3 SetScalarRange 0 8

vtkActor actor3
actor3 SetMapper mapper3
actor3 SetPosition 0 -1.5 0

vtkSphereSource sphere4
sphere4 SetPhiResolution 32
sphere4 SetThetaResolution 32

vtkExtractPolyDataPiece extract4
extract4 SetInputConnection [sphere4 GetOutputPort]

vtkPieceScalars ps4
ps4 RandomModeOn
ps4 SetScalarModeToCellData
ps4 SetInputConnection [extract4 GetOutputPort]

vtkPolyDataMapper mapper4
mapper4 SetInputConnection [ps4 GetOutputPort]
mapper4 SetNumberOfSubPieces 8
mapper4 SetScalarRange 0 8

vtkActor actor4
actor4 SetMapper mapper4
actor4 SetPosition 1.5 -1.5 0

vtkRenderer ren
ren AddActor actor
ren AddActor actor2
ren AddActor actor3
ren AddActor actor4

vtkRenderWindow renWin
renWin AddRenderer ren

vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
iren Initialize
iren AddObserver UserEvent {wm deiconify .vtkInteract}

wm withdraw .