[vtkusers] How to display vectors on a warped UnstructuredGrid?

Gil gil at femplusplus.com
Mon Jul 18 10:03:02 EDT 2005


Hi All,

I need your help to display vector results on a deformed UnStructuredGrid - should be simple but...
I'm using  ...SetActiveVectors "vector"... which seems to be wrong because the displayed vector is the one used for the warp (DISPLACE). I searched the web but could not find an example of that kind.
(Using VTK 4.2+tcl/tk 8.3.2  on Windows/XP)

The data file can be found at:
ftp://ftp.netvision.net.il/home/f/fempp/contact_3d.io0_0002.vtk 

Thanks,
Gil 

Email: gil at femplusplus.com
---


########## the tcl file
package require vtk

# read UnStructured mesh + results (nodal vectors+scalars)
vtkUnstructuredGridReader reader
    reader SetFileName "contact_3d.io0_0002.vtk"
    reader SetScalarsName "s11"
    reader SetVectorsName "DISPLACE"
vtkWarpVector warp
    warp SetInput [reader GetOutput]

vtkGeometryFilter mat
    mat SetInput [warp GetOutput]
vtkPolyDataNormals normals1
    normals1 SetInput [mat GetOutput]
    normals1 SetFeatureAngle 60
vtkLookupTable lut
    lut SetHueRange 0.0 0.66667
vtkPolyDataMapper matMapper
    matMapper SetInput [normals1 GetOutput]
    matMapper SetLookupTable lut
    matMapper SetScalarRange 0.1 0.9
vtkActor matActor
    matActor SetMapper matMapper


# display the vector field REACTION

# the following is not working - reader stays with the DISPLACE vector
[[warp GetOutput] GetPointData] SetActiveVectors "REACTION"
warp Update  ;# this doesn't help

vtkVectorNorm norm0
 norm0 SetInput [warp GetOutput]
 norm0 NormalizeOff
 norm0 SetAttributeModeToUsePointData

vtkHedgeHog hhog0
 hhog0 SetInput [norm0 GetOutput]
vtkPolyDataMapper hogmapper0
 hogmapper0 SetInput [hhog0 GetOutput]
vtkActor hogActor0
 hogActor0 SetMapper hogmapper0
 [hogActor0 GetProperty] SetColor 0 0 1

norm0 NormalizeOff
hhog0 SetScaleFactor 10.0

# graphics
vtkRenderer ren1
vtkRenderWindow renWin
    renWin AddRenderer ren1
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

# Add the actors to the renderer, set the background and size
#
ren1 AddActor matActor
ren1 AddActor hogActor0

ren1 SetBackground 1 1 1
ren1 ResetCameraClippingRange
renWin SetSize 700 550
iren Initialize

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

########## end of tcl file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050718/d727e4b0/attachment.htm>


More information about the vtkusers mailing list