Workpiece cutting simulation method, device and computer equipment

CN122886186APending Publication Date: 2026-10-09INFINITE WORKSHOP (SHENZHEN) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611037393.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-13
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0003]然而,这些方法普遍存在存储开销大、计算效率低或显示灵活性不足等问题,在普通计算终端上难以兼顾实时交互与显示质量

Benefits of technology

[0060]上述工件切削模拟方法、装置、计算机设备、计算机可读存储介质和计算机程序产品,构建体素栅格结构;体素栅格结构包括多个体素单元;体素单元对应的材料占用标识,用于指示体素单元是否被工件占用;遍历模拟加工路径中的每个切削位置,根据切削工具的几何形状和切削工具在当前切削位置处的位姿,确定工具影响掩码;工具影响掩码,用于指示在位姿下的切削工具所覆盖的各体素单元构成的集合;切削工具用于切削工件;针对体素栅格结构中与工具影响掩码相交的每个体素单元,根据工具影响掩码,更新体素单元对应的材料占用标识;在切削模拟过程中,根据工件的仿真状态切换至第一显示模式或第二显示模式;第一显示模式下,对材料占用标识发生变化的体素单元进行增量网格化得到三角网格,显示三角网格;第二显示模式下,对体素栅格结构的材料占用状态进行距离场重建与等值面提取得到等值面网格,显示等值面网格。相较于传统技术,一方面,本申请通过采用包括多个体素单元的体素栅格结构并利用轻量级的材料占用标识指示体素单元的占用状态,能够减少数据存储量,而且利用工具影响掩码,将切削更新操作精准限定于切削工具覆盖的局部体素区域,实现局部精准更新,无需全局逐点遍历,能够在普通计算终端上时间高精度切削模拟的流畅运行;另一方面,本申请依据刀具的几何形状和实际空间位姿三维生成工具影响掩码,不依赖任何固定投影方向,能够自适应任意复杂的刀具运动轨迹(包括多轴联动、倾斜摆动等),而且根据工具影响掩码更新材料占用标识,能够直接对体素单元的整数索引执行布尔赋值操作,无需进行几何求交计算,不受模型复杂度或刀具路径变化的影响,保证了长期仿真过程中的数据可靠性和拓扑完整性;再一方面,本申请在第一显示模式下仅对材料状态发生变化的局部体素进行增量网格化,该操作计算量极小,能够确保实时交互的灵敏响应,而在第二显示模式下基于整体体素状态进行距离场重建与等值面提取,从而输出光滑、连续的高质量表面网格,这两种模式的按需切换,使普通计算终端既能获得毫秒级响应,又能呈现高质量的视觉效果,从而解决无法兼顾实时交互与显示质量的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122886186A_ABST
    Figure CN122886186A_ABST
Patent Text Reader

Abstract

The application relates to a workpiece cutting simulation method and device and computer equipment, relates to the technical field of cutting simulation, and can balance real-time interaction and display quality. The method comprises the following steps: constructing a voxel grid structure comprising a plurality of voxel units; traversing each cutting position in a simulated machining path, determining a tool influence mask according to the geometric shape of a cutting tool and the pose of the cutting tool at the current cutting position; for each voxel unit intersecting the tool influence mask in the voxel grid structure, updating the material occupancy identifier corresponding to the voxel unit according to the tool influence mask; during the cutting simulation process, switching to a first display mode or a second display mode according to the simulation state of the workpiece; in the first display mode, incrementally gridding the voxel unit whose material occupancy identifier changes to obtain and display a triangular mesh; in the second display mode, performing distance field reconstruction and isosurface extraction on the material occupancy state of the voxel grid structure to obtain and display an isosurface mesh.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cutting simulation technology, and in particular to a workpiece cutting simulation method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology

[0002] Cutting simulation is a crucial step in verifying toolpaths and checking for overcuts and collisions after CNC machining programming. For workpiece cutting simulation, the industry primarily employs traditional techniques such as the voxel method, columnar voxel method, triangular mesh Boolean method, and distance field method. Among these, the voxel method constructs a regular grid and records the workpiece shape using the presence or absence of material markers for each voxel; the columnar voxel method simplifies calculations by projecting along a fixed direction; the triangular mesh Boolean method updates the model based on mesh Boolean operations; and the distance field method represents the workpiece surface using floating-point distance values.

[0003] However, these methods generally suffer from problems such as high storage overhead, low computational efficiency, or insufficient display flexibility, making it difficult to balance real-time interaction and display quality on ordinary computing terminals. Among them, the amount of raster data in the traditional voxel method increases sharply with the increase of accuracy, and point-by-point updates are difficult to utilize the parallel capabilities of the processor; the columnar voxel method is limited by the projection direction and has difficulty handling complex tool postures in multi-axis machining; the triangular mesh Boolean method has poor stability in dynamic difference subtraction, and the computational load increases sharply as the model size increases; the distance field method causes the memory requirement to increase exponentially due to the point-by-point storage of floating-point values. Summary of the Invention

[0004] Therefore, it is necessary to provide a workpiece cutting simulation method, apparatus, computer equipment, computer-readable storage medium, and computer program product to address the aforementioned technical problems.

[0005] Firstly, this application provides a workpiece cutting simulation method, including:

[0006] Construct a voxel grid structure; the voxel grid structure includes multiple voxel units; the material occupancy identifier corresponding to the voxel unit is used to indicate whether the voxel unit is occupied by a workpiece;

[0007] Traversing each cutting position in the simulated machining path, a tool influence mask is determined based on the geometry of the cutting tool and its pose at the current cutting position. The tool influence mask indicates the set of voxel units covered by the cutting tool in the given pose. The cutting tool is used to cut the workpiece.

[0008] For each voxel cell in the voxel grid structure that intersects with the tool influence mask, update the material occupancy identifier corresponding to the voxel cell according to the tool influence mask;

[0009] During the cutting simulation, the simulation mode is switched to either the first display mode or the second display mode according to the simulation state of the workpiece. In the first display mode, the voxel units whose material occupancy indicators have changed are incrementally meshed to obtain triangular meshes, and the triangular meshes are displayed. In the second display mode, the material occupancy state of the voxel grid structure is reconstructed by distance field and the isosurface is extracted to obtain isosurface meshes, and the isosurface meshes are displayed.

[0010] In one embodiment, determining the tool influence mask based on the geometry of the cutting tool and the pose of the cutting tool at the current cutting position includes:

[0011] Based on the geometry of the cutting tool and its pose at the current cutting position, determine multiple sampling points of the cutting tool in the given pose;

[0012] Transform each of the sampling points into the space where the voxel grid structure is located, and determine the voxel unit into which each of the sampling points falls;

[0013] The tool influence mask is determined based on the voxel unit into which each sampling point falls.

[0014] In one embodiment, before determining the tool influence mask based on the geometry of the cutting tool and the pose of the cutting tool at the current cutting position, the method further includes:

[0015] Obtain the displacement and attitude change of the cutting tool between its pose at the current cutting position and its pose at the previous cutting position;

[0016] If the displacement is not less than the target distance threshold or the attitude change is not less than the target angle threshold, the number of attitude samples is determined based on the displacement and the attitude change.

[0017] Based on the number of attitude samples, linear interpolation is performed between the current cutting position and the previous cutting position of the cutting tool, and spherical linear interpolation is performed between the pose of the cutting tool at the current cutting position and the pose of the cutting tool at the previous cutting position.

[0018] In one embodiment, updating the material occupancy identifier corresponding to each voxel cell in the voxel grid structure that intersects with the tool influence mask, based on the tool influence mask, includes:

[0019] For each voxel cell in the voxel grid structure that intersects with the tool influence mask, obtain the word index corresponding to the word where the voxel cell is located and the bit offset of the voxel cell in the word;

[0020] When the voxel unit meets the mask clearing condition, the material occupancy identifier corresponding to the voxel unit is updated to a first identifier value according to the word index and the bit offset; the mask clearing condition includes the tool influence mask containing the voxel unit and the stored material occupancy identifier of the voxel unit being a second identifier value; the first identifier value indicates that the voxel unit is not occupied by the workpiece; the second identifier value indicates that the voxel unit is occupied by the workpiece.

[0021] In one embodiment, the step of reconstructing the distance field and extracting isosurfaces from the material occupancy state of the voxel grid structure to obtain an isosurface mesh includes:

[0022] Based on the removed voxel units, a first candidate vertex set is determined; the removed voxel units include voxel units whose material occupancy identifier has changed.

[0023] A second set of candidate vertices is determined based on the voxel cells in the voxel grid structure that intersect with each bounding box corresponding to the cutting tool and are adjacent to the cut voxel cells; the bounding box includes the axis-aligned bounding box of the cutting tool at each of the cutting positions;

[0024] Based on the first candidate vertex set and the second candidate vertex set, determine the target candidate vertex set;

[0025] For each candidate vertex in the target candidate vertex set, a first signed distance value of the cutting tool at each cutting position is determined based on the pose of the cutting tool at each cutting position. The second signed distance value of the candidate vertex is updated based on the minimum value among the first signed distance values ​​to obtain the reconstructed distance field.

[0026] The reconstructed distance field is subjected to isosurface extraction to obtain an isosurface mesh.

[0027] In one embodiment, constructing the voxel grid structure includes:

[0028] Among multiple candidate voxel step sizes, a target voxel step size is determined; the target voxel step size is the smallest candidate voxel step size among the multiple candidate voxel step sizes that satisfies the condition that the total number of voxels is less than or equal to a target number threshold; the total number of voxels corresponding to the candidate voxel step size is determined based on the geometric dimensions of the workpiece and the candidate voxel step size.

[0029] Based on the target voxel step size and the geometric dimensions of the workpiece, multiple voxel units are determined and corresponding material occupancy identifiers are assigned to each voxel unit; each material occupancy identifier is stored in a bit array; the bit array and each voxel unit constitute a voxel grid structure.

