[vtkusers] Scalar Bar Widget Not Interactive
Brandt Westing
bmwesting at gmail.com
Mon Sep 29 13:30:00 EDT 2008
Using the code below I am able to interact with the dataset, and see the
scalar bar. I cannot interact with the scalar bar, however. Also, setting
the scalar bar to horizontal has no effect, as it still appears vertical. I
was curious if somebody could spot something I am doing wrong.
#! /usr/bin/python
# load VTK extensions
from vtk import *;
# create a rendering window and renderer
ren = vtkRenderer()
ren.SetBackground(1,1,1)
renWin = vtkRenderWindow()
renWin.SetSize(800,600)
renWin.AddRenderer(ren)
iren = vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
reader = vtkDataSetReader()
reader.SetFileName("bloodflow.vtk")
#create lookup table for testing
lut = vtkLookupTable()
lut.SetTableRange(0,5000)
lut.SetHueRange(0, 1)
lut.SetSaturationRange(1, 1)
lut.SetValueRange(1, 1.0)
lut.Build()
#isosurface of artery
iso=vtkContourFilter()
iso.SetInput(reader.GetOutput())
iso.SetValue(0, 100)
isoMapper=vtkPolyDataMapper()
isoMapper.SetInput(iso.GetOutput())
isoActor=vtkActor()
isoActor.SetMapper(isoMapper)
ren.AddActor(isoActor)
scalarBar=vtkScalarBarActor()
scalarBar.SetOrientationToHorizontal()
scalarBar.SetLookupTable(lut)
#use widget so the scalar bar can be moved
sbw=vtkScalarBarWidget()
sbw.SetInteractor(iren)
sbw.SetScalarBarActor(scalarBar)
# enable user interface interactor
iren.Initialize()
sbw.EnabledOn()
iren.Start()
Thanks,
Brandt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080929/9ebdcba4/attachment.htm>
More information about the vtkusers
mailing list