且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

CNC铣削刀具材料表示

更新时间:1970-01-01 07:56:54


  1. 体素渲染



    您可以使用压缩来释放一些内存。至少对于一个轴(简单而快速)选择 RLE ,或者将空间分割为图层,并按图像进行压缩。


  2. 多维数据集表单列表



    这更适合您的任务。在开始时,您的材料是单一的3D盒子,所以想象沿着表面的点的网格。当您从侧面移除一些材料时,只需将相交的表面点转换为新位置。当你钻一个洞(所以表面不能匹配变化)然后将表面划分为两个新的...选择网格分辨率(每立方的点不是每[mm] !!!)。我更喜欢使用圆柱形表面而不是立方体,因为它们只有三面(顶部,底部和侧面)与立方体/框的6面相比。




  3. 多边形层



    想象一下,你的空间被切成2D平面(图像),那么你可以简单地记住每个切片的封闭多边形列表。这与子弹#2非常相似。实现与工具的交互更易于管理,但更难实现...另外,在子弹#2中,渲染更棘手一点



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. 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