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 C'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 C's picture

Many thanks

Mauro C's picture

After doing some tests with the CubeView, I try to recall the Top view (or more generally any 2d view)
The 2d View is shown but the X and Y axes, as shown in the image, are positioned incorrectly (they have a conflicting sign: X points towards -x and Y points towards -y)
How can I automatically display the axes int the correct position?
Can I get some C ++ code snippets?
I suppose , it need a rotation of the view,but I don't know how
Many Thanks in advance.

Attachments: 
Kirill Gavrilov's picture

 Mauro Corbo wrote:

After doing some tests with the CubeView, I try to recall the Top view (or more generally any 2d view)
The 2d View is shown but the X and Y axes, as shown in the image, are positioned incorrectly (they have a conflicting sign: X points towards -x and Y points towards -y)

If you click on "Top" side second time it will rotate view to see "Top" label horizontally aligned, if this is what you are looking for.

Mauro C's picture

ok. thanks Krill, I have checked, it runs!