Milling simulation method and system based on multithreading and GPU acceleration

By employing a multi-threaded and GPU-accelerated milling simulation method, locally reconstructing the triangular facet model and optimizing resource allocation, the problems of long simulation time and low efficiency in existing technologies are solved, achieving efficient milling simulation.

CN122046575APending Publication Date: 2026-05-15HUAZHONG UNIV OF SCI & TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUAZHONG UNIV OF SCI & TECH
Filing Date
2026-01-29
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing milling simulation methods are limited in accuracy and speed by hardware performance, and using only CPU or GPU cannot fully accelerate each process, resulting in long simulation time and low efficiency.

Method used

A milling simulation method based on multithreading and GPU acceleration is adopted. Through Boolean operations between the tool sweep body and the workpiece model, the triangular patch model of the area to be reconstructed is locally reconstructed. Multithreaded parallel computing and GPU acceleration technology are used to optimize resource allocation.

Benefits of technology

It significantly improves the computational efficiency of milling simulation, shortens simulation time, increases machining accuracy and production efficiency, and reduces computational latency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122046575A_ABST
    Figure CN122046575A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field related to milling, and discloses a milling simulation method and system based on multithreading and GPU acceleration. The method comprises the following steps: S1, performing Boolean operation on a Tri-Dexel model of a workpiece and a tool swept volume formed after processing an (N-1) th row of codes to obtain a Tri-Dexel data set changed in the operation process; s2, determining an area needing to be reconstructed in the Tri-Dexel model after the (N-1) th row of codes are processed, and performing surface reconstruction on the area; s3, combining the triangular patch model of the to-be-reconstructed region with the triangular patch model of the non-reconstructed region to obtain a triangular patch model of the Tri-Dexel model after processing of the Nth row of codes; and S4, if N = N + 1, returning to the step S1 until all G codes are processed. According to the invention, the milling simulation efficiency is improved, and the simulation time is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of milling-related technology, and more specifically, relates to a milling simulation method and system based on multithreading and GPU acceleration. Background Technology

[0002] To meet the multi-dimensional requirements of high-tech industries such as aerospace, automotive, and shipbuilding in the manufacturing sector, including the complexity of component structures, product quality, and production cycles, CNC machining technology has rapidly evolved from three-axis to five-axis machining. However, the rotational motion of the cutting tool in five-axis machining leads to complex processes and difficulties in ensuring accuracy, which can easily cause safety hazards and losses in production efficiency during the machining design and actual production stages. Therefore, it is essential to simulate the entire production process before actual machining.

[0003] Numerical control machining geometric simulation technology relies on the knowledge of computer graphics and integrates technologies such as 3D modeling, physical simulation, and graphics rendering. Its purpose is to simulate the machining process and results of real-world CNC machine tools. By creating a virtual machining environment, it uses CNC code to simulate and drive the machine tool's movement, dynamically displays the relative positional relationship between the machine tool, cutting tool, and workpiece, and displays the cutting status of the workpiece in real time.

[0004] The main problems with current milling simulation methods include: 1) Existing simulation methods are limited in accuracy and speed by hardware performance, resulting in limited simulation time and machining accuracy; 2) Existing simulation methods only use a single CPU or GPU to improve the efficiency of key steps, failing to fully accelerate each step of the geometric simulation process. Therefore, there is an urgent need for a method that can improve the efficiency of milling simulation and shorten simulation time. Summary of the Invention

[0005] In view of the above-mentioned defects or improvement needs of the existing technology, the present invention provides a milling simulation method and system based on multi-threading and GPU acceleration, which solves the problems of low efficiency and long time in milling simulation.