[0030] In one embodiment, the method further includes:

[0031] The visual time cursor is advanced as it traverses each cutting position in the simulated machining path.

[0032] When the cutting time vertex lags behind the visual time vertex, the time interval to be launched within the current machining path segment is determined;

[0033] Based on the sub-sampling step size within the processing path segment, the time interval to be launched is divided into multiple sub-positions;

[0034] For each sub-position, a cutting step command corresponding to the sub-position is sent to the scheduler, and the cutting time cursor is advanced; the scheduler is used to package multiple consecutive cutting step commands received into a batch message, and to merge multiple consecutive pose synchronization commands received to obtain a target pose synchronization command; the batch message is used to indicate multiple cutting positions in the simulated machining path; the target pose synchronization command is used to indicate the pose of the cutting tool at the current cutting position.

[0035] In one embodiment, the method further includes:

[0036] In response to receiving a progress jump command, the cutting step command to be sent is determined according to the progress jump position indicated by the progress jump command;

[0037] Based on the reception time of each of the cutting step instructions to be sent, send each of the cutting step instructions to be sent to the scheduler;

[0038] After sending the cutting step commands to be sent, the distance field is reconstructed and the isosurface is extracted for the material occupancy state of the voxel grid structure to obtain the isosurface mesh.

[0039] Based on the isosurface mesh, the simulation state of the workpiece is marked as completed.

[0040] Secondly, this application also provides a workpiece cutting simulation device, comprising:

[0041] A construction module is used to construct a voxel grid structure; the voxel grid structure includes multiple voxel units; the material occupancy identifier corresponding to the voxel unit is used to indicate whether the voxel unit is occupied by a workpiece;

[0042] The traversal module is used to traverse each cutting position in the simulated machining path, and determine the tool influence mask based on the geometry of the cutting tool and the pose of the cutting tool at the current cutting position; the tool influence mask is used to indicate the set of voxel units covered by the cutting tool in the pose; the cutting tool is used to cut the workpiece.

[0043] The update module is used to update the material occupancy identifier corresponding to each voxel unit in the voxel grid structure that intersects with the tool influence mask, according to the tool influence mask.

[0044] The display module is used to switch to a first display mode or a second display mode according to the simulation state of the workpiece during the cutting simulation. In the first display mode, the voxel units whose material occupancy indicators have changed are incrementally meshed to obtain triangular meshes, and the triangular meshes are displayed. In the second display mode, the material occupancy state of the voxel grid structure is reconstructed by distance field and the isosurface is extracted to obtain isosurface meshes, and the isosurface meshes are displayed.

[0045] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0046] Construct a voxel grid structure; the voxel grid structure includes multiple voxel units; the material occupancy identifier corresponding to the voxel unit is used to indicate whether the voxel unit is occupied by a workpiece;

[0047] Traversing each cutting position in the simulated machining path, a tool influence mask is determined based on the geometry of the cutting tool and its pose at the current cutting position. The tool influence mask indicates the set of voxel units covered by the cutting tool in the given pose. The cutting tool is used to cut the workpiece.

[0048] For each voxel cell in the voxel grid structure that intersects with the tool influence mask, update the material occupancy identifier corresponding to the voxel cell according to the tool influence mask;

[0049] During the cutting simulation, the simulation mode is switched to either the first display mode or the second display mode according to the simulation state of the workpiece. In the first display mode, the voxel units whose material occupancy indicators have changed are incrementally meshed to obtain triangular meshes, and the triangular meshes are displayed. In the second display mode, the material occupancy state of the voxel grid structure is reconstructed by distance field and the isosurface is extracted to obtain isosurface meshes, and the isosurface meshes are displayed.

[0050] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0051] Construct a voxel grid structure; the voxel grid structure includes multiple voxel units; the material occupancy identifier corresponding to the voxel unit is used to indicate whether the voxel unit is occupied by a workpiece;

[0052] Traversing each cutting position in the simulated machining path, a tool influence mask is determined based on the geometry of the cutting tool and its pose at the current cutting position. The tool influence mask indicates the set of voxel units covered by the cutting tool in the given pose. The cutting tool is used to cut the workpiece.

[0053] For each voxel cell in the voxel grid structure that intersects with the tool influence mask, update the material occupancy identifier corresponding to the voxel cell according to the tool influence mask;

[0054] During the cutting simulation, the simulation mode is switched to either the first display mode or the second display mode according to the simulation state of the workpiece. In the first display mode, the voxel units whose material occupancy indicators have changed are incrementally meshed to obtain triangular meshes, and the triangular meshes are displayed. In the second display mode, the material occupancy state of the voxel grid structure is reconstructed by distance field and the isosurface is extracted to obtain isosurface meshes, and the isosurface meshes are displayed.

[0055] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0056] Construct a voxel grid structure; the voxel grid structure includes multiple voxel units; the material occupancy identifier corresponding to the voxel unit is used to indicate whether the voxel unit is occupied by a workpiece;

[0057] Traversing each cutting position in the simulated machining path, a tool influence mask is determined based on the geometry of the cutting tool and its pose at the current cutting position. The tool influence mask indicates the set of voxel units covered by the cutting tool in the given pose. The cutting tool is used to cut the workpiece.

[0058] For each voxel cell in the voxel grid structure that intersects with the tool influence mask, update the material occupancy identifier corresponding to the voxel cell according to the tool influence mask;

[0059] During the cutting simulation, the simulation mode is switched to either the first display mode or the second display mode according to the simulation state of the workpiece. In the first display mode, the voxel units whose material occupancy indicators have changed are incrementally meshed to obtain triangular meshes, and the triangular meshes are displayed. In the second display mode, the material occupancy state of the voxel grid structure is reconstructed by distance field and the isosurface is extracted to obtain isosurface meshes, and the isosurface meshes are displayed.

[0060] The aforementioned workpiece cutting simulation method, apparatus, computer equipment, computer-readable storage medium, and computer program product construct a voxel grid structure. The voxel grid structure includes multiple voxel elements. Material occupancy identifiers corresponding to the voxel elements indicate whether the voxel element is occupied by the workpiece. Each cutting position in the simulated machining path is traversed, and a tool influence mask is determined based on the geometry of the cutting tool and its pose at the current cutting position. The tool influence mask indicates the set of voxel elements covered by the cutting tool in its pose. The cutting tool is used to cut the workpiece. For each voxel element in the voxel grid structure that intersects with the tool influence mask, the material occupancy identifier corresponding to the voxel element is updated based on the tool influence mask. During the cutting simulation, the simulation state of the workpiece is switched to either a first display mode or a second display mode. In the first display mode, voxel elements with changed material occupancy identifiers are incrementally meshed to obtain triangular meshes, which are then displayed. In the second display mode, the material occupancy state of the voxel grid structure is reconstructed using a distance field and its isosurfaces are extracted to obtain an isosurface mesh, which is then displayed. Compared to traditional technologies, this application, on the one hand, reduces data storage by employing a voxel grid structure comprising multiple voxel units and utilizing lightweight material occupancy markers to indicate the occupancy status of voxel units. Furthermore, by utilizing tool influence masks, the cutting update operation is precisely limited to the local voxel region covered by the cutting tool, achieving precise local updates without requiring global point-by-point traversal, enabling smooth operation of high-precision cutting simulations on ordinary computing terminals. On the other hand, this application generates a 3D tool influence mask based on the tool's geometry and actual spatial pose, independent of any fixed projection direction, and can adapt to arbitrarily complex tool motion trajectories (including multi-axis linkage, tilting, and oscillation). Moreover, updating the material occupancy markers based on the tool influence mask... It can directly perform Boolean assignment operations on the integer indices of voxel elements without performing geometric intersection calculations, and is unaffected by model complexity or toolpath changes, ensuring data reliability and topological integrity during long-term simulations. Furthermore, in the first display mode, this application only performs incremental meshing on local voxels where the material state changes. This operation has a very small computational load, ensuring sensitive response for real-time interaction. In the second display mode, distance field reconstruction and isosurface extraction are performed based on the overall voxel state, thereby outputting a smooth, continuous, high-quality surface mesh. The on-demand switching between these two modes allows ordinary computing terminals to achieve both millisecond-level response and high-quality visual effects, thus solving the problem of not being able to balance real-time interaction and display quality. Attached Figure Description

[0061] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0062] Figure 1 This is a diagram illustrating the application environment of a workpiece cutting simulation method in one embodiment.

[0063] Figure 2 This is a flowchart illustrating a workpiece cutting simulation method in one embodiment;

[0064] Figure 3 This is a flowchart illustrating the workpiece cutting simulation method in another embodiment;

[0065] Figure 4 This is a structural block diagram of a workpiece cutting simulation device in one embodiment;

[0066] Figure 5 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0067] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0068] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various objects, but these objects are not limited by these terms. These terms are only used to distinguish the first object from the second object. The term "comprising" and any variations thereof, as used in this application, are intended to cover non-exclusive inclusion. The term "multiple" as used in this application refers to two or more.

[0069] The workpiece cutting simulation method provided in this application embodiment can be applied to, for example... Figure 1The application environment is illustrated. The terminal communicates with the server via a network. The data storage system stores the data the server needs to process. This system can be integrated onto the server, or it can be located in the cloud or on other network servers. The terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, IoT devices, and portable wearable devices. IoT devices can include smart in-vehicle devices, projection devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted displays, etc. Head-mounted displays can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0070] In one exemplary embodiment, such as Figure 2 As shown, a workpiece cutting simulation method is provided, which can be applied to... Figure 1 In the terminal, the method may include the following steps:

[0071] Step S201: Construct a voxel grid structure; the voxel grid structure includes multiple voxel units; the material occupancy identifier corresponding to the voxel unit is used to indicate whether the voxel unit is occupied by the workpiece.

