performance of display

Hello, everyone:
I'm wirting a machining simulation software with OpenCASCAD4.0. I've calculated successive shapes of the workpiece. The problem is when i display the successive shapes to obtain an animation, the performance of display is quite poor. The screen is always flickering.

TopoDS_Shape myWorkPiece = ...
TopoDS_Shape myCutter = ...
TopTools_Array1OfShape arrayOfWorkPiece(0,100);
arrayOfWorkPiece(0) = myWorkPiece;
for(i=1; i {
arrayOfWorkPiece(i) = BRepAlgoAPI_Cut(myWorkPiece, myCutter);
//...
//Translate the cutter
//...
}

for(i=0; i {
Handle(AIS_Shape) myShape = new AIS_Shape(arrayOfWorkPiece(i));
myAISContext->Display(myShape);
Sleep(10);
myAisContext->Erase(myShape);
}

DU's picture

Hi,

I am also doing the simulation based on Open Cascade, but not to remove a material from workpiece. If you would like to change the location if AIS_Shape, I think no flicking problemJ, you can see and refer the sample “DisplayAnimation”.

At the same time, my colleague are working the milling simulation with the aid of GBuffer and NadelBlock model, because through Boolean operation to get removed Material/Workpiece model is no good solution, too slow and huge data spends in Open Cascade.

If you have more suggestions about my opinions, I would like to discuss it with you!

Kind regards!

Shangjian DU

preferlinux's picture

Thanks for your reply.

I am doing a milling simulation too. I have read about some papers about GBuffer and NadelBlock model. Would you please give me some suggestions about how to implement GBuffer and NadelBlock with Open Cascade?

best regards!

Sharjith Naramparambath's picture

Hi,
I have also written an application for g code toolpath simulation. But before I had OCC with me, using OpenGL. This package only shows the tool movement in animation, no material removal. After getting OCC I had a similar idea of doing it again using OCC for displaying material removal also. I havent yet started with it bcos I am trying to make a solid modeler presently. The logic i have thought about it is such: First make two solids for your cutter one at the start pnt and other at the end pnt. Calculate the cross sections of both solids on the plane perpendicular to the cutter direction make a swept solid between these two cross sections. fuse all three solids to get the volume removed. Now subtract the solid from your initial Part to get the cut part. Replace the initial part with the cut part. Thus repeat this for every next point your tool advances. Remember to always replace the old part with the new cut part. I havent tried this out but the logic seems to be correct according to Ibrahim Zeids book.
Best Luck and let me know if it works!

N. Sharjith