[vtkusers] re: user update of rendering with Modified()
Matthew Pastizzo
mp1984 at csc.albany.edu
Thu Apr 26 15:52:09 EDT 2001
Hi all,
Here is some code to render x-y-z data. User has the option of
changing the values of $xAxisVar, $yAxisVar, and $zAxisVar
through comboboxes for each axis.
Does anyone know code that will automatically update the
SetPointComponent of x,y,z? Someone mentioned using
sending a Modified() command, but I'm not sure how to
implement.
Thanks, Matt
set size 78;#maximum number possible (1 less than actual number)
set xAxis $xAxisVar;#red axis
set yAxis $yAxisVar;#yellow axis
set zAxis $zAxisVar;#green axis
set scalar1 $scalar1Var;#blue
set scalar2 $scalar2Var;#red
set scalar3 $scalar3Var;#yellow
# extract data from field as a polydata (just points), then extract scalars
vtkDataObjectReader fdr
fdr SetFileName "$VTK_DATA/concrete.vtk"
vtkDataObjectToDataSetFilter do2ds
do2ds SetInput [fdr GetOutput]
do2ds SetDataSetTypeToPolyData
#format: component#, arrayname, arraycomp, minArrayId, maxArrayId, normalize
do2ds DefaultNormalizeOn
do2ds SetPointComponent 0 $xAxis 0
do2ds SetPointComponent 1 $yAxis 0
do2ds SetPointComponent 2 $zAxis 0
do2ds Update
vtkFieldDataToAttributeDataFilter fd2ad1
fd2ad1 SetInput [do2ds GetOutput]
fd2ad1 SetInputFieldToDataObjectField
fd2ad1 SetOutputAttributeDataToPointData
fd2ad1 DefaultNormalizeOn
fd2ad1 SetScalarComponent 0 $scalar1 0
vtkFieldDataToAttributeDataFilter fd2ad2
fd2ad2 SetInput [do2ds GetOutput]
fd2ad2 SetInputFieldToDataObjectField
fd2ad2 SetOutputAttributeDataToPointData
fd2ad2 DefaultNormalizeOn
fd2ad2 SetScalarComponent 0 $scalar2 0
vtkFieldDataToAttributeDataFilter fd2ad3
fd2ad3 SetInput [do2ds GetOutput]
fd2ad3 SetInputFieldToDataObjectField
fd2ad3 SetOutputAttributeDataToPointData
fd2ad3 DefaultNormalizeOn
fd2ad3 SetScalarComponent 0 $scalar3 0
# construct pipeline for original population
vtkGaussianSplatter popSplatter
popSplatter SetInput [fd2ad1 GetOutput]
popSplatter SetSampleDimensions 50 50 50
popSplatter SetRadius .05
popSplatter ScalarWarpingOff
vtkContourFilter popSurface
popSurface SetInput [popSplatter GetOutput]
popSurface SetValue 0 .01
vtkPolyDataMapper popMapper
popMapper SetInput [popSurface GetOutput]
popMapper ScalarVisibilityOff
vtkActor popActor
popActor SetMapper popMapper
[popActor GetProperty] SetOpacity .1
[popActor GetProperty] SetColor .95 .95 .95
vtkRenderer ren1
$renWin1 AddRenderer ren1
# Add the actors to the renderer, set the background and size
#
ren1 AddActor axesActor
ren1 AddActor popActor
ren1 AddActor scalar1Actor
ren1 AddActor scalar2Actor
ren1 AddActor scalar3Actor
ren1 AddActor XActor
ren1 AddActor YActor
ren1 AddActor ZActor
ren1 SetBackground 1 1 1
ren1 SetActiveCamera camera
XActor SetCamera camera
YActor SetCamera camera
ZActor SetCamera camera
More information about the vtkusers
mailing list