[0072] The workpiece can be a blank of any geometric shape. A voxel unit can be an infinite number of neatly arranged, identical small cells obtained by dividing the three-dimensional space containing the blank. The voxel grid structure can be a three-dimensional mesh framework composed of these small cells.

[0073] For example, the terminal can first construct a voxel grid structure including multiple voxel units. Then, the terminal can assign a corresponding material occupancy identifier to each voxel unit. The material occupancy identifier corresponding to a voxel unit can be stored in the bit array to indicate whether the voxel unit is occupied by a workpiece. For example, if the material occupancy identifier corresponding to a voxel unit is binary 1, it indicates that the voxel unit is covered by workpiece material; if the material occupancy identifier corresponding to a voxel unit is binary 0, it indicates that the voxel unit is not occupied by the workpiece (e.g., it has been cut off). In this embodiment, the initial state of the voxel grid structure is that all voxel units are occupied by the workpiece, that is, all material occupancy identifiers included in the bit array can be initialized to binary 1.

[0074] Step S202: Traverse each cutting position in the simulated machining path, and determine the tool influence mask based on the geometry of the cutting tool and the pose of the cutting tool at the current cutting position; the tool influence mask is used to indicate the set of voxel units covered by the cutting tool in the pose; the cutting tool is used to cut the workpiece.

[0075] The pose of the cutting tool at the current cutting position can include the position and orientation of the cutting tool (e.g., a cutting tool), which describes how the cutting operation is being performed. For example, the X, Y, and Z coordinates of the cutting tool tip in three-dimensional space and the direction in which the cutting tool axis points (e.g., vertically downward, tilted at 45 degrees, or horizontally).

[0076] For example, each cutting position in the simulated machining path is traversed. For the current cutting position, based on the geometry of the cutting tool and its pose at the current cutting position, a tool influence mask is determined that indicates the set of voxel units covered by the cutting tool at that pose. Specifically, multiple key points are sampled based on the geometry of the cutting tool. Each key point is transformed into the space of the voxel grid structure, and the voxel units into which each key point falls are determined. The voxel units into which the key points fall constitute the tool influence mask.

[0077] Step S203: For each voxel cell in the voxel grid structure that intersects with the tool influence mask, update the material occupancy identifier corresponding to the voxel cell according to the tool influence mask.

[0078] For example, for each voxel cell in the voxel grid structure that intersects with the tool influence mask, the material occupancy flag corresponding to that voxel cell is updated according to the tool influence mask. The update rule is as follows: if a voxel cell is covered by the tool influence mask and its current material occupancy flag is a first flag value (e.g., 1, indicating that the voxel cell has material), then the material occupancy flag of that voxel cell is updated to a second flag value (e.g., 0, indicating that the voxel cell has been removed). This update is equivalent to a voxel-by-voxel serial Boolean subtraction operation.

[0079] Step S204: During the cutting simulation, switch to the first display mode or the second display mode according to the simulation state of the workpiece; in the first display mode, perform incremental meshing on the voxel elements whose material occupancy indicators have changed to obtain triangular meshes, and display the triangular meshes; in the second display mode, perform distance field reconstruction and isosurface extraction on the material occupancy state of the voxel grid structure to obtain isosurface meshes, and display the isosurface meshes.

[0080] Here, a triangular mesh can refer to a three-dimensional object surface model formed by piecing together a bunch of triangles of various sizes. An isosurface mesh can refer to a surface model calculated by algorithms (such as the symbolic distance field reconstruction algorithm and the Marching Cubes algorithm).

[0081] For example, during the cutting simulation, the display screen is output in either a first display mode or a second display mode according to the simulation state of the workpiece. In the first display mode, only voxel elements whose material occupancy indicators change are incrementally meshed (e.g., using the Greedy Meshing algorithm) to obtain triangular meshes, and these triangular meshes are displayed to achieve low-latency display of the real-time cutting screen. In the second display mode, the overall or partial material occupancy state of the voxel grid structure is reconstructed using a signed distance field (SDF), and then isosurfaces are extracted from the reconstructed distance field (e.g., using the Marching Cubes algorithm) to obtain isosurface meshes, which are then displayed to achieve high-quality display or accurate measurement.

[0082] In the above workpiece cutting simulation method, a voxel grid structure is constructed; the voxel grid structure includes multiple voxel elements; the material occupancy flag corresponding to the voxel element is used to indicate whether the voxel element is occupied by the workpiece; each cutting position in the simulated machining path is traversed, and the tool influence mask is determined according to the geometry of the cutting tool and the pose of the cutting tool at the current cutting position; the tool influence mask is used to indicate the set of voxel elements covered by the cutting tool in the pose; the cutting tool is used to cut the workpiece; for each voxel element in the voxel grid structure that intersects with the tool influence mask, the material occupancy flag corresponding to the voxel element is updated according to the tool influence mask; during the cutting simulation, the simulation state of the workpiece is switched to a first display mode or a second display mode; in the first display mode, the voxel elements whose material occupancy flags have changed are incrementally meshed to obtain triangular meshes, and the triangular meshes are displayed; in the second display mode, the material occupancy state of the voxel grid structure is reconstructed by distance field and extracted by isosurface to obtain isosurface meshes, and the isosurface meshes are displayed. Compared to traditional technologies, this embodiment, on the one hand, reduces data storage by employing a voxel grid structure comprising multiple voxel units and using lightweight material occupancy markers to indicate the occupancy status of voxel units. Furthermore, by utilizing tool influence masks, the cutting update operation is precisely limited to the local voxel region covered by the cutting tool, achieving precise local updates without requiring global point-by-point traversal. This enables smooth operation of high-precision cutting simulations on ordinary computing terminals. On the other hand, this embodiment generates a 3D tool influence mask based on the tool's geometry and actual spatial pose, independent of any fixed projection direction. It can adapt to arbitrarily complex tool motion trajectories (including multi-axis linkage, tilting, and oscillation), and updates the material occupancy markers according to the tool influence mask. It can directly perform Boolean assignment operations on the integer indices of voxel elements without performing geometric intersection calculations, and is unaffected by model complexity or toolpath changes, ensuring data reliability and topological integrity during long-term simulations. Furthermore, in the first display mode, this embodiment only performs incremental meshing on local voxels where the material state changes. This operation has a very small computational load, ensuring sensitive response for real-time interaction. In the second display mode, distance field reconstruction and isosurface extraction are performed based on the overall voxel state, thereby outputting a smooth, continuous, high-quality surface mesh. The on-demand switching between these two modes allows ordinary computing terminals to achieve both millisecond-level response and high-quality visual effects, thus solving the problem of not being able to balance real-time interaction and display quality.

[0083] In an exemplary embodiment, step S202, determining the tool influence mask based on the geometry of the cutting tool and its pose at the current cutting position, may include:

[0084] Based on the geometry of the cutting tool and its pose at the current cutting position, determine multiple sampling points of the cutting tool in the pose; transform each sampling point into the space of the voxel grid structure and determine the voxel unit into which each sampling point falls; determine the tool influence mask based on the voxel unit into which each sampling point falls.

[0085] For example, firstly, based on the geometry of the cutting tool (e.g., ball end mill, flat end mill, tapered ball end mill, rounded end mill, etc.) and a preset sampling density, multiple sampling points are obtained from the geometric surface or interior of the cutting tool to form a key point cloud. The sampling density satisfies the coverage completeness condition, i.e., the sampling interval is no greater than the voxel size divided by √3, for example, one-third of the voxel size can be used. Then, for the obtained key point cloud, a 3D spatial filling curve code (e.g., a Morton code, obtained by interleaving the 3D integer coordinates of the sampling point bitwise) is calculated for each sampling point, and the key point cloud is sorted in ascending order of this code to improve cache locality when writing to the voxel raster subsequently.

[0086] Subsequently, a pre-calculated fusion affine matrix is ​​obtained. This 3×4 matrix is ​​constructed by dividing each row of the cutting tool's world transformation matrix by the voxel step size, and then subtracting the voxel grid origin from the translation component of the world transformation matrix and dividing by the voxel step size to obtain the last column. Using the fusion affine matrix, an affine transformation is performed on the local coordinates of each sorted sampling point, calculating the three integer index coordinates of that sampling point in the world voxel grid in one operation. This calculation process contains only 9 multiplications, 9 additions, and 3 rounding operations; it does not include division operations or branch jumps.

[0087] Next, based on the calculated integer index coordinates of each sampling point, the voxel unit in which each sampling point falls is determined, and the set of these voxel units is used as a tool influence mask. The out-of-bounds determination is completed in one step through unsigned integer comparison: after converting the calculated integer index coordinates to unsigned integers, if the value is greater than the total number of voxels along the corresponding axis, it is determined to be out of bounds and the sampling point is discarded.

[0088] In an exemplary embodiment, step S202, before determining the tool influence mask based on the geometry of the cutting tool and the pose of the cutting tool at the current cutting position, further includes:

[0089] Obtain the displacement and attitude change of the cutting tool at the current cutting position and the previous cutting position; if the displacement is not less than the target distance threshold or the attitude change is not less than the target angle threshold, determine the number of attitude samples based on the displacement and attitude change; based on the number of attitude samples, perform linear interpolation between the current cutting position and the previous cutting position of the cutting tool, and perform spherical linear interpolation between the pose of the cutting tool at the current cutting position and the pose of the cutting tool at the previous cutting position.

[0090] For example, first, the pose of the cutting tool at the current cutting position (hereinafter referred to as the current pose) and the pose of the cutting tool at the previous cutting position (i.e., the previous pose) are obtained. The translation distance d (i.e., the Euclidean distance normalized to the voxel size) and the pose change angle θ (i.e., the quaternion angle measured in radians) between the pose from the previous pose to the pose at the current position are calculated.