[0006] To achieve the above objectives, according to one aspect of the present invention, a milling simulation method based on multithreading and GPU acceleration is provided, the method comprising the following steps: S1 The tool moves according to the Nth line of G code in the CNC program, and the space it sweeps forms the tool sweep body, which in turn shapes the Tri-Dexel model T of the workpiece formed after machining by the (N-1)th line of code. N-1 Boolean operations are performed on the Tri-Dexel model of the tool sweep body to obtain the Tri-Dexel model T after machining by the Nth line of code. N The Tri-Dexel data set A that changes during the operation; S2 determines the Tri-Dexel model T formed after processing by the (N-1)th line of code based on the Tri-Dexel dataset A. N-1 The region that needs to be reconstructed is then reconstructed to obtain a triangular patch model of the region that needs to be reconstructed. S3 compares the triangular patch model of the region to be reconstructed with the Tri-Dexel model T. N-1 The triangular facet models of the unreconstructed regions are combined to obtain the Tri-Dexel model T after processing by the Nth line of code. N A triangular facet model; S4 N=N+1, return to step S1, until all G-code processing is complete.

[0007] More preferably, in step S2, the region to be reconstructed is obtained according to the following steps: The Tri-Dexel model T is bounded by a bounding box. N-1 Enclose the bounding box by dividing it into multiple blocks and determining the Dexel endpoints contained in each block. Using the Tri-Dexel dataset A and model T N-1 Compare and determine model T N-1 Blocks that need to be reconstructed; Determine the positional relationship between each Dexel endpoint in the block to be reconstructed and the voxels in the block: When the endpoint of a Dexel is located on the edge of a voxel, the voxels sharing that edge need to be reconstructed. When the endpoint of a Dexel is located at the vertex of a voxel, the voxels sharing that vertex need to be reconstructed. Otherwise, do not rebuild.

[0008] More preferably, the steps for determining the block to be reconstructed are as follows: When the Dexel endpoints in the Tri-Dexel dataset A are related to model T N-1 When the number of endpoints at corresponding positions in the model T is different, N-1 The Dexel in the code is broken, and the block containing the breakpoint and the blocks between the breakpoints need to be reconstructed. When the Dexel endpoints in the Tri-Dexel dataset A are related to model T N-1 When the number of endpoints at corresponding positions in A is the same, when the position of any endpoint AI of the Dexel line segment in A changes, the block containing endpoint AI, the block between endpoint AI and endpoint C, and the block containing endpoint C all need to be reconstructed, where C is the model T. N-1 The point that corresponds to the endpoint AI position.

[0009] More preferably, when determining the positional relationship between each Dexel endpoint in the block to be reconstructed and the voxels in the block to be reconstructed, the sampling rate of the Dexel is reduced by using an interval sampling method.

[0010] More preferably, for the voxels to be reconstructed, the Marching Cubes algorithm is used to connect the endpoints of each voxel to form triangular patches, thereby obtaining the triangular patch model of the region to be reconstructed.

[0011] More preferably, when N=1, the workpiece formed after processing by the (N-1)th line of code is the workpiece blank. The Tri-Dexel model of the workpiece blank or the tool sweep body is obtained by obtaining the Dexel model in one direction one by one until the Dexel model in three directions is obtained, that is, the required Tri-Dexel model is obtained.

[0012] More preferably, the steps for obtaining the Dexel model of any direction j of the blank or tool sweep body are as follows: Construct the bounding box of the triangular facet model of the blank or tool swept body; Divide the plane in any direction j into multiple grids. A ray is emitted from each grid point. The ray intersects the bounding box of the blank or tool sweep body. The line segment formed by the line connecting the entry point and exit point of the ray in the bounding box is a Dexel. All Dexels formed by all rays are the Dexel model in any direction j.

[0013] According to another aspect of the present invention, a system for performing milling simulation using the above-described multi-threaded and GPU-accelerated method is provided. The system includes a first thread, a second thread, and a third thread, wherein: The first thread includes a Tri-Dexel model module and a Boolean operation module. The Tri-Dexel model module is used to convert the triangular facet model of the workpiece and the tool swept body into a Tri-Dexel model, and the Boolean operation module is used to perform Boolean operations on the Tri-Dexel model of the workpiece and the tool swept body. The second thread is used to determine the reconstruction region based on the data set obtained by the first thread, and to reconstruct the reconstruction region to obtain a triangular patch model; The third thread is used to display the triangular facet model from the second thread.

[0014] According to another aspect of the present invention, a milling simulation system based on multithreading and GPU acceleration is provided, which is used to implement the milling simulation method based on multithreading and GPU acceleration described above.

