Setting Text attributes

Hi,

I was having problem with displaying 2D text in a 3D window. I managed to overcome it by creating my own class AIS_3DText.Now, I can display the 2d text in a 3D window but I am not able to set its color,font and angle. How do I do that? I tried,

Prs3d_TextAspect* textAspect = new Prs3d_TextAspect();
textAspect->SetAngle(angle);
textAspect->SetColor(aColor);
textAspect->SetFont(font);

Handle(AIS_3DText) aGraphicText = new AIS_3DText(aText,tmpPnt); // My own class
m_AISContext->SetColor(aGraphicText,aColor,Standard_False);
m_AISContext->Display(aGraphicText);

It does not seem to work.Can anybody help me?

Thanks in advance,
~Amod

Stephane Routelous's picture

Hi Amod,

first : don't use raw pointers to OCC objects, but Handle ( Handle_Prs3d_TextAspect )

In your AIS_3DText, you have to deal with the Attributes ( AIS_Drawer )
aGraphicText->Attributes()->TextAspect()->SetColor(...);

HTH

shylesh's picture

hi
how do i change the direction of the text displayed .
I tried changing the Attributes of the Prs3d_TextAspect.I changed the textcolor and textangle .Then Set this textAspect to the defaultDrawer.The color changed but there was no other difference in the displayed text.
How do i change the direction. I want it to appear vertically and not horizontally.
Regards

Rajeshwari's picture

hi,
I want the text that is displayed in the 3d view to be tilted by some angle.
But i found that u can change the angle of 2d text but not of 3d text.M i write or is it possible to do so?
Thats why now i want to use the same 2d text that can be tilted in a 3d view .
pls tell me is it possible ??
And if so ,then can i change the angle of the displayed 2d text in 3d view.
Pls reply .
Regards
Rajeshwari