shawn_21546 Wed, 05/09/2001 - 08:35 Forums: Other usage issuesHi 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 Thu, 05/10/2001 - 10:35 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, Andrey Log in to post comments S. Routelous (not verified) Thu, 05/10/2001 - 11:10 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 Log in to post comments Shawn Yang Mon, 05/21/2001 - 11:10 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 shawn Log in to post comments Sergey RUIN (not verified) Mon, 05/21/2001 - 11:52 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 Sergey Log in to post comments Shawn Yang Tue, 05/22/2001 - 04:22 Hi: Is it possible to change arrow shape? And, how to change it? Thanks a lot. sincerely shawn Log in to post comments Sergey RUIN (not verified) Fri, 05/25/2001 - 08:10 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 Sergey Log in to post comments
Thu, 05/10/2001 - 10:35
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, Andrey
Thu, 05/10/2001 - 11:10
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
Mon, 05/21/2001 - 11:10
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
shawn
Mon, 05/21/2001 - 11:52
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
Sergey
Tue, 05/22/2001 - 04:22
Hi:
Is it possible to change arrow shape? And, how to change it? Thanks a lot.
sincerely shawn
Fri, 05/25/2001 - 08:10
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
Sergey