[0091] Subsequently, if the translation distance d is less than or equal to a preset target distance threshold (e.g., 1 voxel size), and the attitude change angle θ is less than or equal to a preset target angle threshold (e.g., 0.5°), then it is determined that no interpolation is needed, and a single cut is performed only at the current cutting position. Otherwise, it is determined that multi-attitude sweep mode needs to be entered.

[0092] Next, in the multi-pose sweep mode, the number of pose samples n is calculated using equation (1). n can be limited to a preset upper limit N_max (e.g., 64). The distance sampling step size can be 0.8 voxel size, and the angle sampling step size can be 2°. Based on the calculated number of samples n, n sub-poses are generated between the previous pose and the current pose. Specifically, for the position component, linear interpolation (Lerp) is used to generate n interpolated positions; for the pose component (quaternion), spherical linear interpolation (SLERP) is used to generate n interpolated poses; each interpolated position is combined with the corresponding interpolated pose to form n sub-poses.

[0093] n=max(ceil(d / distance sampling step),ceil(θ / angle sampling step))(1)

[0094] Then, if the control flag at the current cutting position indicates a hard discontinuity event, the sampling number n is forcibly set to 1, and the interpolation process in step S03 is disabled. Only a single cut is performed at the final state of the current cutting position to avoid interpolating false cuts between two physically discontinuous toolpaths. Hard discontinuities may include, but are not limited to: the first cut after playback is paused and resumed, the first cut after a progress bar jump, the first cut after a G0 rapid traverse, and the first cut after tool lifting and lowering.

[0095] In an exemplary embodiment, step S203, for each voxel cell in the voxel grid structure that intersects with the tool influence mask, updating the material occupancy identifier corresponding to the voxel cell according to the tool influence mask, may include:

[0096] For each voxel cell in the voxel grid structure that intersects with the tool influence mask, obtain the word index corresponding to the word in which the voxel cell is located and the bit offset of the voxel cell in the word; if the voxel cell meets the mask clearing condition, update the material occupancy flag corresponding to the voxel cell to the first flag value according to the word index and the bit offset; the mask clearing condition includes that the tool influence mask contains voxel cells and the material occupancy flag stored in the voxel cell is the second flag value; the first flag value indicates that the voxel cell is not occupied by the workpiece; the second flag value indicates that the voxel cell is occupied by the workpiece.

[0097] For example, firstly, for each voxel cell intersecting the tool influence mask, the word index w of the word containing that voxel cell and the bit offset b of that voxel cell within the word are calculated based on the linear index lin of that voxel cell in the voxel raster. The linear index lin is calculated in the fastest X-axis scan order, followed by the Y-axis, and then the slowest Z-axis scan order: lin = x + y·Nx + z·Nx·Ny. The word index w = lin div WordBits, where WordBits is the number of bits (32-bit or 64-bit) of each unsigned integer word. The bit offset b = lin mod WordBits.

[0098] Subsequently, parallel clearing operations are performed on a word-by-word basis. Specifically, for each word covered by the tool-affected mask, a corresponding tool mask word is constructed (in the tool mask word, the bits covered by the tool-affected mask are 1, and the remaining bits are 0). The currently stored material occupancy identifier word (i.e., the material word) for that word is obtained.

[0099] Then, update according to the following steps: Calculate the overlap mask: overlap = tool mask word AND material word. A bit that is 1 in the overlap mask indicates that the voxel unit corresponding to that bit simultaneously meets the two conditions of "being covered by the tool-affected mask" and "the current material occupancy identifier is the first identifier value (material present)", that is, the mask clearing condition is met; use the hardware-supported popcount instruction to count the number of binary 1s in the overlap mask, as the number of voxel units actually removed in this cutting step; perform word-level subtraction: material word ← material word AND NOT tool mask word, and update the material occupancy identifier of the voxel units that meet the mask clearing condition to the second identifier value (removed) in batches; record the word index to be cleared and the corresponding clear mask (i.e., overlap mask) as the incremental entry for this cutting step.

[0100] In an exemplary embodiment, step S204, which involves reconstructing the distance field and extracting isosurfaces from the material occupancy state of the voxel grid structure to obtain an isosurface mesh, may include:

[0101] Based on the removed voxel elements, a first candidate vertex set is determined; the removed voxel elements include those whose material occupancy identifiers have changed; a second candidate vertex set is determined based on the voxel elements in the voxel grid structure that intersect with the bounding boxes corresponding to the cutting tool and are adjacent to the removed voxel elements; the bounding boxes include the axis-aligned bounding boxes of the cutting tool at each cutting position; a target candidate vertex set is determined based on the first and second candidate vertex sets; for each candidate vertex in the target candidate vertex set, a first signed distance value of the cutting tool at each cutting position is determined based on the pose of the cutting tool at each cutting position, and the second signed distance value of the candidate vertex is updated based on the minimum value among the first signed distance values ​​to obtain the reconstructed distance field; isosurface extraction is performed on the reconstructed distance field to obtain an isosurface mesh.

[0102] For example, first, maintain a vertex symbolic distance field (SDF) floating-point array, where each vertex SDF corresponds one-to-one with a corner point of the voxel grid (one more voxel than the number of voxels along each axis). Simultaneously, maintain an array of cut voxel markers (a byte array used for quick queries to determine if a voxel has been cut) and a set of active cells (marking Marching Cubes located within the narrowband). Set the narrowband width, for example, two voxel layers, and keep vertices outside the narrowband at a preset maximum negative value.

[0103] Subsequently, upon reaching the cut increment at each step, a first candidate vertex set and a second candidate vertex set are generated from the following two sources respectively. These two sets are then merged to obtain the target candidate vertex set. Source 2 addresses the issue that removed voxels do not generate new values ​​in subsequent steps, but the SDF of neighboring vertices still needs to be updated, thus preventing false holes during isosurface reconstruction.

[0104] Source 1 (new cut voxel neighborhood, i.e. the first candidate vertex set): decode the newly added cut voxel units (i.e. voxel units whose material occupancy identifier changes from the first identifier value to the second identifier value) from the received word-level increment. For each newly added cut voxel unit, mark all vertices within the narrowband width plus 1 around it as candidate vertices and add them to the first candidate vertex set.

[0105] Source 2 (adjacent vertices within the tool sweep AABB, i.e., the second candidate vertex set): Construct the axis-aligned bounding box (AABB) of the tool sweep during this cutting step. The AABB is determined based on the pose of the cutting tool at each cutting position, the cutting length of the tool, and the outward expansion of the tool radius. Traverse the vertices within the AABB and mark vertices that meet the following conditions as candidate vertices, adding them to the second candidate vertex set: Among the adjacent voxel elements of this vertex, at least one voxel element has a cut voxel marked as 1 (i.e., it has been cut).

[0106] Next, for each candidate vertex in the target candidate vertex set, the following update is performed: along the sweep path of the current cutting step, obtain a maximum of a preset number (e.g., 24) of posture sampling points, each posture corresponding to an inverse transformation matrix from world space to tool local space; for each posture, transform the world coordinates of the candidate vertex to the tool local coordinate system through the corresponding inverse transformation matrix, and calculate the analytical symbolic distance value of the vertex in the tool local coordinate system (different tool geometries such as ball head, flat bottom, tapered ball, etc. all have closed analytical expressions); obtain the minimum value d_min among the symbolic distance values ​​calculated under all postures; update the symbolic distance value of the vertex through the monotonic write-back rule as shown in Equation (2). This rule ensures that the symbolic distance value can only change monotonically in the direction of "closer to the removed surface" and will never be backfilled, thereby ensuring that the cumulative result of multi-step cutting is consistent with the result of a one-time global recalculation.

[0107] New SDF value = max(old SDF value, -d_min) (2)

[0108] Then, in the paused state or when the user requests a high-quality display, isosurface extraction is performed on the reconstructed distance field. Specifically, the Marching Cubes algorithm is called to traverse only the active cell set (i.e., cells within the narrow band) to generate isosurface triangular meshes; small connected component filtering is performed on the generated triangular meshes to remove isolated floating triangles; the processed isosurface meshes are output for high-quality display and measurement.

[0109] In an exemplary embodiment, step S201, constructing the voxel grid structure, may include:

[0110] Among multiple candidate voxel steps, a target voxel step is determined. The target voxel step is the smallest candidate voxel step among multiple candidate voxel steps that satisfies the condition that the total number of voxels is less than or equal to the target number threshold. The total number of voxels corresponding to the candidate voxel steps is determined based on the workpiece geometry and the candidate voxel steps. Based on the target voxel step and the workpiece geometry, multiple voxel units are determined and corresponding material occupancy identifiers are assigned to each voxel unit. Each material occupancy identifier is stored in a bit array. The bit array and each voxel unit constitute a voxel grid structure.

[0111] For example, firstly, the terminal can acquire the geometric dimensions of the workpiece, including the dimension L_x in the X-axis direction, the dimension L_y in the Y-axis direction, and the dimension L_z in the Z-axis direction. A candidate voxel step size sequence is set, comprising multiple candidate voxel step sizes arranged within a predetermined range with predetermined increments, such as an increasing sequence from 0.20 mm to 1.00 mm in 0.05 mm increments (from fine to coarse). A target number threshold N_budget is set, for example, 1.3 × 10⁻⁶. 7 The candidate voxel step size s is traversed in descending order of fineness. For each candidate voxel step size s, the total number of voxels N_total(s) under that candidate voxel step size is calculated using equation (3). The first candidate voxel step size s that satisfies N_total(s)≤N_budget is selected as the target voxel step size. This selection strategy is based on the actual three-axis dimension counting, avoiding the precision waste caused by the traditional one-cut-by-one-edge approach, and enabling thin plates or small workpieces to automatically select a finer step size.

[0112] N_total(s)=ceil(L_x / s)×ceil(L_y / s)×ceil(L_z / s) (3)