[0015] According to another aspect of the invention, a computer storage medium is provided that stores a computer program thereon, which, when executed, is used to implement the above-described multi-threaded and GPU-accelerated milling simulation method.

[0016] In summary, the technical solutions conceived by this invention have the following beneficial effects compared with the prior art: 1. This invention utilizes the Tri-Dexel model T processed from the Nth line of code. N The local part is reconstructed, and then the reconstructed part is compared with the Tri-Dexel model T. N-1 Combining them to form the Tri-Dexel model T N The triangular patch model, instead of directly using the Tri-Dexel model T N Transform it into a triangular patch model to reduce the complexity of the Tri-Dexel model T. N The computational cost of reconstructing the entire system.

[0017] 2. This invention first determines the blocks that need to be reconstructed, then determines the voxels that need to be reconstructed within the blocks, and gradually determines the objects that need to be reconstructed, thereby reducing the number of voxels that need to be reconstructed, and thus achieving the purpose of reducing data size and shortening reconstruction time.

[0018] 3. When determining the voxels that need to be reconstructed, this invention performs interval sampling on Dexel to reduce the number of voxels that need to be reconstructed. At the same time, during reconstruction, a basic block that needs to be reconstructed by combining multiple voxels is reconstructed using triangular facets, thereby improving computational efficiency and shortening computation time from multiple dimensions.

[0019] 4. By employing multi-threaded parallel computing and GPU acceleration technology, this invention achieves efficient resource allocation for each module in the milling simulation process, thereby significantly improving overall computing efficiency and shortening simulation time. Attached Figure Description

[0020] Figure 1 This is a flowchart illustrating a milling simulation method based on multithreading and GPU acceleration, constructed according to a preferred embodiment of the present invention.

[0021] Figure 2 This is a schematic diagram of the workpiece blank and the tool sweep body triangular facet model structure constructed according to a preferred embodiment of the present invention, wherein (a) is the triangular facet model of the tool sweep body, and (b) is the Tri-Dexel model of the tool sweep body.

[0022] Figure 3This is a schematic diagram of the workpiece structure displayed in the third thread during the workpiece milling process according to a preferred embodiment of the present invention, wherein (a) is the display effect during the machining process and (b) is the machining result diagram.

[0023] Figure 4 This is a schematic diagram of the structure of voxels and base blocks in the surface reconstruction process constructed according to a preferred embodiment of the present invention.

[0024] Figure 5 This is a flowchart of surface reconstruction constructed according to a preferred embodiment of the present invention.

[0025] Figure 6 This is a schematic diagram of the principle of a determined reconstructed block constructed according to a preferred embodiment of the present invention. (a) is the Tri-Dexel model T. N-1 A schematic diagram illustrating the determination of blocks requiring reconstruction when the number of Dexel endpoints changes in the model. (b) shows the Dexel at T. N A schematic diagram illustrating the determination of blocks requiring reconstruction when the number of endpoints in the model remains unchanged.

[0026] Figure 7 This is a schematic diagram of the principle of determining the voxel to be reconstructed according to a preferred embodiment of the present invention. (a) The Dexel endpoint is located at the voxel vertex, and (b) The Dexel endpoint is located on the voxel edge. Detailed Implementation

[0027] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.

[0028] like Figure 1 As shown, a milling simulation method based on multithreading and GPU acceleration includes the following steps: For the milling process, the following data needs to be obtained: (1) CNC program: import CNC machining G code and parse the G code; specifically, after reading the NC file, traverse each line of G code, parse and save the instruction type of the G code through the positioning character, obtain information such as feed rate, displacement, rotation angle, and determine whether the tool axis vector has changed, whether the motion is linear motion, arc motion or full circle motion, and whether the rotation radius of the tool is less than the tool radius.

[0029] (2) Tool Parameters: The tool type is ATP tool, mainly common flat end mills, ball end mills, and toroidal cutters. The tool is constructed by inputting the tool parameters. Specifically, the input parameters include tool type, tool radius, fillet radius, total tool length, tool bottom cone angle, top line discretization accuracy, side line discretization accuracy, and arc discretization accuracy. Using the tool parameters, the tool is divided into three parts by applying a Gaussian mapping to the set of points perpendicular to the normal direction and velocity direction of the tool surface: the front area, the rear area, and the envelope. The geometry formed by the space swept by the tool according to a line of G-code is the tool sweep body.

