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
|
package require vtk
package require vtkinteraction
# Create arc plots
# get the interactor ui
vtkCamera camera
# read the bore
vtkPolyDataReader bore
bore SetFileName "$VTK_DATA_ROOT/Data/bore.vtk"
vtkTubeFilter tuber
tuber SetInputConnection [bore GetOutputPort]
tuber SetNumberOfSides 6
tuber SetRadius 15
vtkPolyDataMapper mapBore
mapBore SetInputConnection [tuber GetOutputPort]
mapBore ScalarVisibilityOff
vtkActor boreActor
boreActor SetMapper mapBore
[boreActor GetProperty] SetColor 0 0 0
# create the arc plots
#
vtkPolyDataReader track1
track1 SetFileName "$VTK_DATA_ROOT/Data/track1.binary.vtk"
vtkArcPlotter ap
ap SetInputConnection [track1 GetOutputPort]
ap SetCamera camera
ap SetRadius 250.0
ap SetHeight 200.0
ap UseDefaultNormalOn
ap SetDefaultNormal 1 1 0
vtkPolyDataMapper mapArc
mapArc SetInputConnection [ap GetOutputPort]
vtkActor arcActor
arcActor SetMapper mapArc
[arcActor GetProperty] SetColor 0 1 0
vtkPolyDataReader track2
track2 SetFileName "$VTK_DATA_ROOT/Data/track2.binary.vtk"
vtkArcPlotter ap2
ap2 SetInputConnection [track2 GetOutputPort]
ap2 SetCamera camera
ap2 SetRadius 450.0
ap2 SetHeight 200.0
ap2 UseDefaultNormalOn
ap2 SetDefaultNormal 1 1 0
vtkPolyDataMapper mapArc2
mapArc2 SetInputConnection [ap2 GetOutputPort]
vtkActor arcActor2
arcActor2 SetMapper mapArc2
[arcActor2 GetProperty] SetColor 0 0 1
vtkPolyDataReader track3
track3 SetFileName "$VTK_DATA_ROOT/Data/track3.binary.vtk"
vtkArcPlotter ap3
ap3 SetInputConnection [track3 GetOutputPort]
ap3 SetCamera camera
ap3 SetRadius 250.0
ap3 SetHeight 50.0
ap3 SetDefaultNormal 1 1 0
vtkPolyDataMapper mapArc3
mapArc3 SetInputConnection [ap3 GetOutputPort]
vtkActor arcActor3
arcActor3 SetMapper mapArc3
[arcActor3 GetProperty] SetColor 1 0 1
# Create graphics objects
# Create the rendering window renderer and interactive renderer
vtkRenderer ren1
ren1 SetActiveCamera camera
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
# Add the actors to the renderer set the background and size
ren1 AddActor boreActor
ren1 AddActor arcActor
ren1 AddActor arcActor2
ren1 AddActor arcActor3
ren1 SetBackground 1 1 1
renWin SetSize 235 500
camera SetClippingRange 14144 32817
camera SetFocalPoint -1023 680 5812
camera SetPosition 15551 -2426 19820
camera SetViewUp -0.651889 -0.07576 0.754521
camera SetViewAngle 20
renWin Render
# render the image
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize
# prevent the tk window from showing up then start the event loop
wm withdraw .
|