[vtkusers] How to modify structured grid contour and isosurface Tcl examples for unstructured grids
Alaeddin A. Aydiner
aydiner at empc22.ece.uiuc.edu
Tue Feb 12 22:11:11 EST 2002
Thanks very much for the previous help.
I have the planar cuts done, though somewhat differently. I had to
translate the output of several cuts from several cutters with the
TransformPolyDataFilter and combine them into one by the AppendPolyData
filter to be mapped by a mapper.
Anyway, I still have problems with the isosurface filter. I now use
vtkContourGrid because it seems to be specialized for unstructured
grids. The code is below. The scalar values in question are in the range
[0.0-0.15]. The region defined by the reader data is [x,y]: [-3.5 -
3.5], and [z]: [-5.5 - 0.0] with a corresponding hexahedron
discretization of [x,y,z]: [15,15,21]. I specify all this, perhaps
somebody can spot something obviously wrong.
At least, could I be emailed some 3D contour (isosurface) script/code
with unstructured dataset input? Thanks.
################################################################################
catch {load vtktcl}
# Output image filename
set printname "probe.tiff"
# Input filename
set inputname "vetem.vtk"
# Color of the isosurface (bisque)
set color "1.0000 0.8941 0.7686"
vtkUnstructuredGridReader reader
reader SetFileName vetem.vtk
reader Update
vtkLookupTable sigmaTable
sigmaTable SetNumberOfColors 256
sigmaTable SetHueRange 0.0 0.867
sigmaTable Build
vtkAxes axes
axes SetOrigin 0 0 0
vtkPolyDataMapper axesMapper
axesMapper SetInput [axes GetOutput]
vtkActor axesActor
axesActor SetMapper axesMapper
vtkContourGrid iso
iso SetInput [reader GetOutput]
eval iso GenerateValues 10 [[reader GetOutput] GetScalarRange]
vtkProbeFilter probe
probe SetInput [iso GetOutput]
probe SetSource [reader GetOutput]
vtkCastToConcrete cast
cast SetInput [probe GetOutput]
vtkPolyDataNormals normals
normals SetInput [cast GetPolyDataOutput]
normals SetFeatureAngle 45
vtkPolyDataMapper isoMapper
isoMapper SetInput [normals GetOutput]
isoMapper ScalarVisibilityOn
isoMapper SetLookupTable sigmaTable
eval isoMapper SetScalarRange \
[[[[reader GetOutput] GetCellData] GetScalars] GetRange]
vtkScalarBarActor scalarBar
scalarBar SetLookupTable [isoMapper GetLookupTable]
scalarBar SetTitle "Conductivity"
[scalarBar GetPositionCoordinate] \
SetCoordinateSystemToNormalizedViewport
[scalarBar GetPositionCoordinate] SetValue 0.1 0.01
scalarBar SetOrientationToHorizontal
[scalarBar GetProperty] SetColor 0 0 0
scalarBar SetWidth 0.8
scalarBar SetHeight 0.17
vtkLODActor isoActor
isoActor SetMapper isoMapper
isoActor SetNumberOfCloudPoints 10000
eval [isoActor GetProperty] SetColor $color
vtkOutlineFilter outline
outline SetInput [reader GetOutput]
vtkPolyDataMapper outlineMapper
outlineMapper SetInput [outline GetOutput]
vtkActor outlineActor
outlineActor SetMapper outlineMapper
[outlineActor GetProperty] SetColor 0 0 0
vtkRenderer ren
ren AddActor outlineActor
ren AddActor axesActor
ren AddActor scalarBar
ren AddActor isoActor
ren SetBackground 1.0 1.0 1.0
vtkRenderWindow renWin
renWin AddRenderer ren
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
iren SetUserMethod {
vtkRenderLargeImage renderLarge
vtkTIFFWriter writer
renderLarge SetInput ren
renderLarge SetMagnification 1
writer SetFileName $printname
writer SetInput [renderLarge GetOutput]
writer Write
writer Delete
renderLarge Delete
}
iren Initialize
wm withdraw .
################################################################################
--
Alaeddin Ahmet Aydiner _ _ _
Office Tel: 217 333 0434 / \ / \ / \
377 CCEM Everitt Laboratory MC 702 /---\ /---\ /---\
Electrical & Computer Eng. Dept. UIUC 61801 / \ . / \ . / \ .
More information about the vtkusers
mailing list