[0113] Subsequently, based on the target voxel step size s and the workpiece's geometry, the number of voxels Nx, Ny, and Nz along each axis are calculated, and an unsigned integer word array is allocated as a bit array. The total number of bits in this bit array is not less than Nx × Ny × Nz. A linear index mapping relationship to the three-dimensional voxel coordinates is established according to the scan order: fastest along the X-axis, second fastest along the Y-axis, and slowest along the Z-axis: lin = x + y · Nx + z · Nx · Ny. Each voxel unit corresponds to a unique bit in the bit array, with the word index w = lin div WordBits and the intra-word bit offset b = lin mod WordBits, where WordBits is the number of bits in each unsigned integer word.

[0114] Next, the global bit array is divided into a three-dimensional chunk grid, with each chunk being 32×32×32 voxel units in size. Each chunk contains 32 words × 32 rows × 32 layers = 1024 words. Each chunk is assigned an independent monotonically increasing sequence number for downstream modules to detect the loss or out-of-order nature of incremental data.

[0115] Then, all bits in the bit array are initialized to the first identifier value (e.g., binary 1), indicating that all voxel units are initially occupied by workpiece material.

[0116] In an exemplary embodiment, step S202 may further include:

[0117] During the traversal of each cutting position in the simulated machining path, the visual time cursor is advanced. If the cutting time cursor lags behind the visual time cursor, the time interval to be emitted within the current machining path segment is determined. Based on the sub-sampling step size within the machining path segment, the time interval to be emitted is divided into multiple sub-positions. For each sub-position, the corresponding cutting step instruction is emitted to the scheduler, and the cutting time cursor is advanced. The scheduler is used to package multiple consecutive received cutting step instructions into a batch message, and to merge multiple consecutive received pose synchronization instructions to obtain the target pose synchronization instruction. The batch message indicates multiple cutting positions in the simulated machining path; the target pose synchronization instruction indicates the pose of the cutting tool at the current cutting position.

[0118] For example, firstly, the main thread maintains two independent time cursors: a visual time cursor and a cutting time cursor. The visual time cursor is used to control the speed of UI (User Interface) display and tool animation, while the cutting time cursor is used to control the launch progress of the actual cutting calculation task.

[0119] Subsequently, in each rendered frame, the main thread advances the visual time cursor forward by a margin of min(actual frame interval, preset safety limit) × playback speed, where the preset safety limit can be set to 0.1 seconds to prevent excessively long single-frame jumps after stuttering. If the cutting time cursor lags behind the visual time cursor after the visual time cursor advances, a continuous completion operation is performed. Specifically, based on the current position of the cutting time cursor in the simulated machining path (timeline), the current path segment is determined; the time interval to be launched within the current path segment is calculated, starting from the current cutting time and ending at the smaller of the visual time and the segment's end time; the time interval to be launched is divided into multiple sub-positions according to a preset sub-sampling step size within the path segment (e.g., the time interval corresponding to a 0.4mm spatial step size converted based on the feed rate); for each sub-position, a cutting step instruction (containing the tool world matrix corresponding to that sub-position) is generated and sent to the scheduler, while simultaneously advancing the cutting time cursor to the time corresponding to that sub-position.

[0120] Next, the scheduler receives instructions from the main thread in a FIFO (First-In, First-Out) queue. These instructions include cutting step instructions and pose synchronization instructions. For cutting step instructions: when the head of the queue contains a cutting step instruction, the scheduler continuously retrieves up to a preset batch size B (e.g., 32 instructions), packages them into a single batch message, and sends it to the cutting task thread for execution, thus reducing cross-thread communication overhead. For pose synchronization instructions: the scheduler performs tail merging on consecutively received pose synchronization instructions, retaining only the latest instruction and discarding older ones to prevent pose synchronization storms.

[0121] In one exemplary embodiment, the workpiece cutting simulation method provided in this embodiment may further include:

[0122] In response to the receipt of the progress jump command, the cutting step command to be sent is determined according to the progress jump position indicated by the progress jump command; according to the reception time of each cutting step command to be sent, the cutting step command to be sent is sent to the scheduler; after the sending of each cutting step command to be sent is completed, the distance field reconstruction and isosurface extraction are performed on the material occupancy state of the voxel grid structure to obtain the isosurface mesh; according to the isosurface mesh, the simulation state of the workpiece is marked as completed.

[0123] For example, firstly, in response to a user-triggered progress jump instruction (e.g., dragging the playback progress bar to the end or jumping to a specified position), the main thread determines all pending cutting step instructions from the current cutting time to the target progress based on the progress jump position indicated by the progress jump instruction. These pending cutting step instructions are then sent to the scheduler in chronological order as quickly as possible, mapping the overall progress corresponding to this stage from 0% to 5%.

[0124] Subsequently, after sending the cutting step instructions in Phase 1, Phase 2 begins. The main thread continuously monitors the input queue depth of the cutting task threads. Using the initial queue depth at the start of Phase 1 as a baseline, the progress of this phase is calculated according to the inverse mapping relationship of "current queue depth / initial depth." That is, as the queue depth decays from its initial value to 0, the progress of this phase linearly increases from 5% to 85%. When the queue depth decays to 0, it indicates that all cutting calculation tasks have been completed, and Phase 2 ends.

[0125] Next, after the cutting task queue is emptied, Phase 3 begins. The main thread sends an "atomic emptying + reconstruction" request to the symbolic distance field reconstruction subsystem. The SDF reconstruction subsystem responds to this request, serially processing all backlogged incremental update tasks within it, completing the reconstruction of all pending voxel material occupancy states to the vertex symbolic distance field, and then calling the Marching Cubes algorithm to extract isosurface meshes from the reconstructed distance field, performing small connected component filtering post-processing. The overall progress for this phase advances from 85% to 100%.

[0126] Then, after Phase 3 is completed, Phase 4 begins. The SDF reconstruction subsystem asynchronously transmits the generated isosurface mesh back to the main thread. The main thread enters a waiting state, and only after the isosurface mesh actually arrives and is received by the main thread will the simulation playback status of the entire workpiece be officially marked as "completed". Before this, even if the progress of Phase 3 has been displayed as 100%, the playback status will remain as "calculating" or "rendering", and it is forbidden to display "completed" in advance.

[0127] Phase 4 is the core gating logic, which ensures that when the user sees the "Completed" label, the displayed screen is completely consistent with the final state of the simulation, avoiding the "false completion" phenomenon that occurs because the isosurface mesh has not yet been rendered to the screen.

[0128] In related technologies, CNC machining cutting simulation, as a key verification step after programming and before actual machining, is mainly used to realize functions such as overcutting and undercutting checks, collision and boundary crossing detection between tools and tool holders and workpieces / fixtures / machine tools, allowance analysis between processes, process optimization, and teaching preview. With the popularization of desktop CNC equipment (such as benchtop engraving and milling machines and five-axis machine tools for education), cutting simulation is no longer limited to running on professional workstations. Instead, it needs to achieve a real-time interactive frame rate of 20-60 FPS in ordinary laptops or even browser environments, while simultaneously supporting efficient simulation of 100-millimeter-level blanks at sub-millimeter voxel accuracy. This poses a severe challenge to both algorithm efficiency and memory usage.

[0129] To address the aforementioned needs, existing cutting simulation implementation solutions mainly include the following methods, each with its own technical limitations.

[0130] Firstly, Z-Map or Dexel (columnar voxel) methods are used, which discretize the workpiece into depth arrays or columnar intervals along a fixed direction. This approach is highly directional and primarily suitable for three-axis machining scenarios, but it lacks sufficient support for simulating arbitrary tool postures in five-axis machining. Furthermore, its topological representation capability is limited, making it difficult to accurately describe undercut or overhanging structures. If multi-directional Dexels are introduced to support complex topologies, memory usage increases linearly with the number of directions, significantly increasing resource overhead.

[0131] Secondly, a method based on triangular mesh Boolean operations is adopted, where the workpiece is represented by a triangular mesh, and the tool sweep body updates the mesh through constructing solid geometry (CSG) Boolean difference operations. In this type of approach, floating-point operations have poor robustness, and mesh self-intersection and degenerate triangle problems occur frequently; the time complexity of Boolean operations usually tends to O(N²), which can take several seconds for a single cut in large-size models, making it impossible to maintain interactive response; in addition, mesh degradation requires frequent repair, errors accumulate with the number of cutting steps, and topology maintenance is difficult.

[0132] Third, the traditional method of combining dense voxels with octrees is used, which represents the presence / absence of material using single-byte or multi-byte voxels. This method has a large memory overhead. For example, for a 100 mm cubic blank with a precision of 0.5 mm, byte storage requires about 8 MB, and four-byte storage requires 32 MB. At the same time, single-voxel operations can only process 1 bit of data, failing to utilize the CPU's word-level parallelism. In high-frequency cutting, the merging and splitting of octree leaf nodes incurs significant maintenance overhead, affecting update efficiency.

[0133] Fourth, a global signed distance field (SDF) volume field method is adopted, in which the workpiece is expressed as a dense or sparse SDF floating-point field, and the tool sweep volume is updated by maximum value calculation. In this type of method, each voxel is stored as a floating-point number, which increases the storage space by tens of times compared to single-bit representation; during the update, the tool distance of all SDF voxels within the tool bounding box needs to be calculated analytically, resulting in a large computational overhead; moreover, high-quality real-time rendering largely depends on GPU ray stepping, which limits cross-platform compatibility, and it is difficult to share the same processing pipeline for real-time feedback in playback mode and high-quality isosurface extraction in paused mode.

[0134] Fifth, some existing web-based or desktop JavaScript simulation solutions place the cutting core in a native module or a dedicated process, while open-source or pure script-based implementations mostly update voxels one by one in the script loop, with a single-step cutting time of hundreds of milliseconds, which is difficult to meet the interactive frame rate requirements.

[0135] It is evident that the cutting simulation methods in related technologies are inadequate in terms of algorithm efficiency, memory usage, topology representation capability, cross-platform compatibility, and real-time interactive performance, making it difficult to meet the dual requirements of high frame rate real-time feedback and fine simulation accuracy in desktop CNC scenarios.

