[vtkusers] vtkFollower and SetScale Problem...

Andrea Gavana andrea.gavana at polymtl.ca
Tue Jul 13 08:00:57 EDT 2004


Hello Paul,

      unfortunately, this does not help me a lot... I use a vtkFollower 
together with a vtkVectorText, that is a bit different wrt what you are doing 
(or at least it seems different to me). Now I am able to correctly give the 
position to the vtkFollower, but when I change the Scale of other actors (like 
a 3D surface, wireframe, polydata line and so on), the vtkVectorText goes up, 
far away from the original position, and there is no way to get it at the 
correct position. What I do is:

atext = vtkpython.vtkVectorText()
atext.SetText("MY WELL")
textMapper = vtkpython.vtkPolyDataMapper()
textMapper.SetInput(atext.GetOutput())
textActor = vtkpython.vtkFollower()
textActor.SetMapper(textMapper)

# 3D GRID EXTENSION
xmin, xmax, ymin, ymax, zmin, zmax = actsurface.GetBounds()

# HERE I SET THE VTKVECTORTEXT SCALE WRT THE 3D GRID EXTENSION
scale = max((xmax-xmin),(ymax-ymin),(zmax-zmin))/100.0

textActor.GetProperty().SetColor(1,1,1)
xmin, xmax, ymin, ymax, zmin, zmax = textActor.GetBounds()
xl = (xmax - xmin)/2.0
yl = (ymax - ymin)/2.0
zl = (zmax - zmin)/2.0

textActor.SetScale(scale,scale,scale)
textActor.SetPosition(self.wellt[0,0]-xl,self.wellt[0,1]-yl,(self.wellt[0,2]-
zl))

When I change the scale of the other actors, the vtkvectortext gets messed up, 
no matter what I do... I can change its scale, its position, nothing happens...
Does anyone have a suggestion? It starts to appear to me like a bug.

Thanks for your suggestions.

Andrea.

Selon Paul Tait <paul at opes.com.au>:

> I have an app displaying reservoir data too !!!
> 
> I use a vtkTextProprty with the vtkTextActor and set the font
> 
> TextActor = vtkTextActor::New();
> TextProperty = vtkTextProperty::New();
> TextProperty->SetFontFamilyToArial();
> TextProperty->SetFontSize(15);
> TextProperty->SetBold(1);
> TextProperty->ShadowOn();
> TextProperty->SetColor(1.0, 1.0, 1.0);
> TextActor->SetTextProperty(TextProperty);
> That pretty much handles getting the size right for me
> 
> Paul Tait
> 





More information about the vtkusers mailing list