File: cubeAxes2.tcl

package info (click to toggle)
paraview 4.0.1-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 526,572 kB
  • sloc: cpp: 2,284,430; ansic: 816,374; python: 239,936; xml: 70,162; tcl: 48,295; fortran: 39,116; yacc: 5,466; java: 3,518; perl: 3,107; lex: 1,620; sh: 1,555; makefile: 932; asm: 471; pascal: 228
file content (159 lines) | stat: -rw-r--r-- 4,919 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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
package require vtk
package require vtkinteraction

# read in an interesting object and outline it
#
vtkBYUReader fohe
    fohe SetGeometryFileName "$VTK_DATA_ROOT/Data/teapot.g"
vtkPolyDataNormals normals
    normals SetInputConnection [fohe GetOutputPort]
vtkPolyDataMapper foheMapper
    foheMapper SetInputConnection [normals GetOutputPort]
vtkLODActor foheActor
    foheActor SetMapper foheMapper

vtkOutlineFilter outline
    outline SetInputConnection [normals GetOutputPort]
vtkPolyDataMapper mapOutline
    mapOutline SetInputConnection [outline GetOutputPort]
vtkActor outlineActor
    outlineActor SetMapper mapOutline
    [outlineActor GetProperty] SetColor 0 0 0

# Create the RenderWindow, Renderer, and setup viewports
vtkCamera camera
    camera SetClippingRange 1.60187 20.0842
    camera SetFocalPoint 0.21406 1.5 0
    camera SetPosition 11.63 6.32 5.77
    camera SetViewUp 0.180325 0.549245 -0.815974
vtkLight light
    light SetFocalPoint 0.21406 1.5 0
    light SetPosition 8.3761 4.94858 4.12505

vtkRenderer ren1
    ren1 SetViewport 0 0 0.33 0.5
    ren1 SetActiveCamera camera
    ren1 AddLight light
vtkRenderer ren2
    ren2 SetViewport 0.33 0 0.66 0.5
    ren2 SetActiveCamera camera
    ren2 AddLight light
vtkRenderer ren3
    ren3 SetViewport 0.66 0 1.0 0.5
    ren3 SetActiveCamera camera
    ren3 AddLight light
vtkRenderer ren4
    ren4 SetViewport 0 0.5 0.5 1.0
    ren4 SetActiveCamera camera
    ren4 AddLight light
vtkRenderer ren5
    ren5 SetViewport 0.5 0.5 1.0 1.0
    ren5 SetActiveCamera camera
    ren5 AddLight light
vtkRenderWindow renWin
    renWin SetMultiSamples 0
    renWin AddRenderer ren1
    renWin AddRenderer ren2
    renWin AddRenderer ren3
    renWin AddRenderer ren4
    renWin AddRenderer ren5
    renWin SetWindowName "VTK - Cube Axes"
    renWin SetSize 600 600
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

# Add the actors to the renderer, set the background and size
#
ren1 AddViewProp foheActor
ren1 AddViewProp outlineActor
ren2 AddViewProp foheActor
if { [info command "rtExMath"] == ""} {
  ren2 AddViewProp outlineActor
}
ren3 AddViewProp foheActor
ren3 AddViewProp outlineActor
ren4 AddViewProp foheActor
ren4 AddViewProp outlineActor
ren5 AddViewProp foheActor

ren1 SetBackground 0.1 0.2 0.4
ren2 SetBackground 0.1 0.2 0.4
ren3 SetBackground 0.1 0.2 0.4
ren4 SetBackground 0.1 0.2 0.4
ren5 SetBackground 0.1 0.2 0.4

normals Update
set bounds [[normals GetOutput] GetBounds]

vtkCubeAxesActor axes
    axes SetBounds [lindex $bounds 0] [lindex $bounds 1] [lindex $bounds 2] \
      [lindex $bounds 3] [lindex $bounds 4] [lindex $bounds 5]
    axes SetCamera [ren1 GetActiveCamera]
    axes SetXLabelFormat "%6.1f"
    axes SetYLabelFormat "%6.1f"
    axes SetZLabelFormat "%6.1f"
    axes SetFlyModeToOuterEdges
ren1 AddViewProp axes

vtkCubeAxesActor axes2
    axes2 SetBounds [lindex $bounds 0] [lindex $bounds 1] [lindex $bounds 2] \
      [lindex $bounds 3] [lindex $bounds 4] [lindex $bounds 5]
    axes2 SetCamera [ren2 GetActiveCamera]
    axes2 SetXLabelFormat [axes GetXLabelFormat]
    axes2 SetYLabelFormat [axes GetYLabelFormat]
    axes2 SetZLabelFormat [axes GetZLabelFormat]
    axes2 SetFlyModeToClosestTriad
ren2 AddViewProp axes2

vtkCubeAxesActor axes3
    axes3 SetBounds [lindex $bounds 0] [lindex $bounds 1] [lindex $bounds 2] \
      [lindex $bounds 3] [lindex $bounds 4] [lindex $bounds 5]
    axes3 SetCamera [ren2 GetActiveCamera]
    axes3 SetXLabelFormat [axes GetXLabelFormat]
    axes3 SetYLabelFormat [axes GetYLabelFormat]
    axes3 SetZLabelFormat [axes GetZLabelFormat]
    axes3 SetFlyModeToFurthestTriad
ren3 AddViewProp axes3

set bounds2 [axes3 GetBounds]
vtkCubeAxesActor axes4
    axes4 SetBounds [lindex $bounds2 0] [lindex $bounds2 1] \
      [lindex $bounds2 2] [lindex $bounds2 3] [lindex $bounds2 4] \
      [lindex $bounds2 5]
    axes4 SetCamera [ren2 GetActiveCamera]
    axes4 SetXLabelFormat [axes GetXLabelFormat]
    axes4 SetYLabelFormat [axes GetYLabelFormat]
    axes4 SetZLabelFormat [axes GetZLabelFormat]
    axes4 SetFlyModeToStaticTriad
ren4 AddViewProp axes4

vtkCubeAxesActor axes5
    axes5 SetBounds [lindex $bounds2 0] [lindex $bounds2 1] \
      [lindex $bounds2 2] [lindex $bounds2 3] [lindex $bounds2 4] \
      [lindex $bounds2 5]
    axes5 SetCamera [ren2 GetActiveCamera]
    axes5 SetXLabelFormat [axes GetXLabelFormat]
    axes5 SetYLabelFormat [axes GetYLabelFormat]
    axes5 SetZLabelFormat [axes GetZLabelFormat]
    axes5 SetFlyModeToStaticEdges
ren5 AddViewProp axes5

renWin Render

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

iren Initialize

proc TkCheckAbort {} {
  set foo [renWin GetEventPending]
  if {$foo != 0} {renWin SetAbortRender 1}
}
renWin AddObserver "AbortCheckEvent" {TkCheckAbort}

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

# for testing
set threshold 13