[0136] In this regard, in one exemplary embodiment, such as Figure 3 As shown, a workpiece cutting simulation method is also provided, which may include the following steps:

[0137] Step S301: Initialize the voxel grid structure.

[0138] For example, the geometric dimensions of the workpiece are obtained. In a preset sequence of candidate voxel step sizes, each candidate step size is traversed in ascending order. For each candidate step size, the total number of voxels at that step size is calculated based on the workpiece's three-axis dimensions. The first candidate step size that satisfies the condition that the total number of voxels does not exceed a preset overall voxel count budget is selected as the target voxel step size. This selection strategy counts based on the actual three-axis dimensions, rather than cutting off the largest edge. Based on the target voxel step size and the workpiece's geometric dimensions, the number of voxels in each axis is determined, and a bit array consisting of unsigned integer words is allocated as the voxel grid structure. The voxel grid structure contains multiple voxel units, with one voxel unit corresponding to one bit in the bit array. A mapping relationship between linear indices and three-dimensional voxel coordinates is established, using a scan order that is fastest on the X-axis, followed by the Y-axis, and slowest on the Z-axis. The global bit array is divided into three-dimensional chunks of equal size. Each chunk contains a preset number of voxel units in each axis, and each chunk contains a preset number of words. Each chunk is assigned a unique, monotonically increasing sequence number for downstream modules to detect missing or out-of-order incremental data. All bits in the bit array are initialized to the first identifier value, indicating that all voxel units are initially filled with workpiece material. Simultaneously, the main thread generates a snapshot of the bit array, allowing other threads to read the material status without cross-thread communication.

[0139] Step S302: Baking and registering the tool sampling point template.

[0140] For example, based on the geometry of the cutting tool and a preset sampling density, multiple key points (i.e., sampling points) are sampled from the geometric surface or interior of the cutting tool to form a key point cloud. The sampling density satisfies the coverage completeness condition, i.e., the sampling interval does not exceed the voxel size divided by a preset constant. For the obtained key point sequence, the space-filling curve code of each key point is calculated, and the key point sequence is sorted in ascending order of the code to improve the memory locality of subsequent scattering write operations. The sorted key point cloud is registered to the cutting subsystem and obtains a corresponding template identifier for subsequent cutting steps. Cutting tools with different geometries, such as ball end mills, flat end mills, tapered ball end mills, and fillet end mills, are all uniformly represented by the key point cloud.

[0141] Step S303, cutting at each step.

[0142] For example, traversing each cutting position in the simulated machining path, for each cutting step, the following operations are performed:

[0143] First, the translation distance and attitude change angle between the pose at the current cutting position and the pose at the previous cutting position are obtained. If the translation distance does not exceed a preset target distance threshold and the attitude change angle does not exceed a preset target angle threshold, it is determined that no interpolation is needed, and a single cut is performed only at the current cutting position. Otherwise, a multi-pose sweep mode is entered: based on the translation distance and attitude change angle, the number of interpolation samples is calculated according to preset distance sampling step size and angle sampling step size, and this number is limited to a preset upper limit. Based on the calculated number of samples, between the previous cutting position and the current cutting position, linear interpolation is used to generate interpolated positions for the position components, and spherical linear interpolation is used to generate interpolated poses for the pose components. The interpolated positions and corresponding interpolated poses are combined into multiple sub-poses. If the control flag of the current cutting position indicates a hard discontinuity event (including but not limited to the first cut after playback pause, the first cut after progress jump, and the first cut after rapid movement), the number of interpolation samples is forcibly set to 1, and the interpolation process is disabled, and a single cut is performed only in the final state of the current cutting position.

[0144] Subsequently, a temporary tool bit array of the same size as the material bit array is maintained to store the tool influence mask for the current cutting position. A set is also maintained to record the word indices that were smudged in the previous step. At the start of each cutting step, only the word index in the set corresponding to the word in the tool bit array is reset to zero; there is no need to traverse the entire tool bit array.

[0145] Next, the world transformation matrix of the cutting tool at the current cutting position is obtained. The corresponding keypoint cloud is obtained based on the pre-registered template identifier. Using a pre-fused affine matrix, an affine transformation is performed on the local coordinates of each keypoint, calculating the integer index coordinates of that keypoint in the voxel grid in one step. The pre-fused affine matrix is ​​constructed by dividing each row of the world transformation matrix by the voxel step size, and subtracting the voxel grid origin from the translation component of the world transformation matrix, then dividing by the voxel step size to obtain the last column. The voxel element to which each keypoint falls is determined based on the calculated integer index coordinates. The corresponding bit is set in the tool bit array, and the word index of the word containing that voxel element is recorded (only when the word is set for the first time in this step). Keypoints that exceed the boundary are determined and discarded in one step through unsigned integer comparison. After all keypoints are processed, the set of voxel elements corresponding to the bits that are 1 in the tool bit array constitutes the tool influence mask of the cutting tool in the current pose.

[0146] Then, for each word covered by the tool-affected mask, obtain the currently stored material occupancy identifier word for that word. Perform the following operations in parallel at the word level: calculate the overlap mask, which is the bitwise AND result of the tool mask word and the material word. A bit that is 1 in the overlap mask indicates that the voxel unit simultaneously satisfies being covered by the tool-affected mask and having the current material occupancy identifier as the first identifier value; count the number of binary 1s in the overlap mask as the number of voxel units actually removed in this cutting step; perform word-level subtraction, updating the material word to the bitwise AND NOT result of the material word and the tool mask word, that is, batch updating the material occupancy identifier of the voxel units that meet the conditions to the second identifier value; record the word index and the corresponding overlap mask that are cleared in this step as the incremental entry for this step.

[0147] In the multi-pose sweep mode, all sub-poses undergo the aforementioned sparse zeroing, keypoint scattering, and word-level subtraction operations, but increments are not output initially. After all sub-poses are completed, all accumulated increment entries are output at once.

[0148] Step S304: Incremental protocol generation and transmission.

[0149] For example, all incremental entries generated in this cutting step are collected, each entry containing the cleared global word index and the corresponding clearing mask. The incremental entries are mapped from the global word space to the chunk word space, generating a chunk-level incremental protocol for downstream modules to consume. Specifically, for each global word index, the three-dimensional voxel coordinates corresponding to the start and end positions of the word in the bit array are calculated using arithmetic decoding, and then the three-dimensional coordinates of the chunk to which the word belongs and its local coordinates within the chunk are calculated. If the word does not cross the chunk's boundary in the X direction, an entry containing the chunk identifier, the word index within the chunk, and the clearing mask is directly output. If the word crosses the chunk's boundary in the X direction, the clearing mask is split into a low-order part and a high-order part: the low-order part falls into the left chunk, and the high-order part falls into the right chunk, resulting in two separate entries. During splitting, it is ensured that the bitwise OR result of the low-order part and the high-order part equals the original clearing mask, achieving lossless bit-level splitting. For the rare cases that cross the boundaries of the Y or Z directions, a bitwise scanning method is used to decompose each entry bit by bit, mapping each bit independently to its corresponding chunk and word. All mapped entries are sorted by chunk identifier and word index within the chunk, then a single linear scan is performed, and the clear mask of entries with the same key is cleared and merged bitwise. The merged result is output as a flattened word array for downstream consumption.

[0150] Step S305: The main thread consumes the incremental amount.

[0151] For example, the main thread receives the chunk-level incremental protocol output in step S304 and executes the following three consumption paths in parallel:

[0152] Path 1: Based on the clear mask in the incremental protocol, synchronously update the bit array mirror maintained by the main thread to maintain the consistency of material occupancy status.

[0153] Path 2: Identify the chunks affected by the incremental protocol, perform incremental meshing on the voxel elements in the affected chunks, and generate triangular meshes for real-time display. This path only processes voxel elements where the material occupancy indicator changes, and does not traverse the entire voxel grid.

[0154] Path 3: Enqueue the incremental protocol into the task queue of the symbolic distance field reconstruction subsystem, along with the sweep path information of the current cutting step and the parsing parameters of the cutting tool, for asynchronous consumption by independent reconstruction tasks.

[0155] Step S306, incremental narrowband signed distance field reconstruction.

[0156] For example, in a standalone reconstruction task, the incremental protocol for path three enqueuing in step S305 is received, and incremental updates of the narrowband symbolic distance field and isosurface reconstruction are performed. Specifically:

[0157] First, maintain the narrowband symbolic distance field data structure. Specifically, maintain a floating-point array of vertex symbolic distance fields, which corresponds one-to-one with the corner points of the voxel raster. Simultaneously maintain the array of cut voxel labels and the set of active cells. Set the narrowband width, and keep vertices outside the narrowband at a preset maximum negative value.

[0158] Subsequently, incremental scheduling and merging are performed. Specifically, consecutively received incremental updates are merged: several consecutive incremental steps with the same cutting tool and tool parameters are merged into a single update task. Backlogged update tasks are periodically cleared according to a preset cycle, with each clearing operation limited by a preset time budget to avoid blocking the main thread rendering. The number of pending tasks is controlled to not exceed a preset limit. When the number of backlogged update tasks exceeds the preset backlog limit, the old task at the head of the queue is discarded and an alarm is issued. There is a limit to the number of vertices processed in a single update step; any excess is carried over to the next compensation step.

[0159] Next, a candidate vertex set is generated using a dual-source vertex candidate mechanism. Specifically, for each incremental update, candidate vertices are generated from the following two sources:

[0160] First source (newly removed voxel neighborhood): Decode the newly added removed voxel units in this step from the incremental protocol, and mark the vertices within a preset number of layers around each newly added removed voxel unit as candidate vertices.

[0161] Second source (adjacent vertices within the tool sweep bounding box): Construct a world-axis aligned bounding box for the tool sweep based on the sweep path in this step, traverse vertices within this bounding box, and mark at least one vertex among the adjacent voxels that has been marked as cut as a candidate vertex.

