How to compute and display tool cutting (or stock removal)

Hi all,

I am developing a little software to simulate the motion of a 5-axis milling machine. This machine is made of three axes of translation and two axes of rotation (B and C, the part is loaded on C axis).
So far I would like now to simulate progressive stock removal (by iterating over a tool-path, re-discretized). The purpose is to simulate cutting of a stock by the milling tool to produce the final part.

I would like to use the OpenCascade's Voxel library for this. At first glance I can see the basical steps to follow :
1. Convert the TopoDS_Shape of the milling tool to a Voxel_BoolDS (name it toolVoxels)
2. Convert the TopoDS_Shape of the stock to a Voxel_BoolDS (name it stockVoxels)
3. For every machine position Mi in the tool-path to simulate, do :
3.1 Rotate stockVoxels by Mi.cAxisValue
3.2 Move toolVoxels to Mi (Mi's X Y Z B values)
3.3 Compute the stock removal step with a Voxel_BooleanOperation between stockVoxels and toolVoxels and store the resulting voxels in stockVoxels
3.5 Display the updated stockVoxels and toolVoxels
3.6 Wait for a delta time

Steps 1. and 2. are easy. For steps 3.1 and 3.2 I don't know if it's even possible by reading the docs. As things are made, I think it will be necessary to reconvert the moved tool and stock shapes to Voxel_BoolDS objects. The main problem with this is that the stock shape is changing during the simulation and I don't know it at each step so I can't create the new i-th stockVoxels.

Can anyone help ? Maybe voxels structures is not suited for this problem as I need to rotate/move them. Any hints for other methods ?

Hugues Delorme's picture

I think it is possible to avoid rotation of the stockVoxels.
Location of the stockVoxels can stay the same, and it is the tool shape that is moved by C axis value so only one cube of voxels is moving.

Another problem that I have now is the cut operation between two sets of voxels. Voxel_BooleanOperation::Cut() requires the two sets of voxels to be of the same dimensions, lengths and start points. This is a heavy restriction that makes it unusable for my case. I will have to perform cutting by myself.

Gheorghiu's picture

Hello Hugues,

I am also interested in using voxels for my application but I did not found out how to move, rotate and display the voxels. Did you? Could you give me some hints?
Thank you in advance.

Best regards.

Hugues Delorme's picture

I did not experiment that much with OpenCascade's voxel library.

To display a voxel structure (eg Voxel_BoolDS) I would use a Voxel_Prs object.
Voxel_Prs class inherits AIS_InteractiveObject so it should be possible to move/rotate the voxels graphics with Voxel_Prs::SetTransformation().

Gheorghiu's picture

Thanks for your suggestions.

I tried already with Voxel_Prs but without success until now (I do not see anything). Maybe I did something wrong. I will try again.

Best Regards.

PengPei's picture

Hi Gheorghiu
I saw your question about visualization of VOXEL, posted on the opencascade website.
Did you ever solve the problem? The same problem had happened to me.:(

Steve's picture

Hi Hugues,

I am a developer of a grinding simulation software for 5 axis motion. First the implementation of the opencascade converting algorithm is a little bit to slow and the representation to use bits to represent the voxel are space efficient but for boolen operation unefficient. For the milling simulation I would recommend to read you some papers about dexel, because a lot a reaserchers used this kind of method with good result.
ZHU, WEIHANG, Virtual Sculpting and Polyhedral Machining Planning System with
Haptic Interface (Under the direction of Dr. Yuan-Shin Lee)

If you can not download the file, don't hesitate to ask i will send you some interesting files and algorithm how to implement these things.

Good luck


Hugues Delorme's picture

Hi Steeve,

Thanks for advising this paper, it seems to be a very interesting reading. I will get deeper into it within the following days.
I didn't know the existence of dexelization. I may ask you algorithms materials as I read the article later.

Thanks again.

Hugues Delorme's picture


I would be glad if you can send me the files and algorithms you mentioned. Please can you send them to : delorme _DOT_ hugues _AT_ gmail _DOT_ com

Thanks a lot.

bunnybaby's picture

can you send me the paper(my email is: i can't download it from the web.
thank you very much.

S. Edward Dolan's picture

Hi Steve,
Thanks for the hints. I found a few pages, white papers, etc. I found one in particular that is actually a patent. In the doc, there is mention of C source code, but it is in/on microfiche. Do you know of any reference to this source?

The patent is link is: