AIS_VIEWCUBE position

Hello , I am playing around AIS_VIEWCUBE code sample.
I have created a sample application and CubeView is displayed at left/Bottom screen.
I woul like display it at top/Right

I have used this code:
aisViewCube->SetTransformPersistence(
new Graphic3d_TransformPers(Graphic3d_TransformPers(Graphic3d_TMF_TriedronPers, Aspect_TOTP_RIGHT_UPPER , Graphic3d_Vec2i(100,100))));

But this function doesn't move the AIS_CUBEVIEW
Any suggestion?
Thanks in advance

Attachments: 
Kirill Gavrilov's picture

I guess the code should work, though I don't understand why it calls Graphic3d_TransformPers constructor twice. AIS_ViewCube::SetTransformPersistence() should be called before displaying the object (AIS_InteractiveContext::SetTransformPersistence() could be used afterwards).

Mauro Corbo's picture

ok,it works,sorry for delay.
A last question: I have not found a way to change the color (yellow) of "X","Y",Z"; I have a white backgroung, so the yellow is not readable.
Can show me a function to change text color?
Thanks in advance

Kirill Gavrilov's picture

X/Y/Z labels are drawn by Prs3d_Drawer::DatumAspect(), which defines per-axis text aspects Prs3d_DatumAspect::TextAspect(). The code might look like this:

Handle(AIS_ViewCube) theViewCube = ...;
const Handle(Prs3d_Drawer)& aDrawer = theViewCube->Attributes();
aDrawer->SetDatumAspect (new Prs3d_DatumAspect());
const Handle(Prs3d_DatumAspect)& aDatumAsp = aDrawer->DatumAspect();
aDatumAsp->TextAspect (Prs3d_DatumParts_XAxis)->SetColor (Quantity_NOC_RED);
aDatumAsp->TextAspect (Prs3d_DatumParts_YAxis)->SetColor (Quantity_NOC_GREEN);
aDatumAsp->TextAspect (Prs3d_DatumParts_ZAxis)->SetColor (Quantity_NOC_BLUE);
Mauro Corbo's picture

Many thanks