[0162] By merging the candidate vertices from the two sources mentioned above, we obtain the target candidate vertex set.

[0163] Then, the vertex symbolic distance value is updated using a monotonically write-back rule. Specifically, for each candidate vertex in the target candidate vertex set, multiple pose sampling points are obtained along the sweep path of this step. Each pose corresponds to an inverse transformation matrix from world space to tool local space. For each pose, the world coordinates of the candidate vertex are transformed to the tool local coordinate system, and the analytical symbolic distance value of the vertex in the tool local coordinate system is calculated. The minimum value among the symbolic distance values ​​calculated under all poses is taken, and the symbolic distance value of the vertex is updated according to the monotonically write-back rule: the negative of the minimum value is compared with the currently stored old symbolic distance value, and the larger one is taken as the new symbolic distance value. This rule ensures that the symbolic distance value can only change in the direction closer to the removed surface and is never backfilled.

[0164] Finally, paused-state atomic reconstruction and isosurface extraction are performed. Specifically, when a user triggers a pause operation, in response to the main thread's atomic emptying request, all backlogged incremental update tasks are processed serially until the queue is empty. After all processing is complete, the isosurface extraction algorithm is called, traversing only the active cell set to generate isosurface triangular meshes. Small connected component filtering is performed on the generated triangular meshes to remove isolated floating triangles. The processed isosurface meshes are output to the main thread for high-quality display and measurement.

[0165] Step S307: Knife path playback and dual timelines.

[0166] For example, during the traversal of the simulated machining path, the main thread executes the following toolpath playback and scheduling operations in parallel:

[0167] First, dual timeline cursor maintenance. Specifically, the main thread maintains two independent time cursors: a visual time cursor and a cutting time cursor. The visual time cursor is used to control the progression of the displayed image, while the cutting time cursor is used to control the launch progress of the actual cutting calculation task.

[0168] Subsequently, continuous completion is performed for each frame. Specifically, in each rendered frame, the main thread advances the visual time cursor forward by a preset amount. After the visual time cursor advances, if the cutting time cursor lags behind the visual time cursor, a continuous completion operation is performed: the current path segment is determined based on the current position of the cutting time cursor in the simulated machining path, the time interval to be emitted from the current cutting time to the visual time within that path segment is calculated, and the time interval to be emitted is divided into multiple sub-positions according to the preset sub-sampling step size within that path segment. A cutting step instruction is generated for each sub-position and sent to the scheduler, while simultaneously advancing the cutting time cursor.

[0169] Next, the scheduler performs batch processing and merging. Specifically, the scheduler receives instructions in a first-in-first-out queue, which includes cutting step instructions and pose synchronization instructions. For cutting step instructions, when the head of the queue contains a cutting step instruction, the scheduler continuously retrieves up to a preset batch size of subsequent cutting step instructions, packages them into a single batch message, and sends it to the cutting task for execution. For pose synchronization instructions, the scheduler performs tail merging on the continuously received pose synchronization instructions, retaining only the latest pose synchronization instruction.

[0170] Then, jump to the completed multi-stage progress gating. Specifically, in response to the progress jump instruction, execute the multi-stage gating process:

[0171] Phase 1: Based on the jump position indicated by the progress jump command, quickly send all pending cutting step commands from the current cutting time to the target progress.

[0172] Phase 2: Monitor the depth of the cutting task queue until the queue depth decays to zero.

[0173] The third stage involves calling the symbolic distance field reconstruction subsystem to perform atomic emptying and reconstruction, completing isosurface extraction and small connected component filtering.

[0174] Fourth stage: Only after the isosurface mesh actually arrives at the main thread and is received by the main thread will the playback status of the workpiece be marked as completed.

[0175] Step S308: Multi-resolution bridging of a fixed reference grid.

[0176] For example, the cutting subsystem internally constructs a bit array and performs all cutting calculations according to a fixed reference voxel step size at compile time. When the user-configured voxel step size differs from this reference voxel step size, the following scaling operation is performed at the bridging layer: a scaling factor is calculated, which is equal to the reference voxel step size divided by the user-configured voxel step size. The workpiece geometry uploaded to the cutting subsystem is multiplied by this scaling factor, so that the workpiece size from the cutting subsystem's perspective is scaled proportionally. The translation component in the cutting matrix uploaded to the cutting subsystem in each frame is multiplied by this scaling factor, so that the tool position from the cutting subsystem's perspective is scaled proportionally. The rotation components in the matrix remain unchanged. Based on this scaling, the voxel index obtained by dividing the tool position from the user's perspective by the user's step size is consistent with the voxel index obtained by dividing the scaled tool position from the cutting subsystem's perspective by the reference step size, ensuring that the simulation results are free of geometric distortion under different user precision configurations.

[0177] This embodiment employs a bit array voxel structure and word-level parallel Boolean operations, combined with pre-fused affine matrices and Morton sorting to optimize keypoint scattering. This enables parallel multi-voxel clearing within a single instruction cycle, significantly improving cutting computation efficiency. Incremental protocol generation avoids the overhead of dynamic hash table allocation by utilizing fast path arithmetic mapping and a sorted linear merging strategy. The batch scheduler transmits consecutive cutting steps in packets, greatly reducing cross-thread communication latency and meeting real-time response requirements in high-frequency cutting scenarios. Extremely compressed storage of each bit of the bit array per voxel, combined with multi-resolution bridging of a fixed reference grid, allows a single binary system to adapt to various user precisions, saving memory and eliminating multiple sets of data redundancy. Regarding simulation accuracy, multi-pose sweep interpolation and dual-time-axis continuous completion work together to prevent missed cuts at arbitrary feed rates and playback speeds. Word-level subtraction operations satisfy the mathematical equivalence of set difference subtraction, ensuring accurate material removal. Simultaneously, narrowband symbol distance field reconstruction uses dual-source vertex candidate and monotonic write-back rules to update the distances of neighboring symbols in the removed area in real time, eliminating false holes in the isosurface from the root. Dual display modes coexist, low-latency incremental meshing enables real-time preview, high-quality isosurface extraction combined with paused-state atomic reconstruction and small connected component filtering provides a smooth and accurate model when the user pauses or navigates. Furthermore, a four-stage progress gating system uses mesh arrival as a completion marker, fundamentally preventing UI false completion issues. All core calculations are based on bitwise operations and unsigned integers, ensuring reproducibility with consistent bit-level performance across platforms.

[0178] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0179] Based on the same inventive concept, this application also provides a workpiece cutting simulation device for implementing the workpiece cutting simulation method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more workpiece cutting simulation device embodiments provided below can be found in the limitations of the workpiece cutting simulation method described above, and will not be repeated here.

[0180] In one exemplary embodiment, such as Figure 4 As shown, a workpiece cutting simulation device is provided, which includes the following modules:

[0181] Module 401 is used to construct a voxel grid structure; the voxel grid structure includes multiple voxel units; the material occupancy identifier corresponding to the voxel unit is used to indicate whether the voxel unit is occupied by the workpiece.

[0182] Traversal module 402 is used to traverse each cutting position in the simulated machining path and determine the tool influence mask based on the geometry of the cutting tool and the pose of the cutting tool at the current cutting position. The tool influence mask is used to indicate the set of voxel units covered by the cutting tool in the pose. The cutting tool is used to cut the workpiece.

[0183] The update module 403 is used to update the material occupancy identifier corresponding to each voxel cell in the voxel grid structure that intersects with the tool influence mask, based on the tool influence mask.

[0184] Display module 404 is used to switch to a first display mode or a second display mode according to the simulation state of the workpiece during the cutting simulation. In the first display mode, the voxel elements whose material occupancy marks have changed are incrementally meshed to obtain triangular meshes and the triangular meshes are displayed. In the second display mode, the distance field reconstruction and isosurface extraction of the material occupancy state of the voxel grid structure are performed to obtain isosurface meshes and the isosurface meshes are displayed.

[0185] In an exemplary embodiment, the traversal module 402 is further configured to determine multiple sampling points of the cutting tool in the current cutting position based on the geometry of the cutting tool and the pose of the cutting tool at the current cutting position; transform each sampling point into the space where the voxel grid structure is located, and determine the voxel unit into which each sampling point falls; and determine the tool influence mask based on the voxel unit into which each sampling point falls.

[0186] In an exemplary embodiment, the traversal module 402 is further configured to, before determining the tool influence mask based on the geometry of the cutting tool and the pose of the cutting tool at the current cutting position, acquire the displacement and attitude change between the pose of the cutting tool at the current cutting position and the pose of the cutting tool at the previous cutting position; if the displacement is not less than a target distance threshold or the attitude change is not less than a target angle threshold, determine the number of attitude samples based on the displacement and attitude change; and perform linear interpolation between the current cutting position and the previous cutting position of the cutting tool based on the number of attitude samples, and perform spherical linear interpolation between the pose of the cutting tool at the current cutting position and the pose of the cutting tool at the previous cutting position.

[0187] In an exemplary embodiment, the update module 403 is further configured to, for each voxel cell in the voxel grid structure that intersects with the tool influence mask, obtain the word index corresponding to the word in which the voxel cell is located and the bit offset of the voxel cell in the word; if the voxel cell meets the mask clearing condition, update the material occupancy identifier corresponding to the voxel cell to a first identifier value according to the word index and the bit offset; the mask clearing condition includes that the tool influence mask contains the voxel cell and the material occupancy identifier stored in the voxel cell is a second identifier value; the first identifier value indicates that the voxel cell is not occupied by the workpiece; the second identifier value indicates that the voxel cell is occupied by the workpiece.

