[vtkusers] Glyph3D w/table doesn't transfer all attributes

Eric E. Monson emonson at cs.duke.edu
Fri Jan 29 10:49:10 EST 2010


Hey,

I'm trying to use vtkGlyph3D indexing into a table of glyphs. When I use this filter with a single glyph source (without indexing) it transfers all of the scalar attributes to the glyphs, but when I index into a table of glyphs my glyphed data only ends up with attributes "GlyphScale" (the indexing array) and "Normals" -- any other scalar arrays are dropped. (My real data has about 10 arrays associated with it and they all get dropped except for the indexing array.)

Does anyone know if this is the intended behavior? Is there some setting that I'm not aware of that would allow it to transfer the other attributes?

I'm attaching a python example which shows the effect. The points going into Glyph3D have both "ids" and "Elevation", but the "ids" get dropped and Elevation is copied into "GlyphScale".

Thanks for the help,
-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group

# =======================
import vtk

ps = vtk.vtkPointSource()
ps.SetRadius(1.0)
ps.SetNumberOfPoints(50)

id = vtk.vtkIdFilter()
id.PointIdsOn()
id.SetIdsArrayName('ids')
id.SetInputConnection(ps.GetOutputPort(0))

el = vtk.vtkElevationFilter()
el.SetLowPoint(-1,0,0)
el.SetHighPoint(1,0,0)
el.SetScalarRange(0,1)
el.SetInputConnection(id.GetOutputPort(0))
el.Update()

inpd = el.GetOutputDataObject(0).GetPointData()
inArNum = inpd.GetNumberOfArrays()
print 'Input point data arrays:'
for ii in range(inArNum):
	print inpd.GetArrayName(ii)
	
ss = vtk.vtkSphereSource()
ss.SetRadius(0.1)
cs = vtk.vtkCubeSource()
cs.SetXLength(0.2)
cs.SetYLength(0.2)
cs.SetZLength(0.2)

g = vtk.vtkGlyph3D()
g.SetScaleModeToDataScalingOff()
g.SetIndexModeToScalar()
g.SetSource(0,ss.GetOutput())
g.SetSource(1,cs.GetOutput())
g.SetInputConnection(el.GetOutputPort(0))
g.SetInputArrayToProcess(0,0,0,0,'Elevation')
g.SetRange(0,1)
g.Update()

outpd = g.GetOutputDataObject(0).GetPointData()
outArNum = outpd.GetNumberOfArrays()
print '\nOutput point data arrays:'
for ii in range(outArNum):
	print outpd.GetArrayName(ii)

mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(g.GetOutputPort())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
ren1 = vtk.vtkRenderer()
ren1.AddActor(actor)
ren1.SetBackground(0.1, 0.2, 0.4)
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
renWin.SetSize(300, 300)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
style = vtk.vtkInteractorStyleTrackballCamera()
iren.SetInteractorStyle(style)
renWin.GetInteractor().SetInteractorStyle(style)
iren.Initialize()
iren.Start()
# =======================




More information about the vtkusers mailing list