[0030] Specifically, the triangular mesh is formed as follows: the front and rear triangular meshes are discretized into multiple levels along the tool axis. At each level, the tool surface circle is discretized with a set discretization precision. Connecting the discretized points of adjacent levels yields the triangular meshes for the front and rear regions. Connecting the discretized points of each level along the envelope of different tool positions yields the triangular mesh for the middle section.

[0031] (3) Blank: Blank import methods can be divided into parameter import or STL file import. Specifically, parameter import mainly involves common regular geometric models, including cubes, cylinders, cones, and other common regular models. After parameter import, the vertices of each triangular facet are obtained, the model surface is layered, and the discrete points of each layer are connected accordingly to generate the corresponding triangular facet model, and the blank model is visualized. The STL model import method involves inputting the blank's STL file for direct visualization.

[0032] The milling simulation process is as follows: S1Tri-Dexel model generation The triangular model is used to obtain three Dexel models in three directions according to the three preset sub-threads.

[0033] The raw Tri-Dexel model: The Tri-Dexel model is activated by generating three preset sub-threads, each calculating a Dexel model in a single direction. Specifically, each thread traverses all triangular faces, obtains the vertex coordinates of each facet, and calculates the bounding box of the facet. It then traverses the Dexel mesh within the bounding box, calculating the intersections with the triangular faces. For intersections on a ray, they are sorted and deduplicated according to the magnitude of the plane normal values. Two adjacent intersections form a group of Dexel data. All Dexel data on all rays in a preset direction form a Dexel model for that preset direction. This process is repeated for the other two directions to obtain the Tri-Dexel model in three directions.

[0034] Tri-Dexel Model of Tool Sweep Body: The triangular mesh of the tool sweep body is transformed into a Tri-Dexel model through the same methods of solving for the bounding box, calculating intersections, sorting and deduplicating, etc. Figure 2 As shown.

[0035] Boolean operations: Boolean operations are performed on the tool sweep body and stock Tri-Dexel models in each of the three threads, respectively, to obtain the results of the three-way Boolean operations. The changed Dexel data after the Boolean operations is stored in a cache queue for subsequent model surface reconstruction. The updated overall Dexel data is then stored in the current thread as the stock Tri-Dexel model data for the next Boolean operation. This process can be performed in the same thread as the tool Tri-Dexel calculation.

[0036] S2 Surface Reconstruction The Tri-Dexel model is obtained by caching data to determine its position on the original workpiece, and then the data from this processing is used to convert the Tri-Dexel data structure into a triangular facet structure.

[0037] While the surface reconstruction process shares significant similarities with the initial construction and update of the workpiece, the update process has stricter requirements regarding the time required for each update. This is primarily because surface reconstruction during the update process is an ongoing, interactive simulation, whereas initial construction is a one-off process with less stringent real-time requirements, allowing for a certain time delay. Furthermore, the tool model is updated visually based on the tool position data from the computation thread. Lag in updating the workpiece's geometric model can lead to visual mismatches between its geometry and tool position, impacting the interactive simulation experience. A crucial task to avoid these visual defects is to deeply optimize the surface reconstruction algorithm during the update process, reducing computational latency and meeting the real-time requirements of geometric simulation.

[0038] To minimize the time consumption of a single surface reconstruction algorithm during processing, the algorithm will employ dynamic accuracy adjustment and local update strategies.

[0039] like Figure 4 As shown, the dynamic precision adjustment strategy refers to a method of downsampling Dexel data to generate a new Dexel model that is geometrically similar but has less data volume for subsequent reconstruction calculations. The downsampling rate, i.e., the interval of Dexel sampling, is represented by simulation coefficients. This is represented as follows. If the simulation coefficient k is 2, then the algorithm samples data with Dexel indices 2i (i=0,1,2…) for reconstruction, which is equivalent to reducing the resolution to half of the original. By adjusting the simulation coefficient k in the configuration file, the simulation coefficients and geometric fidelity can be dynamically adjusted. After downsampling the Dexels in three directions, the smallest unit that generates the triangular facet is transformed into a larger voxel unit composed of multiple adjacent original voxel blocks, called the base block.