[0188] In an exemplary embodiment, the display module 404 is further configured to: determine a first candidate vertex set based on the removed voxel units; the removed voxel units include voxel units whose material occupancy identifiers have changed; determine a second candidate vertex set based on voxel units in the voxel grid structure that intersect with each bounding box corresponding to the cutting tool and are adjacent to the removed voxel units; the bounding boxes include axis-aligned bounding boxes of the cutting tool at each cutting position; determine a target candidate vertex set based on the first candidate vertex set and the second candidate vertex set; for each candidate vertex in the target candidate vertex set, determine a first signed distance value of the cutting tool at each cutting position based on the pose of the cutting tool at each cutting position, update the second signed distance value of the candidate vertex based on the minimum value among the first signed distance values, and obtain a reconstructed distance field; and extract isosurfaces from the reconstructed distance field to obtain an isosurface mesh.

[0189] In an exemplary embodiment, the construction module 401 is further configured to determine a target voxel step size among multiple candidate voxel step sizes; the target voxel step size is the smallest candidate voxel step size among multiple candidate voxel step sizes that satisfies the condition that the total number of voxels is less than or equal to a target number threshold; the total number of voxels corresponding to the candidate voxel step size is determined based on the workpiece geometry and the candidate voxel step size; multiple voxel units are determined based on the target voxel step size and the workpiece geometry, and a corresponding material occupancy identifier is assigned to each voxel unit; each material occupancy identifier is stored in a bit array; the bit array and each voxel unit constitute a voxel grid structure.

[0190] In an exemplary embodiment, the traversal module 402 is further configured to advance the visual time cursor during the traversal of each cutting position in the simulated machining path; determine the time interval to be emitted within the current machining path segment when the cutting time cursor lags behind the visual time cursor; divide the time interval to be emitted into multiple sub-positions according to the sub-sampling step size within the machining path segment; for each sub-position, emit the cutting step instruction corresponding to the sub-position to the scheduler and advance the cutting time cursor; the scheduler is configured to package the received multiple consecutive cutting step instructions into a batch message, and to merge the received multiple consecutive pose synchronization instructions to obtain a target pose synchronization instruction; the batch message is used to indicate multiple cutting positions in the simulated machining path; the target pose synchronization instruction is used to indicate the pose of the cutting tool at the current cutting position.

[0191] In an exemplary embodiment, the workpiece cutting simulation device provided in this embodiment may further include a progress jump module. The progress jump module is configured to, in response to the receipt of a progress jump command, determine the cutting step command to be sent based on the progress jump position indicated by the progress jump command; send each cutting step command to be sent to the scheduler according to the reception time of each cutting step command to be sent; after completing the sending of each cutting step command to be sent, perform distance field reconstruction and isosurface extraction on the material occupancy state of the voxel grid structure to obtain an isosurface mesh; and mark the simulation state of the workpiece as completed based on the isosurface mesh.

[0192] Each module in the aforementioned workpiece cutting simulation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0193] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a workpiece cutting simulation method. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0194] Those skilled in the art will understand that Figure 5The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0195] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0196] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.

[0197] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0198] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0199] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0200] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0201] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A workpiece cutting simulation method, characterized in that, The method includes: Construct a voxel grid structure; the voxel grid structure includes multiple voxel units; the material occupancy identifier corresponding to the voxel unit is used to indicate whether the voxel unit is occupied by a workpiece; Traversing each cutting position in the simulated machining path, a tool influence mask is determined based on the geometry of the cutting tool and its pose at the current cutting position. The tool influence mask indicates the set of voxel units covered by the cutting tool in the given pose. The cutting tool is used to cut the workpiece. For each voxel cell in the voxel grid structure that intersects with the tool influence mask, update the material occupancy identifier corresponding to the voxel cell according to the tool influence mask; During the cutting simulation, the simulation mode is switched to either the first display mode or the second display mode according to the simulation state of the workpiece. In the first display mode, the voxel units whose material occupancy indicators have changed are incrementally meshed to obtain triangular meshes, and the triangular meshes are displayed. In the second display mode, the material occupancy state of the voxel grid structure is reconstructed by distance field and extracted by isosurface to obtain isosurface meshes, and the isosurface meshes are displayed.

2. The method according to claim 1, characterized in that, Determining the tool influence mask based on the geometry of the cutting tool and its pose at the current cutting position includes: Based on the geometry of the cutting tool and its pose at the current cutting position, determine multiple sampling points of the cutting tool in the given pose; Transform each of the sampling points into the space where the voxel grid structure is located, and determine the voxel unit into which each of the sampling points falls; The tool influence mask is determined based on the voxel unit into which each sampling point falls.

3. The method according to claim 2, characterized in that, Before determining the tool influence mask based on the geometry of the cutting tool and the pose of the cutting tool at the current cutting position, the method further includes: Obtain the displacement and attitude change of the cutting tool between its pose at the current cutting position and its pose at the previous cutting position; If the displacement is not less than the target distance threshold or the attitude change is not less than the target angle threshold, the number of attitude samples is determined based on the displacement and the attitude change. Based on the number of attitude samples, linear interpolation is performed between the current cutting position and the previous cutting position of the cutting tool, and spherical linear interpolation is performed between the pose of the cutting tool at the current cutting position and the pose of the cutting tool at the previous cutting position.

4. The method according to claim 1, characterized in that, The step of updating the material occupancy identifier corresponding to each voxel cell in the voxel grid structure that intersects with the tool influence mask, based on the tool influence mask, includes: For each voxel cell in the voxel grid structure that intersects with the tool influence mask, obtain the word index corresponding to the word where the voxel cell is located and the bit offset of the voxel cell in the word; When the voxel unit meets the mask clearing condition, the material occupancy identifier corresponding to the voxel unit is updated to a first identifier value according to the word index and the bit offset; the mask clearing condition includes the tool influence mask containing the voxel unit and the stored material occupancy identifier of the voxel unit being a second identifier value; the first identifier value indicates that the voxel unit is not occupied by the workpiece; the second identifier value indicates that the voxel unit is occupied by the workpiece.

5. The method according to claim 1, characterized in that, The process of reconstructing the distance field and extracting isosurfaces from the material occupancy state of the voxel grid structure to obtain an isosurface mesh includes: Based on the removed voxel units, a first candidate vertex set is determined; the removed voxel units include voxel units whose material occupancy identifier has changed. A second set of candidate vertices is determined based on the voxel cells in the voxel grid structure that intersect with each bounding box corresponding to the cutting tool and are adjacent to the cut voxel cells; the bounding box includes the axis-aligned bounding box of the cutting tool at each of the cutting positions; Based on the first candidate vertex set and the second candidate vertex set, determine the target candidate vertex set; For each candidate vertex in the target candidate vertex set, a first signed distance value of the cutting tool at each cutting position is determined based on the pose of the cutting tool at each cutting position. The second signed distance value of the candidate vertex is updated based on the minimum value among the first signed distance values ​​to obtain the reconstructed distance field. The reconstructed distance field is subjected to isosurface extraction to obtain an isosurface mesh.

6. The method according to claim 1, characterized in that, The construction of the voxel grid structure includes: Among multiple candidate voxel step sizes, a target voxel step size is determined; the target voxel step size is the smallest candidate voxel step size among the multiple candidate voxel step sizes that satisfies the condition that the total number of voxels is less than or equal to a target number threshold; the total number of voxels corresponding to the candidate voxel step size is determined based on the geometric dimensions of the workpiece and the candidate voxel step size. Based on the target voxel step size and the geometric dimensions of the workpiece, multiple voxel units are determined and corresponding material occupancy identifiers are assigned to each voxel unit; each material occupancy identifier is stored in a bit array; the bit array and each voxel unit constitute a voxel grid structure.

7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: The visual time cursor is advanced as it traverses each cutting position in the simulated machining path. When the cutting time vertex lags behind the visual time vertex, the time interval to be launched within the current machining path segment is determined; Based on the sub-sampling step size within the processing path segment, the time interval to be launched is divided into multiple sub-positions; For each sub-position, a cutting step command corresponding to the sub-position is sent to the scheduler, and the cutting time cursor is advanced; the scheduler is used to package multiple consecutive cutting step commands received into a batch message, and to merge multiple consecutive pose synchronization commands received to obtain a target pose synchronization command; the batch message is used to indicate multiple cutting positions in the simulated machining path; the target pose synchronization command is used to indicate the pose of the cutting tool at the current cutting position.

8. The method according to claim 7, characterized in that, The method further includes: In response to receiving a progress jump command, the cutting step command to be sent is determined according to the progress jump position indicated by the progress jump command; Based on the reception time of each of the cutting step instructions to be sent, send each of the cutting step instructions to be sent to the scheduler; After sending the cutting step commands to be sent, the distance field is reconstructed and the isosurface is extracted for the material occupancy state of the voxel grid structure to obtain the isosurface mesh. Based on the isosurface mesh, the simulation state of the workpiece is marked as completed.

9. A workpiece cutting simulation device, characterized in that, The device includes: A construction module is used to construct a voxel grid structure; the voxel grid structure includes multiple voxel units; the material occupancy identifier corresponding to the voxel unit is used to indicate whether the voxel unit is occupied by a workpiece; The traversal module is used to traverse each cutting position in the simulated machining path, and determine the tool influence mask based on the geometry of the cutting tool and the pose of the cutting tool at the current cutting position; the tool influence mask is used to indicate the set of voxel units covered by the cutting tool in the pose; the cutting tool is used to cut the workpiece. The update module is used to update the material occupancy identifier corresponding to each voxel unit in the voxel grid structure that intersects with the tool influence mask, according to the tool influence mask. The display module is used to switch to a first display mode or a second display mode according to the simulation state of the workpiece during the cutting simulation. In the first display mode, the voxel units whose material occupancy indicators have changed are incrementally meshed to obtain triangular meshes, and the triangular meshes are displayed. In the second display mode, the material occupancy state of the voxel grid structure is reconstructed by distance field and the isosurface is extracted to obtain isosurface meshes, and the isosurface meshes are displayed.

10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.