[vtkusers] vtkTextActor (Was vtkFollower/vtkVectorText and SetScale Problem...)

Andrea Gavana andrea.gavana at polymtl.ca
Wed Jul 14 08:50:46 EDT 2004


Hello NG,

      by following the Jeff's kind suggestion, I've switched from vtkVectorText 
to vtkTextActor, but my problem still remains... I can place the text in my 3D 
world in the position I want, UNTIL I don't change the scale of other VTK 
Actors. If I change the scale of my 3D grid as:

gridActor = vtkpython.vtkActor()
gridActor.SetScale(1.0,1.0,6.0)

I loose the 3D text position, the text goes up (really UP in the vertical 
direction), far away from its original position. I checked a little bit the doc 
regarding vtkTextActor, but it seems to me that there is no way to use SetScale 
on this actor.
So I am at the starting point, but I can not believe that the solution to this 
problem is so complex! It seems to me that it should be a very easy task, but 
probably either I am wrong and it is impossible to do in VTK (!!!!) or I am so 
inexperienced with VTK that I can not see a solution in front of my nose...

Does anyone have a solution/pointer to this?

Thank you for every suggestion.

Andrea.

Selon Jeff Lee <jeff at cdnorthamerica.com>:

> 
> 
> Andrea Gavana wrote:
> 
> >Selon Jeff Lee <jeff at cdnorthamerica.com>:
> >
> >  
> >
> >>Hi Andrea,
> >>Try vtkTextActor.  You can make it use scaled text (as a fraction of 
> >>viewport height) and position it in world coordinates(it will follow 
> >>that world coordinate, and always face the camera).  Have a look at the 
> >>vtk examples for vtkTextActor linked from the man pages.
> >>-Jeff
> >>    
> >>
> >
> >Hello Jeff,
> >
> >      Thanks for your interest on my question. I've taken a look to the 
> >examples provided for vtkTextActor (for Python, I only have TestText.py),
> but 
> >it seems to me that it can be used only to place text in a 2D world... and I
> 
> >have a 3D structured grid filled with scalars and many other Actors in my
> VTK 
> >window. Am I wrong? Can I use it also in a 3D world with 3D coordinates to 
> >positioning it?
> >  
> >
> yep, xactor.GetPositionCoordinate().SetCoordinateSystemToWorld() will do 
> the trick.  Then xactor.GetPositionCoordinate().SetValue(0.0, 0.0, 0.0) 
> will set the text position at 0,0,0.
> -J
> 
> >Sorry for the probably silly question...
> >
> >Andrea.
> >
> >
> >  
> >
> 






More information about the vtkusers mailing list