arrow representation

Hi all: I need a arrow to point out the direction. I don't have any ideal about it. Can anyone give me suggestion. Thanks a lot.

sincerely shawn

Andrey Betenev's picture

Hello Shawn,

A simplest way to draw an arrow is to use class AIS_Trihedron, but display only one axis. For instance:

gp_Ax2 Ax2 ( start, direction );

Handle(Geom_Axis2Placement) gAx2 = new Geom_Axis2Placement ( Ax2 );

Handle(AIS_Trihedron) aTr = new AIS_Trihedron(gAx2);


Handle(AIS_Drawer) aDrawer = aTr->Attributes();

if(!aDrawer->HasDatumAspect()) aDrawer->SetDatumAspect(new Prs3d_DatumAspect());


aTr->SetColor(Quantity_NOC_RED); aTr->SetTextColor(Quantity_NOC_BLACK); aTr->SetArrowColor( Quantity_NOC_RED );

However, this method has a few disadvantages: you have a letter 'Z' drawn at the end of an axis; and you cannot directly change size of the arrow-head. So if you find a better way, please share this experience.

Best Regards, Andrey

S. Routelous's picture

You can also create your own InteractiveObject and in the compute method call Prs3d_Arrow::Draw


You can also associate text with Prs3d_Text::Draw(...)


Shawn Yang's picture

Hi Stephane:

Thank you for your response. How to get aPresentation? I have seen the description in the document. I didn't get it.

Thanks a lot.


Sergey RUIN's picture

Hello shawn,

Just like this

Handle(AIS_InteractiveContext) aCtx;

//... Find or create InteractiveContext

Handle(Prs3d_Presentation) aPresentation = new Prs3d_Presentation (aCtx->CurrentViewer()->Viewer());

That's all

Best Regards


Shawn Yang's picture


Is it possible to change arrow shape? And, how to change it? Thanks a lot.

sincerely shawn

Sergey RUIN's picture

Hi shawn,

You can only change the length of an arrow head and its angle. To do this use method ArrowAspect of AIS_Drawer or directly Prs3d_Arrow::Draw(...).

Best Regards