Forum archiveIssue archiveOther usage issues

Archived discussion

arrow representation

Other usage issuesWed, 05/09/2001 - 08:356 replies

Browse this forum
QuestionAuthor

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

Discussion

6 archived replies

Posts are displayed in their archived order.

01Commenter-1

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);

aTr->SetSize(aSize);

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

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

aDrawer->DatumAspect()->SetDrawFirstAndSecondAxis(Standard_False);

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, Commenter-1

02Commenter-2

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

Prs3d_Arrow::Draw(aPresentation,myLastPoint,dir,0.20,myFirstPoint.Distance(myLastPoint)/ArrowSizeValue);

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

Stephane

03Commenter-3

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.

sincerely
Commenter-3

04Commenter-4

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

Commenter-4

05Commenter-3

Hi:

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

sincerely Commenter-3

06Commenter-4

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

Commenter-4