
Sat, 05/23/2020 - 10:45
TopoDS_Shape obj1 = BRepPrimAPI_MakeBox(100, 500, 20);
Handle(AIS_Shape) ais_obj1 = new AIS_Shape(obj1);
g_pDoc->myAISContext->Display(ais_obj1, true);
gp_Trsf start_pnt, end_pnt;
start_pnt.SetValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0);
end_pnt.SetValues(1, 0, 0, 100, 0, 1, 0, 100, 0, 0, 1, 100);
Handle(AIS_Animation) ais_animation = new AIS_Animation("obj1");
Handle(AIS_AnimationObject) ais_ao = new AIS_AnimationObject("obj1", g_pDoc->myAISContext, ais_obj1, start_pnt, end_pnt);
ais_ao->SetOwnDuration(10);
ais_ao->SetStartPts(0);
ais_animation->Add(ais_ao);
double duration = ais_animation->Duration();
ais_animation->StartTimer(0, 1.0, true);
while (!ais_animation->IsStopped())
{
ais_animation->UpdateTimer();
g_pDoc->myAISContext->UpdateCurrentViewer();
}
I use this code in my project, it can run correctly, but i cannot interactive,like rotate select!
Sun, 05/24/2020 - 23:09
Making an infinite loop prevents application handling user input events - hense, no camera interactions until animation timer is finished in your code.
Take a look onto AIS_Animation documentation:
Fri, 06/07/2024 - 18:02
Hi,I want to use ais_animation class to imitate circle movement,could you give me a C++ sample code?
Thanks
Jason