[vtkusers] vtkTextActor (Was vtkFollower/vtkVectorText and SetScale Problem...)
Andrea Gavana
andrea.gavana at polymtl.ca
Thu Jul 15 05:00:34 EDT 2004
Hello NG,
thanks for all the suggestions regarding vtkVectorText and vtkTextActor.
I think I found the problem on the code, but I don't know the solution. I post
here a simple Python code that reproduce the problem, together with a small VTK
file (needed for the position of my wells in my 3D grid). If someone of you
would like to run the code and tell me what is wrong, that could help me A LOT.
I'm crashing my head on a wall.
What the Python code does, is as follows:
1) Create a Tube Actor (to represent the wells, here called "profileactor"), it
reads the coordinates from the file "mywells.vtk" attached here.
2) Create a vtkTextActor with the name of the first well in the grid.
If you use profileactor.SetScale(1.0,1.0,1.0), the position of the vtkTextActor
is correct. Once you change it (try profileactor.SetScale(1.0,1.0,6.0), you
loose the correct text position. Notice that the text is gone UP, far above the
well position.
I attach the vtk file with the well's position.
Could anyone please tell me what I'm doing wrong?
Thank you a lot.
Andrea.
Selon Jeff Lee <jeff at cdnorthamerica.com>:
> did you try
> xactor.ScaledTextOn();
> xactor.SetMaximumLineHeight(some_number_between_0_and_1);
>
> you should never have to set the text scale again - it will adjust its
> size to stay a constant size.
> -J
>
> Andrea Gavana wrote:
>
> >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.
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >_______________________________________________
> >This is the private VTK discussion list.
> >Please keep messages on-topic. Check the FAQ at:
> <http://public.kitware.com/cgi-bin/vtkfaq>
> >Follow this link to subscribe/unsubscribe:
> >http://www.vtk.org/mailman/listinfo/vtkusers
> >
> >
> >
> >
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mywells.vtk
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040715/5b30a135/attachment.txt>
More information about the vtkusers
mailing list