CNC Milling Tool material representation

2019-08-15 11:50发布

问题:

I'm writting CNC simulator for 3-axis milling tool. At first attempt I have represented the material as WxHxD box (W - width, H- height, D - depth) with W and D divisor parameters. So for example W = D = 120, H = 50, W-div = 20, D-div = 20:

At each step the mill is removing material and H coordinate at each division point is adjusted simulating material removal:

This method is OK for started. But to simulate full precision of milling tool the divisors should have hight values, i.e. for material block of 100 mm x 100 mm x 100 mm to have precision of 0.01 mm the divisors should be 10 000 which makes simulation almost impossible. Also setting divisors makes precision fixed and not dependent on mill parameters (radius, height, curvature, etc.).

Working application with current solution runs on PC machine, but next iteration should be able to run on mobile devices utilizing OpenGL ES 3.0 as rendering API.

Keeping this in mind the question arise what is best method to simulate (preferably in real time) material removal from starting block ? Second question is what data structure and algorithms to utilize to achieve this goal.

回答1:

As far as I know these simulations are performed on pixels, not on true geometry. Do you need the geometry of the remaining stock or a simple visual simulation is enough for your needs?



回答2:

  1. Voxel rendering

    You can use compression to free some memory. I would choose RLE at least for one axis (easy and fast) or divide space to layers and compress each as image ...

  2. list of 'cube' surfaces

    this is far better suited for your task. At start your material is single 3D box so imagine grid of points along the box surface. When you remove some material from side then just translate intersecting surface points to new position. When you drill a hole (so surface can not match the change) then divide surface to two new ... Choose the grid resolution (points per cube side not per [mm] !!!). I prefer to use cylindrical surfaces not cubic ones because they have just 3 sides (top,bottom,side) in comparison to 6 sides of cube/box.

  3. layers of polygons

    Imagine that your space is sliced to 2D planes (images) then you can simply remember closed polygon lists per each slice. This is very similar to bullet #2. It is more manageable but harder to implement interactions with tools ... Also the rendering is little more tricky then in bullet #2