[0040] The local update strategy refers to transforming the overall model reconstruction into a process of updating local parts of the model. The overall bounding box of the model is divided into several unit blocks of approximately the same size, called blocks. By using the update status of the Dexel data passed by the Boolean operation thread, the sequence number of each block that needs to be updated can be quickly determined. Within a block, only the local basic blocks at the endpoints of the Dexel are reconstructed.

[0041] During the roughing process, the model is often extensively cut, and the cut portions often require the generation of triangles from multiple basic blocks, a process that consumes a significant amount of time. Furthermore, the data for each basic block's triangles is relatively independent and the processing is highly parallel during surface reconstruction. Therefore, a GPU is used to perform parallel computation on all basic blocks that require triangle construction.

[0042] (1) Determination of the reconstructed region (A) Determining the Reconstruction Block like Figure 6 As shown in (a), when the Dexel endpoints in the Tri-Dexel dataset A are related to the model T N-1 When the number of Dexel endpoints at corresponding positions in the model T is different, N-1 The Dexel in the code is broken at breakpoints 3, 4, 5, and 6. The blocks containing the breakpoints, as well as the blocks between breakpoints 3 and 4 and between breakpoints 5 and 6, need to be reconstructed. When the Tri-Dexel endpoints in the Tri-Dexel dataset A are related to model T N-1 When the number of data points at corresponding positions is the same, such as Figure 6 As shown in (b), the left side is Dexel in A, and the right side is model T. N-1 For the Dexel corresponding to position A, when the position of any endpoint AI of the line segment in A changes, the block containing endpoint AI, the block between endpoint AI and endpoint C, and the block containing endpoint C all need to be reconstructed, where C is the model T. N-1 The point in the Dexel that corresponds to the endpoint AI position.

[0043] (B) Determination of reconstructed voxels The spatial grid formed by the intersection of Dexels is a voxel.

[0044] Determine the positional relationship between the endpoints of each Tri-Dexel in the block to be reconstructed and the voxels in the block: like Figure 7 As shown in (b), the red lines represent Dexels. When the endpoints of a Dexel are located on the edge of a voxel, the voxels sharing that edge need to be reconstructed. like Figure 7 As shown in (a), the red lines represent Dexels. When the endpoints of a Dexel are located at the vertices of a voxel, the voxels sharing that vertex need to be reconstructed. Otherwise, do not refactor.

[0045] like Figure 5 As shown, the reconstruction method in this embodiment includes the following: Specifically: If it is the original, unrefined Tri-Dexel model, the reconstruction steps are as follows: 1. Initialize cached data. Copy the raw Tri-Dexel data to the surface reconstruction thread; 2. Calculate the triangular facets of the blank.

[0046] The bounding box of the blank model is pre-divided into blocks in three directions, and each block corresponds to a unique number.

[0047] During the initial construction, all blocks need to have triangles generated, and all block numbers will be recorded.

[0048] Determine the start and end Dexel data sequence numbers corresponding to each block number. Specifically, the calculated boundary Dexel sequence numbers can also be used for surface reconstruction during the update process. The Dexel sequence number is solved during the blank construction process and used in subsequent surface reconstructions to avoid the overhead of repeated calculations each time.

[0049] All block calculations are performed using Dexel indices spaced out in three directions. First, the base block step size is calculated for each axis (X, Y, Z). Then, the calculated step sizes are aligned to integer multiples, ensuring that the adjusted step size is an integer multiple of the simulation coefficients. This alignment operation aims to ensure that the Dexel indices at all block boundaries strictly coincide with the system's preset sampling grid. After alignment, the Dexel index of the i-th block boundary in that axis direction is:

[0050] In the formula, i represents the i-th Dexel used for separation, Dexelmax represents the maximum effective index value of the Dexel mesh in this direction, CubeLevel represents the number of blocks divided in this direction, k represents the simulation coefficient, and round represents rounding the calculation result to the nearest integer.

