# CNC simulation

Hi,
I'm going to develop a cnc simulator for my cnc machine. I don't want to simulate the G-Codes, instead, I want to simulate by getting the x,y,z position of the milling tool. The simulation should be 3D and the user should be able to rotate and zoom during the simulation.
For this, i have decided to subtract a moving cylinder from a box. First I had tested the OpenCSG but after few second it became too slow. because the number of the cylinders(number of tool position) was about 20,000,000! and the OpenCSG does all subtracts at each frame. so i think that if opencascade can subtract a cylinder from a cube and save the result shape as a new one(do not subtract for each frame), the problem will be solved. is it true?
But i have read in this forum that boolean operation are too slow.

Can some body help me where to start?

Hi Mono,

I am not familiar with cnc simulator. And if I am not mistaken, you should use "volume sweep". "Volume sweep" is a tough job. In Solidworks 2009 or higher version, there is a 3D sweep and cut.
http://help.solidworks.com/2010/English/SolidWorks/sldworks/LegacyHelp/S...

Ding

Anders Wallin, Dan Heeks, and I are all working on this, from different directions.
In alphabetic order by first name:
Anders - http://code.google.com/p/opencamlib/
Dan - http://code.google.com/p/voxelcut/
Me - http://code.google.com/p/cam-occ/

Have you guys looked into dexels instead of voxels? You create an NxM grid that bounds the solid. The grid plane can be anywhere outside the solid. At the center coordinate of each cell you cast a ray at the solid. When the ray enters the solid, that is the start of one dexel. Where the ray exits, that's the end of the dexel. The lighting normals of these two rectangular faces match the surface normals at the point of ray/surface intersection.

Hi Mark,

If you want to see a really goog simualtion, which is fast an accurate have a look at this video and paper about Dexel Simulation on Graphics Cards. For my minithis at the university I was also developing a grinding simulation and I found out that Dexel or something it is called LDI is the best solution out of Octree, Triangle or Voxel Simulation.

Wow! That is very impressive. I'm curious - will you be able to release your code as open source?

Mark

Hi Steve,

I have read your posts in this topic and also in "How to compute and display tool cutting (or stock removal)" topic. And I have read the paper that you have mention in this topic and also "Virtual Sculpting ..." paper that you have mention in the "How to compute ..." topic.

Previously i had tested the csg and HPMC, "Marching Cubes using Histogram Pyramids", for Real-time milling simulation but they were too slow for complex objects. So i came too this conclusion that i should continue your suggestion.

I was wondering if you would please send me the files and algorithms you mentioned at the "How to compute ..." topic.

mochenoo_At_yahoo_com

Hi,
Open Cascade boolean operations are not dedicated to be used in real time mode by definition.
You can use it if boolean operations should be applied one time (or enough rarely) and after that the resulting shape just changes its location (like cutting tool moves along material).
In this case you can use Transformation for simulation of the resulting shape movement in real time. It works.
If it is not your case probably you may use OpenCL for speeding-up of the calculations.
Regards
Sergey