problem with trihedron

Hello,
I want display two trihedron on my Context.one in the center of my context and the second in the corner(in the left low).
I used gp_Trsf aTrsf; aTrsf.SetTranslation(gp_Vec(10,15,-20));but I not found a good result. In addition I used setlocation but also I hadn't a result
In addition want to extend an axis without using the zoom but I don't found any result.
Regards

ATTIA's picture

here is the code
//Create and display a trihedron in the viewer
Handle(AIS_Trihedron) aTrihedron;
Handle(AIS_Trihedron) aTrihedron1;
// 1er trihedron
Handle(Geom_Axis2Placement) anAxis=new Geom_Axis2Placement(gp::XOY());
aTrihedron1=new AIS_Trihedron(anAxis);
myAISContext->Display(aTrihedron1);
///2 trihedron)
Handle(Geom_Axis2Placement) anAxis2=new Geom_Axis2Placement(gp::XOY());
aTrihedron=new AIS_Trihedron(anAxis2);
aTrsf.SetTranslation(gp_Vec(10,15,-20));
aTrihedron->SetLocation(aTrsf);
myAISContext->Display(aTrihedron);

ATTIA's picture

I found how I can change the size of a graduation using setSize () but I have not figured out how I can display two graduations in which the second is at the bottom left.
does it have someone who can help me

JuryS's picture

Hi! You must for the top left position:

myView->ZBufferTriedronSetup (Quantity_NOC_RED, Quantity_NOC_GREEN, Quantity_NOC_BLUE1, 0.2, 0.05,12);
myView->TriedronDisplay( Aspect_TOTP_CENTER, Quantity_NOC_GRAY30, 0.2, V3d_ZBUFFER);

And here the default Acpect values:

Aspect_TOTP_CENTER,
Aspect_TOTP_LEFT_LOWER,
Aspect_TOTP_LEFT_UPPER,
Aspect_TOTP_RIGHT_LOWER,
Aspect_TOTP_RIGHT_UPPER,
Aspect_TOTP_01,
Aspect_TOTP_02,
Aspect_TOTP_03,
Aspect_TOTP_04,
Aspect_TOTP_05,
Aspect_TOTP_06,
Aspect_TOTP_07,
Aspect_TOTP_08,
Aspect_TOTP_09,
Aspect_TOTP_10

ATTIA's picture

Thank you juryS,
I use this method(myView->TriedronDisplay) but the Triedrondoes not display.
I use myAISContext for displaying

JuryS's picture

For me I make my Triedron with 3 Edges and 3 Cone. I'm know that It's no good idea, but I can't work with default OCC triedron.
I'm programming with QT and I want to make triedron with QT GL widget.

Attachments: 
ATTIA's picture

I want to use myview for displaying a trihedron.
below the code I used:

const Handle(V3d_View) myView=myAISContext->CurrentViewer()->CreateView();
myView->ZBufferTriedronSetup (Quantity_NOC_RED, Quantity_NOC_GREEN, Quantity_NOC_BLUE1, 0.2, 0.05,12);
myView->TriedronDisplay( Aspect_TOTP_CENTER, Quantity_NOC_GRAY30, 0.2, V3d_ZBUFFER);
using this code nothing appears
I would display the trihedron

JuryS's picture

It's very strange. What are system you are use? There any problem with your V3dViewer. Maybe your code is wrong???

Try to add this 2 lines in default sample and then you are see that it's can work. After you can find wich a problem with your viewer.
Else take your E-mail I show you my code.

ATTIA's picture

Thank you very much JuryS for your help.
My problem is when I run this lines but no view display.
My OS is Windows XP SP2. And I use VC++ 2008.
My E-mail is mounaattia.info@gmail.com
Regards

ATTIA's picture

when I compile or when I run, no error appears but also the view doesn't display.

JuryS's picture

Hi! In my project I'm use two functions for displaying Triedron:

void tempView::ShowMyTriedron(const double myScale)
{
double mySize = 100 * 1/myScale;
double myDiam = 6 * 1/myScale;
double myCylLength = mySize - mySize/5;
double myLineWidth = myDiam/3;

BRepBuilderAPI_MakeEdge myCoordXcyl(gp_Pnt(0,0,0),gp_Pnt(myCylLength,0,0));

gp_Pnt myCoordXConeA(myCylLength,0,0);
gp_Pnt myCoordXConeB(mySize,0,0);
gp_Vec myCoordXConevec(myCoordXConeA, myCoordXConeB);
gp_Dir myCoordXConedir(myCoordXConevec);
gp_Ax2 myCoordXConeax2( myCoordXConeA, myCoordXConedir );

BRepPrimAPI_MakeCone myCoordXcone(myCoordXConeax2, myDiam, 0, mySize-myCylLength);

BRepBuilderAPI_MakeEdge myCoordYcyl(gp_Pnt(0,0,0),gp_Pnt(0,myCylLength,0));

gp_Pnt myCoordYConeA(0,myCylLength,0);
gp_Pnt myCoordYConeB(0,mySize,0);
gp_Vec myCoordYConevec(myCoordYConeA, myCoordYConeB);
gp_Dir myCoordYConedir(myCoordYConevec);
gp_Ax2 myCoordYConeax2( myCoordYConeA, myCoordYConedir );

BRepPrimAPI_MakeCone myCoordYcone(myCoordYConeax2, myDiam, 0, mySize-myCylLength);

BRepBuilderAPI_MakeEdge myCoordZcyl(gp_Pnt(0,0,0),gp_Pnt(0,0,myCylLength));

gp_Pnt myCoordZConeA(0,0,myCylLength);
gp_Pnt myCoordZConeB(0,0,mySize);
gp_Vec myCoordZConevec(myCoordZConeA, myCoordZConeB);
gp_Dir myCoordZConedir(myCoordZConevec);
gp_Ax2 myCoordZConeax2( myCoordZConeA, myCoordZConedir );

BRepPrimAPI_MakeCone myCoordZcone(myCoordZConeax2, myDiam, 0, mySize-myCylLength);

if (hasTriedron)
{
myCoordX->Set(myCoordXcyl.Shape());
myContext->Redisplay(myCoordX,0);

myCoordXCone->Set(myCoordXcone.Shape());
myContext->Redisplay(myCoordXCone,0);

myCoordY->Set(myCoordYcyl.Shape());
myContext->Redisplay(myCoordY,0);

myCoordYCone->Set(myCoordYcone.Shape());
myContext->Redisplay(myCoordYCone,0);

myCoordZ->Set(myCoordZcyl.Shape());
myContext->Redisplay(myCoordZ,0);

myCoordZCone->Set(myCoordZcone.Shape());
myContext->Redisplay(myCoordZCone,0);
}
else
{
myCoordX = new AIS_Shape(myCoordXcyl.Shape());
myContext->SetWidth(myCoordX,myLineWidth,Standard_False);
myContext->SetColor(myCoordX,Quantity_NOC_RED,Standard_False);
myContext->SetMaterial(myCoordX,Graphic3d_NOM_PLASTIC,Standard_False);

myCoordXCone = new AIS_Shape(myCoordXcone.Shape());
myContext->SetColor(myCoordXCone,Quantity_NOC_RED,Standard_False);
myContext->SetMaterial(myCoordXCone,Graphic3d_NOM_PLASTIC,Standard_False);

myCoordY = new AIS_Shape(myCoordYcyl.Shape());
myContext->SetWidth(myCoordY,myLineWidth,Standard_False);
myContext->SetColor(myCoordY,Quantity_NOC_GREEN,Standard_False);
myContext->SetMaterial(myCoordY,Graphic3d_NOM_PLASTIC,Standard_False);

myCoordYCone = new AIS_Shape(myCoordYcone.Shape());
myContext->SetColor(myCoordYCone,Quantity_NOC_GREEN,Standard_False);
myContext->SetMaterial(myCoordYCone,Graphic3d_NOM_PLASTIC,Standard_False);

myCoordZ = new AIS_Shape(myCoordZcyl.Shape());
myContext->SetWidth(myCoordZ,myLineWidth,Standard_False);
myContext->SetColor(myCoordZ,Quantity_NOC_BLUE1,Standard_False);
myContext->SetMaterial(myCoordZ,Graphic3d_NOM_PLASTIC,Standard_False);

myCoordZCone = new AIS_Shape(myCoordZcone.Shape());
myContext->SetColor(myCoordZCone,Quantity_NOC_BLUE1,Standard_False);
myContext->SetMaterial(myCoordZCone,Graphic3d_NOM_PLASTIC,Standard_False);

hasTriedron = true;
}
myContext->Display(myCoordX,1,-1,Standard_True,Standard_False);
myContext->Display(myCoordXCone,1,-1,Standard_True,Standard_False);
myContext->Display(myCoordY,1,-1,Standard_True,Standard_False);
myContext->Display(myCoordYCone,1,-1,Standard_True,Standard_False);
myContext->Display(myCoordZ,1,-1,Standard_True,Standard_False);
myContext->Display(myCoordZCone,1,-1,Standard_True,Standard_False);
}

void tempView::HideMyTriedron()
{
myContext->Clear(myCoordX,Standard_False);
myContext->Clear(myCoordXCone,Standard_False);
myContext->Clear(myCoordY,Standard_False);
myContext->Clear(myCoordYCone,Standard_False);
myContext->Clear(myCoordZ,Standard_False);
myContext->Clear(myCoordZCone,Standard_False);
}

where the scale = myView->Scale();

When I'm the rotation, then I'm hide my triedron and then show him with new Scale.

If you are using QT I may make for you the sample for QT with using V3d_Triedron. And you can run this with compiling *.pro file of QT.
You are need this ???