[0051] The process involves creating an OpenCL platform instance, acquiring available computing devices, establishing an execution context, initializing the command queue, loading kernel function source files, constructing program objects, and compiling and linking the kernel functions and creating kernel objects. Specifically, a singleton design pattern is employed to ensure that the above initialization process is executed only once during the raw data import phase. This allows for the direct reuse of already initialized GPU resources during subsequent simulation updates, avoiding the overhead of repeated initialization and improving computational efficiency and system stability.

[0052] (C) Convert the voxels to be reconstructed into triangular patch models. The Marching Cubes algorithm is used to connect the endpoints of each voxel to form triangular patches, thereby obtaining the triangular patch model of the region to be reconstructed.

[0053] The Dexel data of the voxels requiring reconstruction is flattened into one dimension. The endpoints of the recorded Dexels in each direction are sequentially placed into a one-dimensional array, and a lookup array is created, with the array structure consisting of the plane grid point index and the corresponding number of Dexel grid points. This facilitates fast data retrieval on the GPU.

[0054] GPU data transfer. The data processed in the previous steps is bound and written to the GPU. An intersection information array is created to receive outgoing intersection information. An element in the intersection information array includes the voxel configuration index, boundary point coordinate array, intersection flag, cutter flag, block index, base block index, and vertex and normal data for the triangle.

[0055] Execution of GPU kernel functions. In the GPU, each thread corresponds to a voxel block. The voxel block index is obtained, and the vertices of the voxel block are calculated.

[0056] For a given direction, a binary search is used to quickly find the Dexel data corresponding to the four edges in that direction within the query array. The Dexel endpoints are traversed, and by checking if they are within the current voxel block, the corresponding Dexel vertex on the edge is recorded in the intersection information, along with the edge index of the Dexel vertex. The other two directions are calculated using the same method.

[0057] Triangle facet data is obtained based on intersection information. A triangle facet is represented by three endpoint flags, yielding a voxel configuration index. The endpoint flags are converted into an array of triangle construction methods using the Marching Cubes algorithm, which is then used to index the methods for constructing the triangles. The vertex and normal data of the triangles from this method are stored in the intersection information array. The intersection information array is then returned.

[0058] S3 compares the triangular patch model of the region to be reconstructed with the Tri-Dexel model T. N-1 The triangular facet models of the unreconstructed regions are combined to obtain the Tri-Dexel model T after processing by the Nth line of code. N A triangular facet model.

[0059] Based on the input CNC program and tool model, the position and orientation of the tool are displayed in real time. The geometry of the workpiece is updated in real time through surface reconstruction data.

[0060] The system simulated using the above-mentioned multi-threaded and GPU-accelerated milling simulation method includes a first thread, a second thread, and a third thread, wherein: The first thread includes a Tri-Dexel model module and a Boolean operation module. The Tri-Dexel model module is used to convert the triangular facet model of the workpiece and the tool swept body into a Tri-Dexel model, and the Boolean operation module is used to perform Boolean operations on the Tri-Dexel model of the workpiece and the tool swept body. The second thread is used to determine the reconstruction region based on the data set obtained by the first thread, and to reconstruct the reconstruction region to obtain the triangular facet model; The third thread is used to display the triangular facet models from the first and second threads.

[0061] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A milling simulation method based on multithreading and GPU acceleration, characterized in that, The method includes the following steps: S1 The tool moves according to the Nth line of G code in the CNC program, and the space it sweeps forms the tool sweep body, which in turn shapes the Tri-Dexel model T of the workpiece formed after machining by the (N-1)th line of code. N-1 Boolean operations are performed on the Tri-Dexel model of the tool sweep body to obtain the Tri-Dexel model T after machining by the Nth line of code. N The Tri-Dexel data set A that changes during the operation; S2 determines the Tri-Dexel model T formed after processing by the (N-1)th line of code based on the Tri-Dexel dataset A. N-1 The region that needs to be reconstructed is then reconstructed to obtain a triangular patch model of the region that needs to be reconstructed. S3 compares the triangular patch model of the region to be reconstructed with the Tri-Dexel model T. N-1 The triangular facet models of the unreconstructed regions are combined to obtain the Tri-Dexel model T after processing by the Nth line of code. N A triangular facet model; S4 N=N+1, return to step S1, until all G-code processing is complete.

