Milling Simulation

I've just downloaded OpenCascade 6.1. and want to try to obtain a milling simulation.But I think BRep Shape Booleans is too high level and it is time-consuming.
What about the 'Faceted solid' and 'Triangle Mesh'?
If anyone has got some news, I will appreciate to debate together.

mahii's picture


I am interested to know more about your comment that BRep Shape Booleans is time consuming. I was trying something similar and would you mind if we can discuss about this together.

You can contact me at

Thank You.

Sharjith Naramparambath's picture

I have tried the same stunt a year ago but got the same result as you. Then I learnt that commercial milling simulators don't use the boolean algorithms for solid cutting simulation. They rather use algorithms which is more graphics oriented than topology oriented. Some are like the Z-Buffer algorithm. There is a graphics (OpenGL) based library called OpenCSG which uses similar buffer algorithms to perform boolean operations like cut fuse and common. I find a large scope of implementing a milling simulation using it but haven,t explored it completely. You may try that and please let me know too. I have already developed an application (using OpenGL only) that reads in G-Code and animates the tool motion in 3d using dummy tool with lot many useful features for the shop floor. I plan to include solid simulation in it but haven't yet been successful.

mahii's picture

Hi Nair,

I am Mahesha. I am trying a similar stunt (for a project for my MSc course) and now feels like it will be a useless effort. Honestly I am not good with programming either. So it makes sense for me to just buy the utility that you have mentioned instead of breaking my head on it. Could you please share more details on the application that you have mentioned. I do not have much time left and hence I really want to get it working, even if it costs money.

Please write to me at or I have posted similar requests earlier too and no one replied. I hope you will reply and provide more information.

Thank you.

ziyoo's picture

I have used OpenCSG to do that. It is perfect for a couple of hundreds of GCode line. But when more than one thousand of Subtraction Operation, it will be very slowly, even crash. I think it uses Display list for Dynamic rotation and zoom, so we need a lightweight csg without display list.
On the other hand, some commercial cnc simulator can export the finished part to CAD file, like IGES. Does it do RE? I don't think so. I think the geom algorithm is based on solid to some extent.

Sharjith Naramparambath's picture

Hi all,
Yes, some applications that has to really use geometry for export and reuse the stock for next operation sequences do rely on triangulated data. One of the white papers that I came across said that they used the 'lawn mowing' principle for that. A grid of Z-Vectors are created in the rough stock. The top and bottom are made of triangles that has these Z-Vectors as vertices. The Z-Vectors are from stock-minima to stock-maxima. Now for every G-code block a 'Cutter Swept Surface'(CSS) is created and the Z-Vectors under it are trimmed or chopped using surface-ray or polyhedra-ray intersection algorithms and the triangles are recomputed for display. This data structure of the stock with Z-Vectors can be further used for subsequent operations or may be even exported. Try along that direction and please let me too know.

N. Sharjith

simulation's picture

Yes, you are right. But the ZBuffer is for 2.5,3 axes, couldn't support 5 axes. and it is difficult to control the tolerance, not based on geometry.