A numerical control machining three-dimensional geometry simulation method based on a limit level voxel structure
By restricting the hierarchical voxel structure and dynamically generating the final voxel, the problem of balancing simulation accuracy and efficiency in CNC machining using existing voxel geometry simulation methods is solved, thus achieving efficient three-dimensional geometric simulation for CNC machining.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIHANG UNIV
- Filing Date
- 2026-02-05
- Publication Date
- 2026-06-05
AI Technical Summary
Existing voxel geometry simulation methods struggle to balance simulation accuracy and computational efficiency in real-time CNC machining simulation scenarios. The voxel structure size and computational complexity are too high, and the tool geometry characteristics are not effectively incorporated, resulting in redundant high-resolution voxel generation, which affects simulation stability and efficiency.
A three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure is adopted. By co-designing the voxel hierarchical structure, voxel size determination strategy and voxel indexing method, the voxel level depth is restricted, the final voxel is dynamically generated, recursive subdivision is avoided, the voxel access efficiency is improved, and the final voxel size is matched with the tool geometry characteristics.
While ensuring simulation accuracy, it reduces voxel structure management overhead and computational complexity, improves the stability and efficiency of the simulation process, and is suitable for real-time 3D geometric simulation of complex parts.
Smart Images

Figure CN122151715A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of CNC machining simulation technology, specifically to a three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure. Background Technology
[0002] In CNC machining, 3D solid simulation is used to predict the interaction between the tool path and the workpiece, verify the correctness of the machining path, and avoid problems such as overcutting and collisions. Traditional simulation methods typically employ a global discrete modeling strategy, which involves voxelizing or triangulating the entire workpiece model during the simulation initialization phase to quickly query and update the material state during machining.
[0003] However, with the increase in model complexity and simulation scale, traditional methods have the following problems: In the research of cutting simulation algorithms based on voxel models, voxels usually have the following characteristics: (1) They are the smallest simulation model units that express the blank CAD model and directly participate in simulation calculations, such as material removal calculations; (2) They usually have the following three states: completely outside the model, completely inside the model, and located at the model boundary. Voxels in different states correspond to different operations in the algorithm; (3) They generally have multiple levels or different resolutions. By organizing spatial sparse data structures such as quadtrees and octrees, different subdivision granularities of the corresponding spatial regions and regional segmentation of the blank model can be realized, thereby locating the local intersection area of the tool and the blank; (4) With the improvement of simulation accuracy, the number of voxels increases significantly, and the corresponding data structures become increasingly bloated, resulting in problems such as reduced voxel search efficiency, significantly increased simulation memory consumption, and reduced simulation efficiency.
[0004] Most geometric simulation methods employ a space-for-time tradeoff strategy, discretizing the entire workpiece model at the start of the simulation to directly retrieve simulation data during material removal. However, as model size and simulation scale increase, this approach leads to significant memory resource waste, making it difficult to efficiently update simulation data in subsequent stages. To address this issue, we utilize a divide-and-conquer approach, dynamically establishing a discrete workpiece model based on the tool's motion trajectory to avoid memory waste. We also leverage the advantages of voxel models in dividing spatial regions, establishing a multi-level voxel model. This model manages simulation data through voxels and locates local simulation regions during the simulation by checking for intersections between the tool bounding box and voxels, enabling efficient model data updates.
[0005] However, existing voxel geometry simulation methods, while pursuing local geometric accuracy, often rely on increasing the depth of voxel levels or global high-resolution modeling. As a result, it is difficult to balance simulation accuracy and computational efficiency in real-time CNC machining simulation scenarios, and there is still room for further improvement.
[0006] In 3D geometric simulation of CNC machining, voxel models are widely used for simulating the geometric interaction between the tool and the workpiece due to their regular structure and ease of material removal calculations. However, in real-time simulation scenarios for machining complex parts, existing voxel geometry simulation methods still have the following technical problems: 1. Existing voxel geometry simulation methods typically improve local geometric accuracy by increasing the level of voxel space subdivision or improving the global voxel resolution. However, this approach leads to a rapid expansion of the voxel structure size as the simulation accuracy increases, introducing a large number of voxel nodes and causing a significant increase in voxel structure management overhead and memory consumption, making it difficult to meet the stability and efficiency requirements of real-time simulation of CNC machining.
[0007] 2. In the voxel hierarchy, different technical functions are often coupled within the same voxel level. The same voxel level needs to undertake the function of positioning the processing area and also participate in the local geometric simulation calculation. This makes it difficult to balance the voxel size between spatial positioning efficiency and local geometric simulation accuracy, thus forcing a trade-off between ensuring accuracy and ensuring efficiency.
[0008] 3. Existing voxel modeling and simulation methods fail to effectively incorporate tool geometry characteristics during voxel structure design. The voxel spatial resolution is often disconnected from the tool's machining capabilities, easily generating redundant high-resolution voxels in non-machining areas or spaces where the tool cannot operate, further exacerbating the scale of voxel structures and computational burden.
[0009] In summary, in real-time 3D geometric simulation scenarios for CNC machining, there is an urgent need for a geometric simulation method that, under the premise of limited voxel levels, can balance spatial positioning efficiency and local geometric simulation accuracy through reasonable voxel structure design and voxel size control mechanism, while reducing the scale of voxel structures and computational complexity. Summary of the Invention
[0010] To address the aforementioned technical problems, this invention provides a three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure. This method includes the following steps and achieves efficient geometric simulation of the CNC machining process by collaboratively designing the voxel hierarchical structure, voxel size determination strategy, and voxel indexing method.
[0011] According to an embodiment of the present invention, a three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure is provided, comprising: S1: Initialization of the voxel hierarchy structure. Based on the acquired 3D geometric data of the blank model to be processed, a first-level voxel is established and used as the root node of the voxel hierarchy structure. S2: Determine the final voxel size. Construct a tool bounding box based on the geometric parameters of the tool used in the CNC machining process. Obtain the spatial size of the final voxel according to the tool diameter. Establish the final voxel. Use the voxels between the first-level voxel and the final voxel as intermediate-level voxels. Determine the subdivision granularity of each level of voxel. S3: Voxel intersection detection based on tool motion, detects the spatial intersection relationship between the tool bounding box and each intermediate voxel, in order to determine the intermediate voxel that the tool is acting on at the current simulation moment; S4: Dynamic generation of final voxels. Within the spatial range of intermediate voxels in which the tool is acting at the current simulation moment, final voxels are generated according to the spatial dimensions of the final voxels for geometric simulation calculations. S5: Geometric simulation calculation based on final voxels. Each voxel is assigned a unique identifier containing its hierarchical information and spatial location information, and the voxels at each level are indexed and accessed based on the identifier. The generated final voxels are used as the basic calculation units to simulate the geometric interaction process between the tool and the workpiece, and obtain the three-dimensional geometric simulation results of the CNC machining process.
[0012] Optionally, S1 includes: Read the three-dimensional geometric data of the blank model to be processed, calculate the overall bounding box of the blank model in three-dimensional space, use the bounding box as the spatial range of the first-level voxel, construct a first-level voxel covering the overall space of the blank model, and use the first-level voxel as the root node of the voxel hierarchy. Set the number of voxel levels; Based on the set number of voxel levels, the first-level voxels are spatially divided to generate intermediate-level voxels for spatial partitioning of the blank model.
[0013] Optionally, in S1, the number of voxel levels is set to three, with intermediate voxels being two-level voxels.
[0014] Optionally, the granularity of voxels at each level determined in S2 includes: The spatial dimensions of the final voxel are obtained by processing based on the tool diameter; The three-dimensional dimensions of the axisymmetric bounding box are calculated based on the three-dimensional geometric data of the blank model, as well as the voxel size, i.e. the initial root node voxel size. Based on the determined final voxel size, adjust the root node voxel size to obtain an updated root node voxel size to ensure that it can cover all final voxels. The subdivision granularity of each level of voxel is determined based on the root node voxel size and the final voxel size.
[0015] Optionally, S3 includes: During CNC machining simulation, the position and attitude information of the tool at each simulation moment are obtained according to the CNC program, and the position of the tool enclosure box is updated in real time. The spatial intersection relationship between the tool enclosure and each intermediate voxel is detected, and the intermediate voxels that spatially intersect with the tool enclosure are taken as the intermediate voxel regions where the tool acts, for subsequent simulation calculations.
[0016] Optionally, S4 includes: for the intermediate voxel region acted upon by the tool, generating a final voxel for geometric simulation calculations by using the size of the final voxel as the finest-grained voxel unit in the voxel structure.
[0017] Optionally, in S5, a unique identifier containing hierarchical and spatial location information is assigned to each voxel at each level, including: Each voxel's unique identifier is assigned an integer (int) representation, consisting of two parts: the high 16 bits represent the hierarchy and spatial location information of the voxel's parent voxel, and the low 16 bits represent the hierarchy and spatial location information of the voxel itself. In the 16-bit representation, the high 4 bits indicate the level of the voxel, and the low 12 bits indicate the index value of the voxel within the parent node voxel.
[0018] Compared with the prior art, the numerical control machining three-dimensional geometric simulation method based on a restricted hierarchical voxel structure provided by the present invention has at least the following advantages.
[0019] 1. By limiting the depth of the voxel hierarchy, the overhead of voxel structure management is reduced. This invention limits the voxel hierarchy structure to a fixed number of hierarchical voxel structures, avoiding the overhead of voxel node creation, maintenance, and access caused by recursively increasing the depth of the voxel tree in existing technologies. This reduces the complexity of the voxel data structure and improves the operational stability during simulation.
[0020] 2. By employing a one-time generation strategy for final voxels, the performance loss caused by recursive subdivision is avoided. In this invention, after the final voxel is generated, no further hierarchical subdivision is triggered, avoiding the hierarchical growth problem introduced by recursive subdivision in the adaptive voxel structure. This reduces the time overhead in voxel indexing and updating processes, thereby improving the feasibility of real-time simulation of CNC machining.
[0021] 3. Improve voxel access efficiency through unique voxel identifiers and fast indexing. This invention assigns a unique identifier containing hierarchical and spatial location information to voxel nodes, and performs voxel indexing based on the identifier. This enables rapid resolution of voxel hierarchical relationships, reduces the time required for voxel lookup and traversal, and improves the overall efficiency in high-frequency geometric simulation update processes.
[0022] 4. By matching the final voxel size with the tool geometry, the voxel spatial resolution is adaptively adjusted according to the tool's machining capability, reducing the generation of high-resolution voxels in non-machining areas and improving the effective utilization rate of the voxel model.
[0023] 5. By assigning spatial positioning and geometric simulation calculation functions to second-level and final-level voxels respectively, high-precision local simulation can be achieved under the premise of limited voxel levels, avoiding the trade-off between positioning efficiency and simulation accuracy for single-level voxels.
[0024] In summary, this invention effectively controls the scale of voxel structures and computational complexity while ensuring the accuracy of CNC machining geometric simulation, making it suitable for real-time three-dimensional geometric simulation in the machining process of complex parts. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the embodiments will be briefly introduced below. The features and advantages of the present invention can be more clearly understood by referring to the accompanying drawings. The accompanying drawings are schematic and should not be construed as limiting the present invention in any way. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 The diagram shows the structure of a multi-branch tree voxel model in a three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure according to an embodiment of the present invention.
[0027] Figure 2 A schematic diagram of voxel division is provided in a three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure according to an embodiment of the present invention.
[0028] Figure 3 A schematic diagram of a plane-triangle intersection calculation model in a three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure provided according to an embodiment of the present invention.
[0029] Figure 4 A schematic diagram of voxel ID values in a three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure provided according to an embodiment of the present invention. Detailed Implementation
[0030] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments of the present invention and the features thereof can be combined with each other.
[0031] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein. Therefore, the scope of protection of the invention is not limited to the specific embodiments disclosed below.
[0032] The following detailed description, with reference to the accompanying drawings, illustrates a three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure, according to an embodiment of the present invention. This embodiment provides a three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure, which achieves efficient geometric simulation of the CNC machining process through the collaborative design of the voxel hierarchical structure, voxel size determination strategy, and voxel indexing method.
[0033] This implementation method provides a constraint on the voxel level and further proposes a three-level voxel structure, limiting the voxel level to three. Two-level voxels cannot represent detail and cannot guarantee simulation accuracy; voxels of four levels or higher are complex to construct and require more data sets for storage, resulting in less data stored in the same 32-bit memory, thus compromising efficiency. Therefore, a three-level voxel structure is chosen. The advantage of a three-level voxel structure is that it guarantees both simulation accuracy and simulation efficiency.
[0034] This implementation provides a method for determining the number of voxels at each level. The number of final voxels (tertiary voxels) is determined by the dimensions of the primary voxels (first-level voxels) and the tertiary voxels. The prime factors obtained from the final voxel number decomposition are divided into two groups, such that the product of the two groups of prime numbers is as close as possible. This yields the numbers of second- and third-level voxels. The advantage is that it ensures both simulation accuracy and simulation efficiency.
[0035] This implementation proposes a method for calculating the final voxel size. The reason for selecting the range from the tool radius to the diameter is that, for example, the milling cutter has a slow cutting speed and a small feed rate, generally smaller than the tool diameter. Simultaneously, to facilitate the calculation of material removal per frame, the final voxel size should be greater than or equal to the tool diameter. After cutting, the tool completely leaves the workpiece; therefore, to ensure animation continuity, the root node size should be larger than the initial root node size. Thus, a size with a non-zero remainder is selected as the final voxel size.
[0036] In the method of this embodiment, the final voxel size This can be determined in the following way: First, the size of the final voxel is limited to a range of positive integers, i.e. .in d represents the tool diameter. Next, at the initial stage of the simulation, the axisymmetric bounding box dimensions are calculated based on the blank model. , which serves as the initial root node voxel size.
[0037] Next, in the set of positive integers Choose the three smallest positive integers that satisfy the following conditions as the dimensions of the third-level voxels: .in This represents the remainder of two values. Its advantage lies in not wasting computational memory, making full use of hardware, and ensuring simulation accuracy.
[0038] like Figures 1 to 4 As shown, a three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure, according to an embodiment of the present invention, may include the following steps.
[0039] S1: Voxel hierarchy initialization. Based on the acquired 3D geometric data of the blank model to be processed, a first-level voxel is established as the root node of the voxel hierarchy. Here, voxel is short for volume element, representing a spatial region of a certain size, usually in the shape of a cube, and its end faces are set to be parallel to the XOY plane, YOZ plane and ZOX plane of the blank coordinate system, respectively.
[0040] Furthermore, such as Figure 1 As shown, this step may include: reading the three-dimensional geometric data of the blank model to be processed; calculating the overall bounding box of the blank model in three-dimensional space; using the bounding box as the spatial range of the first-level voxels; constructing first-level voxels covering the overall space of the blank model; and dividing the first-level voxels into spaces according to preset spatial subdivision rules to generate second-level voxels for spatial partitioning of the blank model, such as... Figure 2 As shown; wherein, the number of voxel levels can be limited to a fixed value, so that the maximum level depth of the voxel structure remains unchanged. For example, as an example, Figure 1 The voxel hierarchy is set to three levels. The spatial subdivision rules may include: first, constructing an initial root node based on the blank size; then, calculating the size of the final voxel in each direction based on the tool size, and then calculating the size of the root node (first-level voxel); finally, performing prime factorization based on the number of final voxels in each direction to obtain the number of second-level and third-level voxels, and thus the size of the second-level voxels; thus completing the construction of the number and size of each level of the multi-branch tree.
[0041] Optionally, the first-level voxel construction step in S1 may include setting the root node of the tree to correspond to a primary voxel, the size of which covers the entire spatial range of the blank model. In this embodiment, firstly, the three-dimensional geometric data of the blank model is read, and the blank model can be represented by a triangular mesh model. Based on the geometric range of the blank model, its axis-aligned bounding box in three-dimensional space is calculated, and the dimensions of the bounding box in the X, Y, and Z coordinate directions are denoted as follows: , , Using the bounding box as the spatial extent of the first-level voxels, construct first-level voxels covering the entire blank model. These first-level voxels serve as the root node of the voxel hierarchy, used to uniformly manage subsequent voxel partitioning processes. S2: Determine the final voxel dimensions. Based on the geometric parameters of the tools used in the CNC machining process, establish the final voxels. Using the voxels between the first-level and final voxels as intermediate-level voxels, in... Figure 1 and Figure 2 In the illustrative embodiment shown, the number of voxel levels is set to three, then the intermediate voxel is a second-level voxel.
[0042] Obtain the geometric parameters of the tools used in the CNC machining process and construct the corresponding tool bounding box; obtain the spatial dimensions of the final voxels based on the tool diameter, and determine the spatial subdivision relationship of each voxel level in each coordinate direction based on the spatial range of the first-level voxels.
[0043] Furthermore, the specific steps for dividing the second-level voxels in S2 may include: first, determining the positional relationship between the spatial triangle and the dividing plane: (1) the spatial triangle is on any side of the dividing plane and has no intersection with the dividing plane; (2) the dividing plane passes through a vertex of the spatial triangle and can divide the spatial triangle into 2 sub-triangles; (3) the dividing plane does not pass through a vertex of the spatial triangle and intersects with the spatial triangle, dividing the spatial triangle into 3 sub-triangles. Among them, the spatial triangle can be a basic component of the STL model; the dividing plane is the tangent formed by the intersection line in the process of dividing the second-level voxels and the third-level voxels, and is perpendicular to the coordinate system plane.
[0044] Among them, the secondary voxel division object is the blank; regarding the STL model format, this is a 3D model format exported by 3D modeling software.
[0045] For the first case (1) above, there is no need to perform a clipping operation. It is only necessary to divide the spatial triangle into the corresponding regions according to the direction of the plane normal.
[0046] For the second case (2), the algorithm first needs to determine the vertices of the spatial triangle traversed by the cutting plane, and then calculate the new vertices on the opposite side using linear interpolation. For example... Figure 3 In one illustrative example shown, the cutting plane passes through vertex First, calculate the vertices separately. and Distance from the dividing plane and Then the intersection of the tangent plane and the spatial triangle The calculation method is as follows: Connecting the newly generated vertices to the vertices of the original spatial triangle yields a new spatial triangle. , , and All are vertex coordinates.
[0047] The third case (3) is similar to the second case (2) above. First, a triangle and a quadrilateral are obtained by intersecting the spatial triangle with the cutting plane. Then, the quadrilateral is divided into two triangles, thus obtaining three triangles.
[0048] like Figure 1 As shown in this exemplary embodiment, the voxel hierarchy is defined as a three-level structure, including first-level voxels, second-level voxels, and third-level voxels, where the third-level voxel (also known as the final voxel) serves as the finest-grained voxel unit. Unlike existing voxel tree structures that employ recursive subdivision, the maximum level depth of the voxel structure in this embodiment remains unchanged. The final voxel (i.e., the voxel of the last level), such as the third-level voxel, does not trigger further level subdivision after its generation, thereby avoiding the data structure complexity and decreased access efficiency problems caused by the continuous increase in voxel tree depth.
[0049] Furthermore, the granularity of each level of voxels can be determined in the following manner.
[0050] Optionally, the spatial dimensions of the final voxel, i.e., the final voxel size. This can be determined in the following way. First, to simplify the algorithm, the size of the final voxel is limited to be selected from positive integers, i.e. .in , The value is the tool diameter. The reason for choosing the range from the tool radius to the diameter is that, firstly, the milling cutter's cutting speed is relatively slow, and the tool's feed rate is generally small, usually smaller than the tool diameter. Secondly, to facilitate the calculation of material removal per frame, the final voxel size can be greater than or equal to the tool diameter. After cutting, the tool completely leaves the workpiece; therefore, to ensure animation continuity, the root node size can be larger than the initial root node size. Thus, a size with a non-zero remainder is chosen as the final voxel size.
[0051] Next, at the initial stage of the simulation, the dimensions of its axisymmetric bounding box are calculated based on the blank model. , which serves as the initial root node voxel size.
[0052] Next, in the collection Choose the three smallest positive integers that satisfy the following conditions as the dimensions of the third-level voxels:
[0053] in, It represents the remainder between two values.
[0054] Then, based on the determined final voxel size, the root node voxel size is adjusted to obtain the final root node voxel size, ensuring that it covers all final voxels:
[0055] in, This indicates the rounding up operation. This represents the size of a first-order voxel along the X-axis. This represents the size of a first-order voxel in the Y-axis direction. This represents the size of the first-level voxel along the Z-axis. The size of the first-level voxel is used as the final root node voxel size.
[0056] Finally, the subdivision granularity of voxels at each level is determined based on the root node voxel size and the final voxel size. In this algorithm, the size of each level voxel is an integer for ease of subsequent numerical calculations. To ensure the balance of the tree structure, i.e., to avoid excessive extremes in the depth or breadth of the tree, prime factorization is performed on the number of final voxels in each direction. For example, the number of final voxels in the X-axis direction is... The same principle applies to other directions. Divide the prime factors obtained from the decomposition into two groups, ensuring that the product of the two groups is as close as possible. For example, if the number of third-level voxels in the X direction is 12, it can be decomposed into three prime numbers: 2, 2, and 3. Divide these prime numbers into two groups: the first group contains 2 and 2, and the second group contains 3, ensuring that the product of the two groups is as close as possible. Then, take 3 as the subdivision granularity of the root node voxel in the X direction, and take 4 as the subdivision granularity of the second-level voxels in the X direction. After the above steps, the size and subdivision granularity of each level of voxel are determined. Further, take the smaller product as the subdivision granularity of the root node voxel in that direction (i.e., the number of second-level voxels it can be decomposed into), thus determining the size of the second-level voxels. The other product is then taken as the subdivision granularity of the second-level voxels in that direction (i.e., the number of final-level voxels it can be decomposed into).
[0057] S3: Voxel intersection detection based on tool motion.
[0058] In this step, during the CNC machining simulation, the position of the tool bounding box can be updated in real time according to the tool's motion trajectory; the relationship between the tool bounding box and each intermediate voxel is detected, for example, Figure 1 The spatial intersection relationships between the secondary voxels in the illustrated embodiment are used to determine the secondary voxel region that the tool may operate in at the current simulation moment. When the tool bounding box spatially intersects with a certain secondary voxel, that secondary voxel is taken as the secondary voxel region operated by the tool and used for subsequent geometric simulation calculations.
[0059] Furthermore, during the CNC machining simulation, the position and attitude information of the tool at each simulation moment is obtained according to the CNC program, and the position of the tool bounding box in space is updated in real time accordingly. By detecting the spatial intersection relationship between the tool bounding box and each secondary voxel, the secondary voxel region that the tool may act on at the current simulation moment is determined. For secondary voxels that do not have spatial intersection with the tool bounding box, it means that the tool will not have a geometric effect on the spatial region corresponding to the secondary voxel at that simulation moment, and the secondary voxel does not need to participate in subsequent geometric simulation calculations.
[0060] S4: Ultimate voxel dynamic generation.
[0061] Optionally, for intermediate voxels that spatially intersect with the tool enclosure, for example, in Figure 1 and Figure 2 The second-level voxels shown are used to generate final voxels for geometric simulation calculations within the corresponding second-level voxel space according to the spatial dimensions of the final voxels; wherein, the final voxels, as the finest-grained voxel units in the voxel structure, do not trigger further hierarchical subdivision after generation.
[0062] Furthermore, only when the tool bounding box spatially intersects with a certain intermediate-level voxel, such as a second-level voxel, is a final voxel generated within the spatial range corresponding to that second-level voxel, according to the final voxel spatial dimensions determined in step S2. The generated final voxel serves as the finest-grained voxel unit in the voxel hierarchy, participating in local geometric simulation calculations, and does not trigger further hierarchical subdivision after generation. Through this on-demand generation method, the final voxel exists only within the actual operating area of the tool, avoiding global high-resolution voxel modeling of the entire blank model during simulation initialization, thereby significantly reducing the total number of voxels and memory usage.
[0063] S5: Based on the final voxel geometric simulation calculation, the 3D geometric simulation results of the CNC machining process are obtained. The obtained 3D geometric simulation results of the CNC machining process can be used to generate machining schemes and optimize processes for the workpiece. The final simulation result of this method yields a three-level voxel multi-branch tree structure. This provides specific data support for constructing the multi-branch tree, determining the size of each voxel level and the number of voxels at each level in the X, Y, and Z directions. Constructing an efficient search tree can effectively improve the computational efficiency of the simulation.
[0064] Optionally, in this step, each level of voxel can be assigned a unique identifier containing its hierarchical information and spatial location information, and the voxel can be indexed and accessed based on the identifier; using the generated final voxel as the basic computing unit, the geometric interaction process between the tool and the workpiece is simulated and calculated, including local material removal judgment and geometric update, so as to obtain the three-dimensional geometric simulation results of the CNC machining process.
[0065] A final voxel refers to the finest-grained voxel unit in the voxel hierarchy that is no longer further subdivided. This voxel unit, after its generation, does not trigger further hierarchical division and directly participates in the tool-workpiece geometric interaction calculation as the basic unit for geometric simulation calculations. In this embodiment, the final voxel refers to the voxel unit defined above.
[0066] Furthermore, the ID value assignment method in S5 can include constructing ID-voxel key-value pairs and storing them in a hash table, allowing indexing of voxels at any level with a fixed time complexity during simulation. For example... Figure 4 As shown, each voxel's ID can be represented by an integer (int), which includes two parts: the high 16 bits represent the hierarchy and spatial location information of its parent voxel, and the low 16 bits represent the hierarchy and spatial location information of the voxel's node. Of these 16 bits, the high 4 bits represent the voxel's hierarchy, and the low 12 bits represent the voxel's index value within its parent voxel. The maximum integer represented by 4 bits is 15, while the voxel hierarchy in this illustrative embodiment is set to 3; the maximum integer represented by 12 bits is 4095, which is the average maximum subdivision granularity. In this illustrative embodiment, the maximum granularity of the algorithm is set to 13, which is within the integer range and will not cause numerical overflow or other problems. It should be understood that the above method of assigning ID values is illustrative. In other embodiments, different methods can be used as needed, and the number of high and low bits can be set separately.
[0067] Continue to refer to Figure 4 In this illustrative embodiment, the root voxel is designated with an ID value of 0. The ID value of a second-level voxel is then a combination of its own hierarchy information and index information. The high 16 bits of the final voxel's ID value represent the ID value of its parent node, i.e., the ID value of a specific second-level voxel, while the low 16 bits represent its own hierarchy information and its index information within the parent voxel. Since this algorithm sets the voxel hierarchy to 3 levels, its parent voxel can be easily found directly using its voxel ID value.
[0068] Optionally, this step can use a hash table, a data structure that allows direct access based on a key value. By mapping the key value to a location in the table, records are accessed, speeding up the search. This mapping function is called a hash function, and the array storing the records is called a hash table.
[0069] According to another embodiment of the present invention, a three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure is provided, comprising the following steps.
[0070] S1: Voxel Hierarchical Structure Initialization Steps. Read the 3D geometric data of the blank model, calculate the overall bounding box of the blank model in 3D space, and use the bounding box as the spatial range of the first-level voxels to construct first-level voxels covering the overall space of the blank model; according to predetermined spatial subdivision rules, divide the space of the first-level voxels to generate second-level voxels for spatial partitioning of the blank model; wherein, the number of voxel levels is limited to a fixed value, and the maximum level depth of the voxel structure remains unchanged.
[0071] S2: Final voxel size determination step. Based on the geometric parameters of the tool used in the CNC machining process, construct the corresponding tool bounding box; obtain the spatial dimensions of the final voxels based on the tool diameter, and determine the spatial subdivision relationship of each voxel level in each coordinate direction based on the spatial range of the first-level voxels.
[0072] S3: Voxel intersection detection step based on tool motion. During CNC machining simulation, the position of the tool bounding box is updated in real time according to the tool's motion trajectory; the spatial intersection relationship between the tool bounding box and each secondary voxel is detected to determine the secondary voxel region that the tool may act on at the current simulation moment.
[0073] S4: Final voxel dynamic generation step. Only when the tool bounding box spatially intersects with a certain secondary voxel, a final voxel for geometric simulation calculation is generated within the corresponding secondary voxel space according to the spatial dimensions of the final voxel; wherein, the final voxel, as the finest-grained voxel unit in the voxel structure, does not trigger further hierarchical subdivision after generation.
[0074] S5: Geometric simulation calculation steps based on final voxels. Each level of voxel is assigned a unique identifier containing its hierarchical and spatial location information, and the voxels are accessed by index based on these identifiers. Using the generated final voxels as basic calculation units, the geometric interaction process between the tool and the workpiece is simulated, including local material removal judgment and geometric updates, thereby obtaining the three-dimensional geometric simulation results of the CNC machining process.
[0075] All of the above-mentioned optional technical solutions can be combined in any way to form optional embodiments of the present invention, and will not be described in detail here.
[0076] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order and method of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0077] It should be understood that the foregoing only illustrates some embodiments, and changes, modifications, additions, and / or variations can be made without departing from the scope and spirit of the disclosed embodiments. These embodiments are illustrative and not restrictive. Furthermore, the described embodiments relate to those currently considered most practical and preferred, and should be understood as not being limited to the disclosed embodiments, but rather intended to cover different modifications and equivalent arrangements included within the spirit and scope of those embodiments. Moreover, the various embodiments described above can be used in conjunction with other embodiments; for example, an aspect of one embodiment can be combined with an aspect of another embodiment to achieve yet another embodiment. Additionally, individual features or components of any given component can constitute another embodiment.
[0078] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be covered within the scope of the claims and specification of the present invention.
Claims
1. A three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure, characterized in that, include: S1: Initialization of the voxel hierarchy structure. Based on the acquired 3D geometric data of the blank model to be processed, a first-level voxel is established and used as the root node of the voxel hierarchy structure. S2: Determine the final voxel size. Construct a tool bounding box based on the geometric parameters of the tool used in the CNC machining process. Process the tool diameter to obtain the spatial size of the final voxel. Establish the final voxel. Use the voxels between the first-level voxel and the final voxel as intermediate-level voxels. Determine the subdivision granularity of each level of voxel. S3: Voxel intersection detection based on tool motion, detects the spatial intersection relationship between the tool bounding box and each intermediate voxel, in order to determine the intermediate voxel that the tool is acting on at the current simulation moment; S4: Dynamic generation of final voxels. Within the spatial range of intermediate voxels in which the tool is acting at the current simulation moment, final voxels are generated according to the spatial dimensions of the final voxels for geometric simulation calculations. S5: Geometric simulation calculation based on final voxels, assigning a unique identifier containing its hierarchical information and spatial location information to each level of voxel, and indexing and accessing each level of voxel based on the identifier; Using the generated final voxels as the basic computational units, the geometric interaction process between the tool and the workpiece is simulated and calculated to obtain the three-dimensional geometric simulation results of the CNC machining process.
2. The CNC machining three-dimensional geometric simulation method based on a restricted hierarchical voxel structure according to claim 1, characterized in that, S1 includes: Read the three-dimensional geometric data of the blank model to be processed, calculate the overall bounding box of the blank model in three-dimensional space, use the bounding box as the spatial range of the first-level voxel, construct a first-level voxel covering the overall space of the blank model, and use the first-level voxel as the root node of the voxel hierarchy. Set the number of voxel levels; Based on the set number of voxel levels, the first-level voxels are spatially divided to generate intermediate-level voxels for spatial partitioning of the blank model.
3. The CNC machining three-dimensional geometric simulation method based on a restricted hierarchical voxel structure according to claim 2, characterized in that, In S1, the number of voxel levels is set to three, with intermediate voxels being second-level voxels.
4. The CNC machining three-dimensional geometric simulation method based on a restricted hierarchical voxel structure according to claim 1, characterized in that, The granularity of each voxel level determined in S2 includes: The spatial dimensions of the final voxel are obtained by processing based on the tool diameter; The three-dimensional dimensions of the axisymmetric bounding box are calculated based on the three-dimensional geometric data of the blank model, as well as the voxel size, i.e. the initial root node voxel size. Based on the determined final voxel size, adjust the root node voxel size to obtain an updated root node voxel size to ensure that it can cover all final voxels. The subdivision granularity of each level of voxel is determined based on the root node voxel size and the final voxel size.
5. The three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure according to claim 1, characterized in that, S3 include: During CNC machining simulation, the position and attitude information of the tool at each simulation moment are obtained according to the CNC program, and the position of the tool enclosure box is updated in real time. The spatial intersection relationship between the tool enclosure and each intermediate voxel is detected, and the intermediate voxels that spatially intersect with the tool enclosure are taken as the intermediate voxel regions where the tool acts, for subsequent simulation calculations.
6. The three-dimensional geometric simulation method for CNC machining based on a restricted hierarchical voxel structure according to claim 5, characterized in that, S4 include: For the intermediate voxel region where the tool operates, the final voxel is used as the finest-grained voxel unit in the voxel structure according to the size of the final voxel, and the final voxel is generated for geometric simulation calculation.
7. The CNC machining three-dimensional geometric simulation method based on a restricted hierarchical voxel structure according to claim 1, characterized in that, In S5, unique identifiers containing hierarchical and spatial location information are assigned to each level of voxel, including: Each voxel's unique identifier is assigned an integer (int) representation, consisting of two parts: the high 16 bits represent the hierarchy and spatial location information of the voxel's parent voxel, and the low 16 bits represent the hierarchy and spatial location information of the voxel itself. In the 16-bit representation, the high 4 bits indicate the level of the voxel, and the low 12 bits indicate the index value of the voxel within the parent node voxel.