Rendering a StructuredGrid as a solid?
drew at pixar.com
drew at pixar.com
Tue Jul 27 15:20:24 EDT 1999
I've been trying to do something simple but don't seem to be
having much luck. I want to display the surface of a StructuredGrid
as a solid (or even a wireframe). When I execute the code below
all I get is a 5x5x5 grid of points. Anyone have any idea what
I'm doing wrong?
Drew
drew at pixar.com
#!/usr/local/bin/vtk
catch {load vtktcl}
# create a window to render into
vtkRenderWindow renWin
vtkRenderer ren1
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
set n0 5
set n0m1 [expr $n0 - 1]
vtkFloatPoints points
for {set x 0} {$x < $n0} {incr x} {
for {set y 0} {$y < $n0} {incr y} {
for {set z 0} {$z < $n0} {incr z} {
points InsertNextPoint [expr (1.0/$n0m1) * $x] \
[expr (1.0/$n0m1) * $y] \
[expr (1.0/$n0m1) * $z]
}
}
}
#
# The whole enchilada
vtkStructuredGrid grid
grid SetDimensions $n0 $n0 $n0
grid SetPoints points
vtkStructuredGridGeometryFilter wholeFilter
wholeFilter SetInput grid
vtkDataSetMapper wholeMapper
wholeMapper SetInput [wholeFilter GetOutput]
vtkActor theWhole
theWhole SetMapper wholeMapper
[theWhole GetProperty] SetRepresentationToSurface
ren1 AddActor theWhole
# Render an image; since no lights/cameras specified, created automatically
renWin Render;
# Begin mouse interaction
iren Start;
-----------------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>. For help, send message body containing
"info vtkusers" to the same address. Live long and prosper.
-----------------------------------------------------------------------------
More information about the vtkusers
mailing list