2. The milling simulation method based on multi-threading and GPU acceleration as described in claim 1, characterized in that, In step S2, the region to be reconstructed is obtained according to the following steps: The Tri-Dexel model T is bounded by a bounding box. N-1 Enclose the bounding box by dividing it into multiple blocks and determining the Dexel endpoints contained in each block. Using the Tri-Dexel dataset A and model T N-1 Compare and determine model T N-1 Blocks that need to be reconstructed; Determine the positional relationship between each Dexel endpoint in the block to be reconstructed and the voxels in the block: When the endpoint of a Dexel is located on the edge of a voxel, the voxels sharing that edge need to be reconstructed. When the endpoint of a Dexel is located at the vertex of a voxel, the voxels sharing that vertex need to be reconstructed. Otherwise, do not refactor.

3. The milling simulation method based on multi-threading and GPU acceleration as described in claim 2, characterized in that, The steps for determining the block that needs to be reconstructed are as follows: When the Dexel endpoints in the Tri-Dexel dataset A are related to model T N-1 When the number of endpoints at corresponding positions in the model T is different, N-1 The Dexel in the code is broken, and the block containing the breakpoint and the blocks between the breakpoints need to be reconstructed. When the Dexel endpoints in the Tri-Dexel dataset A are related to model T N-1 When the number of endpoints at corresponding positions in A is the same, when the position of any endpoint AI of the Dexel line segment in A changes, the block containing endpoint AI, the block between endpoint AI and endpoint C, and the block containing endpoint C all need to be reconstructed, where C is the model T. N-1 The point that corresponds to the endpoint AI position.

4. A milling simulation method based on multi-threading and GPU acceleration as described in claim 2 or 3, characterized in that, When determining the positional relationship between each Dexel endpoint in the block to be reconstructed and the voxels in the block to be reconstructed, the sampling rate of the Dexel is reduced by using an interval sampling method.

5. A milling simulation method based on multi-threading and GPU acceleration as described in claim 2 or 3, characterized in that, For the voxels that need to be reconstructed, the Marching Cubes algorithm is used to connect the Dexel endpoints of each voxel to form triangular patches, thereby obtaining the triangular patch model of the region to be reconstructed.

6. A milling simulation method based on multi-threading and GPU acceleration as described in claim 1 or 5, characterized in that, When N=1, the workpiece formed after processing by the (N-1)th line of code is the workpiece blank. The Tri-Dexel model of the workpiece blank or the tool sweep body is obtained by obtaining the Dexel model in one direction one by one until the Dexel model in three directions is obtained, that is, the required Tri-Dexel model is obtained.

7. A milling simulation method based on multi-threading and GPU acceleration as described in claim 6, characterized in that, The steps to obtain the Dexel model for any direction j of the blank or tool swept body are as follows: Construct the bounding box of the triangular facet model of the blank or tool swept body; Divide the plane in any direction j into multiple grids. A ray is emitted from each grid point. The ray intersects the bounding box of the blank or tool sweep body. The line segment formed by the line connecting the entry point and exit point of the ray in the bounding box is a Dexel. All Dexels formed by all rays are the Dexel model in any direction j.

8. A system for performing milling simulation using the multi-threaded and GPU-accelerated milling simulation method according to any one of claims 1-8, characterized in that, The system includes a first thread, a second thread, and a third thread, wherein: The first thread includes a Tri-Dexel model module and a Boolean operation module. The Tri-Dexel model module is used to convert the triangular facet model of the workpiece and the tool swept body into a Tri-Dexel model, and the Boolean operation module is used to perform Boolean operations on the Tri-Dexel model of the workpiece and the tool swept body. The second thread is used to determine the reconstruction region based on the data set obtained by the first thread, and to reconstruct the reconstruction region to obtain a triangular patch model; The third thread is used to display the triangular facet model from the second thread.

9. A milling simulation system based on multithreading and GPU acceleration, characterized in that, The system is used to implement a milling simulation method based on multithreading and GPU acceleration as described in any one of claims 1-8.

10. A computer storage medium, characterized in that, It stores a computer program that, when executed, implements a milling simulation method based on multithreading and GPU acceleration as described in any one of claims 1-8.