Method for contact detection between a composite tool and a workpiece and material removal simulation during a cutting process
By extracting cutting edge feature points and constructing hybrid hierarchical bounding boxes using Open3d tools, the accuracy and efficiency issues of tool-workpiece contact detection in CNC cutting simulation were solved, achieving high-precision and high-efficiency material removal simulation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANDONG UNIV
- Filing Date
- 2026-01-30
- Publication Date
- 2026-05-05
AI Technical Summary
In existing CNC cutting simulation technologies, it is difficult to balance the accuracy and efficiency of collision detection between the tool and the workpiece, and the simulation of material removal is not realistic enough, which cannot meet the requirements of high precision and high efficiency.
Using Open3d tools, through cutting edge feature point extraction, hybrid hierarchical bounding box construction, and composite detection logic, high-precision and high-efficiency tool-workpiece contact detection and material removal simulation are achieved.
It achieves high-precision and high-efficiency cutting process simulation, meets the requirements of real-time simulation, and improves the realism of material removal simulation and the accuracy of undeformed chip extraction.
Smart Images

Figure CN121613768B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for automatically determining the contact between the cutting tool and the workpiece and removing material during the simulation of cutting processes, belonging to the field of cutting simulation technology. Background Technology
[0002] In the field of CNC machining simulation technology, the accuracy of tool-workpiece collision detection and the realism of material removal simulation are core requirements, but existing technologies have obvious shortcomings and are difficult to meet the requirements of practical applications.
[0003] Firstly, tool collision detection faces a trade-off between accuracy and efficiency. Traditional solutions, to simplify calculations, often treat the tool as a regular geometric entity such as a cylinder or cone. For example, CN108469785A, titled "A Collision Detection Method for Complex Surfaces in Five-Axis Machining Based on Implicit Functions," ignores the sharp contours of the cutting edge and the curved features of the rake face. This results in collision detection only determining whether the tool is close to the workpiece, failing to locate the actual cutting edge area. Even with bounding box optimization, while coarse-grained bounding boxes reduce computation, the significantly enlarged bounding volume leads to a marked increase in the false collision rate and a severe decrease in accuracy. Fine-grained bounding boxes, while improving accuracy, require densely segmenting the tool to construct a hierarchical structure, increasing the time spent on bounding box construction and collision calculation costs, making it difficult to meet the high-efficiency requirements of real-time simulation (frame rate ≥ 30fps).
[0004] Secondly, the extraction of the swept surface in material removal simulation deviates from the actual cutting scenario. For example, the method for solid modeling of tool swept bodies for five-axis CNC machining simulation disclosed in CN120688104A treats the tool as a rotating body, failing to distinguish between the cutting and non-cutting areas of the tool, and failing to differentiate the independent contours of different cutting edges, making it difficult to obtain the accurate spatial pose of each cutting edge. In the material removal simulation, the generated swept body contains a large amount of redundant volume, only representing the spatial range covered by the sweep of the rotating body, and cannot obtain the morphology of the undeformed chips cut by the cutting edge, nor can it capture key information such as the micro-contour of the cutting edge and the inclination angle of the rake face.
[0005] The root cause of the above problems lies in the failure to fully extract and utilize the core geometric information of the cutting tool. It can only meet the geometric simulation requirements for judging collisions and roughly removing materials, but cannot provide the accurate contact state required for physical simulation. It is difficult to provide reliable data support for physical simulation links such as cutting force prediction and tool wear analysis. Summary of the Invention
[0006] To address the core shortcomings of existing CNC cutting simulation technologies, such as the imbalance between collision detection accuracy and efficiency and insufficient realism in material removal simulation, this invention provides a composite tool-workpiece contact detection and material removal simulation method that combines high precision, high efficiency, and high realism during the cutting process.
[0007] The method for detecting contact between a composite tool and a workpiece and simulating material removal during the cutting process of the present invention includes the following steps:
[0008] Step 1. Extraction of cutting edge feature points based on Open3D:
[0009] The tool STL model is imported into Open3d. The adjacent faces of the model's triangular facets are traversed and non-repeated adjacent faces are selected. The angle between the normal vectors of adjacent faces is calculated, and shared edges with an angle greater than a preset threshold are selected as candidate edges for the cutting edge. The candidate edges are connected to form candidate lines for the cutting edge, and candidate lines with a length less than a preset value are eliminated. The candidate lines are precisely selected in combination with the tool structure parameters, and then the point set is homogenized by curvature weighting to obtain the feature point set of the cutting edge.
[0010] Step 2. Constructing a hybrid bounding box based on Open3D:
[0011] Based on the triangular facets of the tool STL model, and combined with Open3d's geometric visualization capabilities and surface area heuristic (SAH) algorithm, a hybrid hierarchical structure of outer spherical bounding box and inner directed bounding box (OBB) is constructed to balance collision detection accuracy and efficiency.
[0012] Step 3. Construction and testing of the composite tool-workpiece contact judgment model:
[0013] Based on Open3d reading of the vertex coordinates of the tool's STL model, an outer spherical bounding box with its axis of rotation located on the tool's rotation axis is first constructed. Then, triangular faces within the spherical bounding box are selected to construct a parent directed bounding box (OBB), and four inner sub-bounding boxes are obtained according to a preset algorithm. A three-level progressive detection logic is adopted, consisting of coarse judgment of the spherical bounding box, fine judgment of the inner sub-bounding boxes, and confirmation by ray projection of the cutting edge feature point set. Combined with the effective intersection point statistical rules, the contact judgment between the tool and the workpiece is performed after each frame of motion, and the contact detection result is generated.
[0014] Step 4. Motion Control and Sweep Generation:
[0015] Set the sweep point and define the tool's spatial position; control the tool's movement through the displacement matrix and rotation matrix, and synchronously update the position and orientation of the sweep point, the mixed-level bounding box, and the cutting edge feature point set; when the cutting edge is detected to be in contact with the workpiece, record the cutting edge feature point set during the contact period, and obtain the tool sweep body through the dual-track sweep algorithm according to the preset trigger timing; perform Boolean difference operation between the sweep body and the workpiece model to obtain the machined workpiece model and the undeformed chip model;
[0016] Step 5. Material removal and animation demonstration.
[0017] The above steps are further limited as follows.
[0018] The first step includes the following specific processes:
[0019] (1) Call the adjacency_list property of the Open3d model. adjacency_list[i] returns a list containing the indices of all the faces that share a common edge with the ith triangular face (i.e., adjacent faces); traverse all the faces sharing an edge with face i (the ith triangular face), and only retain the faces with indices greater than i for calculation (to avoid duplicate calculations caused by the bidirectional recording feature of adjacency_list);
[0020] (2) Call the compute_triangle_normals() method of Open3d to automatically calculate the unit normal vectors of the triangular faces. Assume , , j > i, and substitute into the calculation formula:
[0021] ;
[0022] In the formula, is the angle between the unit normal vectors of the two faces; is the unit normal vector of the ith triangular face, x i , y i , z i are its three-dimensional components; is the unit normal vector of the jth triangular face, x j , y j , z j are its three-dimensional components;
[0023] When is greater than the preset threshold, it indicates that the shared edge formed by the two adjacent faces is a potential sharp edge, and this shared edge is a component edge of a candidate cutting edge line; since a tool may contain multiple cutting edges, multiple candidate cutting edge lines composed of several component edges will be extracted. The preset threshold is adjusted according to the tool type. The larger the threshold, the sharper the edge, with a value range of 60° to 80°;
[0024] (3) Obtain the vertex adjacency relationship of the candidate cutting edge line, extract the adjacent vertex coordinates from the adjacency_list property of the model and write them into the list L i , 0 < i < n, where n is the total number of candidate cutting edge lines, and calculate the distances l i of all the adjacent vertices in L j , 0 < j < m, where m represents the total number of component edges in this candidate line;
[0025] Connect the edges into a continuous curve according to vertex connectivity. For each candidate line's lj The cumulative arc length is obtained by summing. In the case where one vertex connects to multiple vertices, the arc length of each branch is summed separately, and only the longest side is retained. For all candidate lines, noise with a length less than 3mm is removed to obtain one or more cutting edge candidate lines.
[0026] (5) Conduct targeted screening based on the core structural features of different cutting tools to accurately locate the real cutting edge and eliminate interference edges of non-cutting edges;
[0027] For hobs, a theoretical helix reference is first generated based on the input key parameters such as the maximum outer diameter and helix angle of the hob. The minimum spatial distance between each point on the candidate cutting edge line and the corresponding position of the theoretical helix is calculated. Only line segments with a distance less than a set threshold (such as 0.1 mm) are retained to select the real cutting edge line that conforms to the structural characteristics of the hob.
[0028] For end mills, first fit the cylindrical generatrix reference where the main cutting edge is located based on the input end mill diameter, cutting edge length and other parameters, calculate the radial deviation of each point of the candidate cutting edge line from the cylindrical generatrix reference, and retain only the line segments with deviation less than the set threshold (such as 0.05mm) to determine the effective cutting edge line of the end mill.
[0029] (6) To homogenize the points on the effective cutting edge line, first calculate the weighted average of the unit normal vectors of adjacent vertices, using the length of adjacent edges as the weight:
[0030] ;
[0031] In the formula, V p These are the vertices where the weighted average normal vector needs to be calculated; N(V) p ) is vertex V p The set of adjacent vertices; V q It is a set N(V) p Any adjacent vertex in ); Vertex V p With adjacent vertex V q The length of the adjacent edge between them; It is the adjacent vertex V q The unit normal vector at that location;
[0032] Then, the curvature can be approximated by the angle between the vertex's own normal vector and the weighted average normal vector:
[0033] ;
[0034] In the formula, K(V) is the unit normal vector of the target vertex, directly extracted from Open3d; p The value range is 0~2;
[0035] (7) Set the curvature threshold K th Based on the sampling density ρ, K(V) is selected. p )>K th The vertices are used as reserved points, which divide an effective cutting edge into multiple intervals. The number of sampling points in each interval is obtained based on the sampling density and interval length. The coordinates of the sampling points in each interval are obtained by linear interpolation. Finally, the coordinates of the cutting edge point set are merged with the reserved points to obtain a list of cutting edge point coordinates. The closed curve of each cutting edge is generated according to the vertex connectivity.
[0036] The construction process of the outer spherical enclosure box in step two is as follows:
[0037] Based on Open3d's STL model loading capability, the tool's triangular mesh data is read, and the vertex coordinates are obtained through open3d.io.read_triangle_mesh. The smallest bounding sphere containing all vertices and whose axis is on the tool's rotation axis is calculated, with the radius being the distance from the center of the sphere to the farthest vertex.
[0038] The construction process of the inner directed bounding box (OBB) in step two is as follows:
[0039] Using Open3d's vertex indexing feature, all triangular faces falling within the spherical bounding box are precisely selected. Based on these selected triangular faces, a parent directed bounding box (parent OBB) is generated, which serves as the basis for the segmentation of the inner bounding box (OBB).
[0040] In determining the segmentation dimension, the longest axis of the model is selected as the height preservation direction, and a quadtree structure is used to implement segmentation in a two-dimensional plane perpendicular to the longest axis. Specifically, by setting two orthogonal segmentation lines in this two-dimensional plane, the projection rectangle of the parent bounding box (parent OBB) in the plane is divided into 4 sub-rectangles, forming a set of quadtree segmentation schemes.
[0041] Considering that the tool is a rotating model and the cutting edge is nearly uniformly distributed along the tool, the intersection of the orthogonal dividing lines is fixed on the tool axis. Multiple schemes are generated by changing the angle of the two dividing lines: with a fixed step of 5°, the dividing lines are rotated from 0° to 90°, generating a total of 18 dividing schemes in different directions.
[0042] For each candidate segmentation scheme, its segmentation cost is calculated using a surface area heuristic algorithm to quantitatively evaluate the scheme's merits: the surface area SA of the parent bounding box (parent OBB) is obtained based on Open3d. ParentThe surface areas SA1, SA2, SA3, and SA4 of the four candidate sub-bounding boxes (sub-OBBs) in this scheme are then calculated. Next, all the filtered triangular faces are traversed, and the number of triangular faces n1, n2, n3, and n4 contained within each sub-bounding box (sub-OBB) is counted. Finally, these parameters are substituted into the SAH cost formula:
[0043] ;
[0044] The program iterates through all candidate splitting schemes and calculates their respective C. SAH Then, the scheme with the lowest cost is selected as the final segmentation scheme; the four inner layer sub-bounding boxes (sub-OBBs) corresponding to this scheme can minimize the proportion of empty regions and reduce the average cost of subsequent detection, thereby achieving efficient inner layer OBB segmentation that fits the spatial distribution of model patches.
[0045] The specific process of step three includes:
[0046] (1) A hybrid layer bounding box is used as the pre-filtering layer and the cutting edge feature point set is used as the post-confirmation layer. The bounding box is used to filter out collision-free scenes quickly. Then, the point set detection accuracy is used to detect the starting point of potential collision scenes, forming a progressive logic of fast elimination of collision-free scenes and accurate confirmation of collisions. The spherical bounding box, the directed bounding box and the cutting edge point set are converted into wireframe models by open3d.geometry.LineSet, and different colors are assigned to them and they are rendered together with the tool model to verify the rationality of the generation.
[0047] (2) In the simulation, the composite detection is initiated after the tool completes one frame of movement. The process is as follows:
[0048] The first level is spherical bounding box detection: calculate the distance between the center of the tool and the center of the workpiece's spherical bounding box, compare the sum of the radii, if the distance between the center of the spheres is greater than the sum of the radii, it is determined that there is no collision, and the detection of this frame is terminated (it can filter more than 80% of non-contact scenes); otherwise, it enters the second level;
[0049] The second level is directed bounding box detection: obtain the inner bounding box of the tool and the workpiece, extract the three orthogonal local axes of the two, a total of six separation axes, project the vertices of the two bounding boxes onto each separation axis and calculate the projection range; if there is no overlap in the projection of any separation axis, it is determined that there is no potential collision and the detection is terminated; if all six axes overlap, proceed to the third level;
[0050] The third level is the cutting edge point set ray projection detection: Rays are emitted from each feature point of the cutting edge, and the effective intersection points with the workpiece triangular facets are counted: if the ray intersects the facet internally, the number of effective intersection points is incremented by 1; if the two have no intersection or intersect but are parallel, the number of effective intersection points remains unchanged; if the ray intersects the facet on the edge, the number of effective intersection points is incremented by 1, and other facets sharing the same edge are skipped; if the ray intersects the facet at a vertex, the number of effective intersection points is incremented by 1, and other facets sharing the same vertex are skipped; if the ray originates directly on the facet, the entire traversal process ends, and the point is determined to be on the model surface; after traversing all facets, if the number of effective intersection points is odd, the point is either inside the model or on the model surface, and it can be determined that the tool cutting edge is in contact with the workpiece; if the number of effective intersection points is even, the point is outside the model, and it is determined that the tool cutting edge is not in contact with the workpiece.
[0051] The specific process of step four is as follows:
[0052] The tool position point is set according to specific circumstances and G-code, defining the overall spatial position of the tool based on the tool position point. Two sweep points are extracted for each cutting edge to construct two sweep paths: in the point set of the cutting edge, the position of the tool tip is first determined and selected as the first sweep point. Simultaneously, in the point sequence of the cutting edge, the nth sampling point is selected along the extension direction of the cutting edge, based on the tool tip point, as the second sweep point. These two points represent both the axial direction of the cutting edge and indirectly reflect the spatial posture of the cutting edge after rotation around the tool axis. The n is determined according to the cutting edge sampling density, ensuring that the distance between the two points is ≥ 10% of the effective length of the cutting edge, and n = 20 is taken.
[0053] In motion control, for each frame the tool moves, two sets of transformation matrices need to be solved simultaneously: one set is a displacement matrix containing linear and circular interpolation, which is responsible for driving the position change of the overall tool model. It is directly applied to the model through Open3d's translate function to realize the change of its spatial position; the other set is a rotation matrix about the tool's own axis, which is adjusted by Open3d's rotate function to adjust the tool's attitude. The motion of the sweep point needs to be controlled by the combination of the above displacement matrix and rotation matrix, thereby driving the hybrid bounding box and the cutting edge point set to synchronously complete the update of position and attitude, ensuring that the local motion attitude and the overall position change are always coordinated.
[0054] After collision detection, if the cutting edge contacts the workpiece, the cutting edge point set of the current frame is recorded as the sweep surface boundary point. Subsequently, the sweep sub-body of the cutting edge is generated based on the motion trajectory of the sweep points within the corresponding motion range through the dual-track sweep algorithm. The generation of the sweep body is triggered in two ways: one is to continuously record the point set during the contact period, and stop recording and generate when there is no collision between the cutting edge and the workpiece; the other is to set a fixed angle interval, and generate once every time the tool rotates through the angle.
[0055] In step five, the material removal is achieved by integrating the sweeping sub-bodies of all cutting edges to construct a complete tool sweeping body. This body is then compared with the workpiece model using a Boolean difference operation to obtain the amount and shape of material removed within the corresponding motion range.
[0056] The animation demonstration in step five is based on Open3D. Using Open3D's 3D visualization capabilities, the pose information of the tool, workpiece, and swept body in each frame is rendered as an animation, achieving a visual demonstration of the machining process. Specifically, a frame-by-frame loading mode is adopted: each frame displays the current state model of each object, and the next frame loads the model after matrix operations to complete the motion and Boolean operations to update it, creating a dynamic effect through continuous playback. The animation frame rate can be adjusted within the range of 1 to 30 frames per second, which can meet the needs of real-time simulation while clearly visualizing the entire material removal process.
[0057] Compared with existing technologies, this invention focuses on the geometric information acquisition of key functional areas such as the cutting edge and rake face. Through feature edge extraction algorithms, collision detection mechanisms, and swept surface construction methods, it simultaneously solves the contradiction between accuracy and efficiency, as well as the deviation between simulation and actual scenarios. It achieves a technological leap from "geometric simulation" to "supporting physical simulation", and overcomes the inherent limitations of traditional technology's "tool equivalence simplification". It combines high precision, high efficiency, and high realism. Attached Figure Description
[0058] Figure 1 To implement the flowchart.
[0059] Figure 2 This is a schematic diagram of cutting edge extraction.
[0060] Figure 3 This is a schematic diagram of a composite detection model.
[0061] Figure 4 This is a schematic diagram showing the relative positions of the tool and the workpiece after tool setting.
[0062] Figure 5 This is a schematic diagram illustrating the principle for determining the number of valid intersections.
[0063] Figure 6 This is a schematic diagram of a dual-track swept body.
[0064] Figure 7 This is a schematic diagram of the tooth groove after one tooth has been machined.
[0065] Figure 8 This is a schematic diagram of the shape of the gear blank during the intermediate processing stage.
[0066] Figure 9 This is a schematic diagram of the tooth profile after machining.
[0067] Figure 10 This is a detailed schematic diagram of the gear after machining.
[0068] Figure 11 This is a schematic diagram of the complete user interface. Detailed Implementation
[0069] This invention addresses the inherent limitations of traditional "tool equivalence simplification" technology. It focuses on the precise extraction of the core geometric features of the tool as its core innovation, uses Open3d as a tool bridge, and leverages its advantages in STL model processing, bounding box construction, and 3D visualization to construct an automated full-process solution that integrates key tool feature extraction, collision detection, material removal simulation, and machining animation demonstration. This achieves automated full-process simulation with "high precision, high efficiency, and high realism".
[0070] Accurate extraction of the tool cutting edge point set is the core of the problem: On the one hand, the extracted cutting edge point set is combined with a hybrid layer bounding box to form a collision detection mechanism of "rapid coarse judgment of the outer bounding box and precise judgment of the inner cutting edge point set". This avoids the defects of high false judgment rate of traditional coarse-grained bounding boxes and large computational load of fine-grained bounding boxes, and can accurately locate the actual contact point between the cutting edge and the workpiece, effectively balancing the accuracy and efficiency of collision detection and meeting the requirements of real-time simulation (frame rate ≥30fps). On the other hand, the extracted cutting edge line is used as the core boundary of the sweep surface, combined with the rake face contour to form a closed sweep surface that fits the actual cutting area. This eliminates the redundant volume of non-cutting areas such as the tool holder and tool shank, and achieves accurate sweeping of the area traversed by the cutting edge. This significantly reduces the deviation between the sweep body and the real cutting area, and improves the realism of material removal simulation and the accuracy of undeformed chip extraction.
[0071] This invention utilizes Open3d as its core tool, leveraging its advantages in STL model processing, bounding box construction, and 3D visualization to construct an automated end-to-end solution integrating tool key feature extraction, collision detection, material removal simulation, and machining animation demonstration. This solution aims to address the balance between accuracy and efficiency in real-time machining simulation. The core of this solution is the accurate extraction of the tool cutting edge point set: on one hand, it combines this set with a hybrid hierarchical bounding box ("spherical bounding box + directed bounding box") to form a three-level collision detection mechanism. This avoids the high false positive rate or computational burden of traditional bounding boxes while meeting the real-time simulation requirement of ≥30fps. On the other hand, using the cutting edge line as the core boundary of the sweep surface, combined with the rake face contour, a closed sweep surface is formed, eliminating redundant volumes in non-cutting areas and significantly improving the realism of material removal simulation and the accuracy of extracting undeformed chips.
[0072] In terms of implementation process, firstly, Open3d is used to perform a series of operations on the tool STL model, such as screening the angle between the normal vectors of adjacent facets, connectivity analysis, noise culling, and curvature threshold sampling, to obtain a high-precision cutting edge point set. Simultaneously, an outer spherical bounding box adapted to the tool's rotational motion and an inner directed bounding box optimized based on the surface area heuristic (SAH) algorithm are constructed. Motion control is achieved by combining the homogeneous transformation matrix with the rotation matrix to realize synchronous control of the overall and local attitude of the tool. After each frame of tool movement, a three-level collision detection is initiated. When a collision occurs, the cutting edge point set is recorded. The dual-track sweep is triggered to generate a swept body according to "no collision stop" or "fixed angle interval". Boolean difference operation is performed with the workpiece model to complete material removal, realizing an automated continuous simulation process from real-time detection to material removal.
[0073] Figure 1 The flowchart of the composite tool-workpiece contact detection and material removal simulation method during the cutting process of this invention is given below in detail.
[0074] I. Cutting edge feature point extraction based on Open3d;
[0075] Open3d has strong STL model processing capabilities. Importing tool models into Open3d allows you to leverage its various features to simplify workflow operations.
[0076] (1) Call the adjacency_list property of the Open3d model. adjacency_list[i] returns a list containing the indices of all faces that share a common edge with the i-th triangle (i.e., adjacent faces). Iterate through all faces that share an edge with face i, and only keep faces with indices greater than i for calculation (to avoid duplicate calculations caused by the bidirectional recording feature of adjacency_list).
[0077] (2) Call the Open3d compute_triangle_normals() method to automatically calculate the unit normal vector of the triangular facet. Assume , Since j>i, substitute into the calculation formula:
[0078] ;
[0079] In the formula, It is the angle between the unit normal vectors of the two facets; x is the unit normal vector of the i-th triangular facet. i y i , z i It is its three-dimensional components; x is the unit normal vector of the j-th triangular facet. j y j , zj is its three-dimensional component.
[0080] When is greater than a preset threshold, it indicates that the shared edge formed by two adjacent patches is a potential sharp edge, and this shared edge is a component edge of a candidate cutting edge line; the preset threshold is adjusted according to the tool type, and the larger the threshold, the sharper the edge; usually, the value ranges from 60° to 80°.
[0081] (3) Obtain the vertex adjacency relationship of the candidate cutting edge line, and extract the adjacent vertex coordinates from the adjacency_list attribute of the model and write them into the list L i , 0 < i < n, where n is the total number of candidate cutting edge lines, and calculate L i the distances l of all adjacent vertices in j , 0 < j < m, where m represents the total number of component edges in this candidate line.
[0082] (4) Connect the edges into continuous curves according to vertex connectivity. For each candidate line, sum the l j to obtain the cumulative arc length. For the case where one vertex connects multiple vertices, sum the arc lengths of each branch separately, and only retain the longest edge. For all candidate lines, eliminate the noise with a length less than 3 mm to obtain one or more candidate cutting edge lines.
[0083] (5) Carry out targeted screening in combination with the core structural characteristics of different tools to accurately locate the real cutting edge and exclude the interference edges of non-cutting edges. For example, for a hob, first generate a theoretical helix reference based on the key parameters such as the maximum outer diameter and helix angle of the input hob, calculate the spatial minimum distance between each point on the candidate cutting edge line and the corresponding position of the helix, and only retain the line segments with a distance less than the set threshold (such as 0.1 mm) to screen out the real cutting edge line that conforms to the hob structural characteristics; for an end mill, first fit the cylindrical busbar reference where the main cutting edge is located according to the parameters such as the tool diameter and edge length of the input tool, calculate the radial deviation of each point on the candidate cutting edge line from the cylindrical busbar reference, and only retain the line segments with a deviation less than the set threshold (such as 0.05 mm) to determine the effective cutting edge line of the end mill.
[0084] (6) Uniformize the points on the effective cutting edge line. First, calculate the weighted average of the unit normal vectors of adjacent vertices with the length of the adjacent edge as the weight:
[0085] ;
[0086] In the formula, V p is the vertex for which the weighted average normal vector needs to be calculated currently; N(V <00Any adjacent vertex in ); Vertex V p With adjacent vertex V q The length of the adjacent edge between them; It is the adjacent vertex V q The unit normal vector at that location.
[0087] Then, the curvature can be approximated by the angle between the vertex's own normal vector and the weighted average normal vector:
[0088] ;
[0089] In the formula, K(V) is the unit normal vector of the target vertex, directly extracted from Open3d; p The value range is 0~2;
[0090] (7) Set the curvature threshold K th Based on the sampling density ρ, K(V) is selected. p )>K th The vertices are used as reserved points, which divide an effective cutting edge into multiple intervals. The number of sampling points in each interval is obtained based on the sampling density and interval length. The coordinates of the sampling points in each interval are obtained by linear interpolation. Finally, the coordinates of the cutting edge point set are merged with the reserved points to obtain a list of cutting edge point coordinates. The closed curve of each cutting edge is generated according to the vertex connectivity.
[0091] II. Construction of Hybrid Hierarchical Bounding Boxes Based on Open3d:
[0092] This method employs a hybrid algorithm based on a single-level bounding box. Using the triangular facets of the tool's STL model as a foundation, and combining Open3d's geometric visualization capabilities with the surface area heuristic (SAH) algorithm, a hybrid hierarchical structure of "spherical bounding box + directed bounding box" is constructed to balance collision detection accuracy and efficiency, as detailed below:
[0093] (1) Construct the outer spherical bounding box. Based on Open3d's STL model loading capability, read the tool's triangular facet data, obtain the vertex coordinates through open3d.io.read_triangle_mesh, and calculate the smallest bounding sphere containing all vertices with its axis on the tool's rotation axis. The radius is the distance from the center of the sphere to the farthest vertex. This layer does not require complex algorithms; only the sphere's center position needs to be updated when the tool moves, without adjusting the radius and shape, perfectly adapting to scenarios where the tool needs to rotate continuously.
[0094] (2) Construct the inner directed bounding box (OBB). Using Open3d’s vertex indexing function, all triangular faces that fall within the range of the spherical bounding box are precisely selected. Based on these selected triangular faces, a parent directed bounding box (parent OBB) is generated as the basis for the inner OBB segmentation.
[0095] Regarding the determination of the segmentation dimension, the longest axis of the model is selected as the height preservation direction, and a quadtree structure is used for segmentation in a two-dimensional plane perpendicular to the longest axis. Specifically, by setting two orthogonal segmentation lines in this two-dimensional plane, the projection rectangle of the parent OBB in the plane is divided into 4 sub-rectangles, forming a set of quadtree segmentation schemes.
[0096] Considering that the tool is a rotating model and the cutting edge is nearly uniformly distributed along the tool, the intersection of the orthogonal dividing lines is fixed on the tool axis. Multiple schemes are generated by changing the angle of the two dividing lines: with a fixed step of 5°, the dividing lines are rotated from 0° to 90°, generating a total of 18 dividing schemes in different directions.
[0097] For each candidate segmentation scheme, its segmentation cost is calculated using a surface area heuristic algorithm to quantitatively evaluate the scheme's merits: the surface area SA of the parent OBB is obtained based on Open3d. Parent The surface areas SA1, SA2, SA3, and SA4 of the four candidate sub-OBBs in this scheme are then calculated. Next, all the filtered triangular faces are traversed, and the number of triangular faces n1, n2, n3, and n4 contained within each sub-OBB are counted. Finally, these parameters are substituted into the SAH cost formula:
[0098] ;
[0099] The program iterates through all candidate splitting schemes and calculates their respective C. SAH Then, the scheme with the lowest cost is selected as the final segmentation scheme. The four inner sub-OBBs corresponding to this scheme can minimize the proportion of empty regions and reduce the average cost of subsequent detection, thereby achieving efficient inner OBB segmentation that fits the spatial distribution of model patches.
[0100] III. Construction and Testing of a Model for Determining Contact Between Composite Tools and Workpieces:
[0101] (1) A hybrid hierarchical bounding box is used as the pre-filtering layer and the cutting edge feature point set is used as the post-confirmation layer. The bounding box is used to quickly filter out collision-free scenes, and the point set detection accuracy is used to detect the starting point of potential collision scenes, forming a progressive logic of "quick elimination of collision-free scenes and accurate confirmation of collision scenes". The spherical bounding box, the directed bounding box and the cutting edge point set are converted into wireframe models by open3d.geometry.LineSet, and different colors are assigned to them and they are rendered together with the tool model to verify the rationality of the generation.
[0102] (2) In the simulation, the composite detection is initiated after the tool completes one frame of movement. The process is as follows:
[0103] The first level is spherical bounding box detection: calculate the distance between the center of the tool and the center of the workpiece's spherical bounding box, compare the sum of the radii, if the distance between the center of the spheres is greater than the sum of the radii, then it is determined that there is no collision, and the detection of this frame is terminated (this can filter more than 80% of non-contact scenes); otherwise, it proceeds to the second level.
[0104] The second level is the Directed Bounding Box (OBB) detection: The inner OBBs of the tool and workpiece are acquired, and six separation axes (three orthogonal local axes) are extracted. The vertices of the two OBBs are projected onto each separation axis, and the projection range is calculated. If any separation axis projection does not overlap, it is determined that there is no potential collision and the detection terminates; if all six axes overlap, the process proceeds to the third level.
[0105] The third level is the cutting edge point set ray projection detection: Rays are emitted from each feature point of the cutting edge, and the effective intersection points with the workpiece triangular facets are counted: If the ray intersects the facet internally, the number of effective intersection points is incremented by 1; if the two have no intersection or intersect but are parallel, the number of effective intersection points remains unchanged; if the ray intersects the facet at the edge, the number of effective intersection points is incremented by 1, and other facets sharing the same edge are skipped; if the ray intersects the facet at a vertex, the number of effective intersection points is incremented by 1, and other facets sharing the same vertex are skipped; if the ray originates directly on the facet, the entire traversal process ends, and the point is determined to be on the model surface. After traversing all facets, if the number of effective intersection points is odd, the point is either inside the model or on the model surface, and it can be determined that the tool cutting edge is in contact with the workpiece; if the number of effective intersection points is even, the point is outside the model, and it is determined that the tool cutting edge is not in contact with the workpiece.
[0106] IV. Motion Control and Sweep Generation:
[0107] The tool position point is set according to specific circumstances and G-code, defining the overall spatial position of the tool based on the tool position point. Two sweep points are extracted for each cutting edge to construct two sweep paths: In the point set of the cutting edge, the position of the tool tip is first determined and selected as the first sweep point. Simultaneously, in the point sequence of the cutting edge, based on the tool tip point, the nth sampling point (n is determined according to the cutting edge sampling density, ensuring that the distance between the two points is ≥ 10% of the effective length of the cutting edge) is selected as the second sweep point (n=20 in this paper). If the two sweep points are too close together, self-intersection and other problems will occur during dual-track sweeping. These two points not only represent the axial direction of the cutting edge but also indirectly reflect the spatial posture of the cutting edge after rotating around the tool axis.
[0108] In motion control, for each frame the tool moves, two sets of transformation matrices need to be solved simultaneously: one is a displacement matrix containing linear and circular interpolation, responsible for driving the overall position change of the tool model. This is directly applied to the model using Open3d's `translate` function to achieve the change in its spatial position. The other is a rotation matrix about the tool's own axis, which is used to adjust the tool's attitude using Open3d's `rotate` function. The motion of the sweep point needs to be controlled by a combination of the above displacement and rotation matrices, thereby driving the hybrid bounding box and the cutting edge point set to synchronously update their position and attitude, ensuring that the local motion attitude and the overall position change are always coordinated.
[0109] After collision detection, if the cutting edge contacts the workpiece, the cutting edge point set of the current frame is recorded as the sweep surface boundary point. Subsequent sweeps are generated based on the motion trajectory of the sweep points within the corresponding motion range using a dual-track sweep algorithm. The generation of the sweep body is triggered in two ways: first, by continuously recording the point set during the contact period, stopping recording and generating the sweep body when there is no collision between the cutting edge and the workpiece; second, by setting a fixed angular interval, generating the sweep body each time the tool rotates through that angle.
[0110] V. Material Removal and Animation Demonstration:
[0111] By integrating the sweeping sub-body of all cutting edges, a complete tool sweeping body is constructed. By performing Boolean difference operation between this body and the workpiece model, the amount and shape of material removed within the corresponding motion range can be obtained.
[0112] The animation demonstration is based on Open3d and uses a frame-by-frame loading mode: each frame displays the current state model of each object, and the next frame loads the model after matrix operations to complete the motion and Boolean operations to update it, creating a dynamic effect through continuous playback. The animation frame rate can be adjusted from 1 to 30 frames per second, which can meet the needs of real-time simulation and clearly visualize the entire material removal process.
[0113] The following is a specific implementation method using gear hobbing as an example.
[0114] 1. Model preprocessing and cutting edge feature point extraction;
[0115] The core of gear hobbing is the formation of involute tooth surfaces through the generating motion of the hob and gear blank. Therefore, a geometric model matching the machining parameters must first be loaded: the STL models of the hob and gear blank are loaded through the open3d.io.read_triangle_mesh interface of Open3d. Specifically, the hob model must match the basic parameters of the gear being machined (module m=4, outer diameter D). t =124mm, pressure angle α=20°, number of hobbing heads k=1, helix angle λ=2.06°); the gear blank model is a cylindrical blank (number of teeth z)p =20, outer diameter D p =88mm, aperture d=30mm, thickness h=10mm).
[0116] The helical cutting edge of the hob is key to achieving tooth surface generation; the extraction process is as follows:
[0117] (1) Call the adjacency_list attribute of the rolling cutter model to retain adjacent face pairs with index j>i (to avoid duplicate calculations); obtain the face normal vectors through the compute_triangle_normals() method. , If j>i, calculate the angle between the normal vectors:
[0118] ;
[0119] Because the hob's cutting edge is a sharp edge, the threshold is set to 80°, when... When the angle is greater than 80°, mark the common edge as a constituent edge of the candidate edge.
[0120] (2) Extract the coordinates of candidate edge vertices and calculate the distance l between adjacent vertices. j (Unit: mm) Connect the vertices to form a continuous curve. For the branch curves, retain the longest arc length branch and remove noise edges with a length <3mm to obtain 11 complete cutting edge candidate lines.
[0121] (3) Based on the input maximum outer diameter of the hob (124 mm) and helix angle (2.06°), the theoretical helix reference path of the hob is generated. The 11 candidate cutting edge lines are traversed, and the minimum spatial distance between each point on each line and the corresponding position of the theoretical helix is calculated. Only line segments with a distance less than the set threshold (0.1 mm) are retained, and non-cutting edge interference edges that deviate from the helix distribution are removed. Finally, 10 effective cutting edge lines that conform to the cutting edge structure characteristics of the hob are selected.
[0122] (4) Perform point set homogenization on the selected effective cutting edge lines:
[0123] Calculate the vertex weighted average normal vector:
[0124] ;
[0125] By the curvature formula:
[0126] ;
[0127] K th Select 0.2 and filter K(V) pFor points with a retention value greater than 0.2, linear interpolation is performed on the retention point interval at a sampling density of ρ = 3 points / mm. This yields approximately 750 uniformly distributed cutting edge points for each cutting edge, covering the effective cutting length of the hob (250mm). Finally, each cutting edge is connected into a closed curve, as shown below. Figure 2 As shown.
[0128] 2. Constructing bounding boxes using a rolling cutter with mixed layers;
[0129] Based on the motion characteristics of the hob's high-speed rotation (1000-2000 r / min) and axial feed, a hybrid hierarchical bounding box is constructed:
[0130] (1) Outer spherical bounding box: The hob's rotation axis is the Y-axis (in the preset tool coordinate system, the rotation axis is along the Y-axis direction). To ensure that the center of the sphere is on the rotation axis, the coordinates of the sphere center need to be constrained to (0, y). c ,0), where y c The mean of the Y coordinates of all vertices of the hob is the maximum value of the Euclidean distance from the center of the sphere to all vertices of the hob, which is the radius r of the enclosing sphere. In this example, the coordinates of the center of the sphere are (0, -0.0817, 0), and the radius is 83.81 mm.
[0131] (2) Inner layer directed bounding box: Based on the outer layer spherical bounding box (center (0, -0.0817, 0), radius 83.81 mm), the vertex indexing function of Open3d is used to accurately filter out triangular faces whose vertices are all within the spherical range, resulting in 91,200 valid faces. These faces constitute the core data for the construction of the inner layer OBB. Based on the filtered faces, a parent directed bounding box (parent OBB) that can completely enclose them is generated as the reference framework for subsequent segmentation operations. By calculating the length of each axis of the parent OBB, the longest axis (i.e., the tool rotation axis - Y-axis) is determined as the height preservation direction, and a quadtree structure is used for segmentation in the two-dimensional plane perpendicular to the longest axis.
[0132] Specifically, in a plane perpendicular to the longest axis, two orthogonal dividing lines are set with the projection point of the tool axis onto this plane as the fixed intersection point. These dividing lines are then rotated from 0° to 90° in 5° increments, generating 18 quadtree dividing schemes in different directions. Each scheme corresponds to a specific angle after the dividing lines are rotated. For each dividing scheme, the surface area SA of the parent OBB is obtained using Open3d. Parent And the surface areas SA1, SA2, SA3 and SA4 of the four sub-OBBs, count the number of triangular faces n1, n2, n3 and n4 contained in each sub-OBB, and substitute them into the SAH cost formula:
[0133] ;
[0134] The SAH cost, triangular patch distribution, and OBB surface area data for 18 schemes were calculated, and some data are shown in the table below:
[0135]
[0136] Analysis shows that the 20° scheme has the lowest SAH cost of 37491, so this scheme was selected as the final segmentation scheme. The four inner sub-OBBs corresponding to this scheme contain 21001, 25399, 20288, and 24512 triangular facets, respectively, and the generated bounding boxes can efficiently fit the spatial distribution characteristics of the model facets.
[0137] 3. Construction and validation of composite detection model;
[0138] In gear hobbing, the relative positional accuracy between the tool and the workpiece directly affects the pitch error. Therefore, it is necessary to strictly verify the geometric consistency of the composite detection model: The spherical bounding box (green), axial bounding box (blue), and the line connecting the cutting edge point set (red) are converted into a wireframe model using the open3d.geometry.LineSet interface. This wireframe model is then superimposed on the hob solid model to form the composite detection model, such as... Figure 3 As shown. After rendering in Open3d, verify the following metrics: the spherical bounding box completely covers the hob, the directed bounding box extends along the hob axis and its width matches the distribution range of the cutting edge, and the deviation between the cutting edge line and the actual cutting edge of the hob is ≤0.02mm.
[0139] 4. Motion matrix calculation;
[0140] The gear hobbing motion follows the generating method principle and requires the realization of three coordinated motions: hob rotation (main motion), workpiece rotation (tooth indexing motion, maintaining the transmission ratio i=z). p / z t =20), hob axial feed (forming tooth width), specifically controlled as follows: The G-code is parsed as a data dictionary, containing core parameters: hob speed n t =200r / min, gear blank rotation speed n p =10r / min, transmission ratio i=z p / z t =20, hob installation angle 2.06°, feed per tooth f=0.2mm / r.
[0141] At a frame rate of 30fps, the system first calculates the motion interpolation points for each frame: on one hand, it constructs an axial translation matrix based on the feed per tooth, and drives the tool along the gear blank axis to complete the feed motion using Open3d's translate function; on the other hand, it calculates and generates a rotation matrix based on the tool and workpiece rotation velocities, and uses Open3d's rotate function to achieve constant-speed rotation of the tool and workpiece around their own axes. Finally, through the spatial motion superposition of the translation and rotation matrices, iterative calculations of the new positions of the cutting edge point set and sweep point are completed, while the tool bounding box synchronously updates its spatial attitude following the composite motion matrix. Tool setting is performed through attitude updates. Hobbing is a roughing operation. Considering a 1mm machining allowance for the workpiece, the center distance between the hob and the workpiece is 97.5mm. The relative positions of the tool and workpiece after tool setting are as follows: Figure 4 As shown.
[0142] 5. Progressive contact detection;
[0143] The first-level detection focuses on the spherical bounding box of the hob and the gear blank, quickly eliminating collision-free scenarios. The initial center coordinates of the hob's spherical bounding box are (0, -0.0817, 0) (constrained by its rotation axis Y-axis). After matrix operations, a new center coordinate is obtained, with a radius of 83.81 mm. The center of the gear blank's spherical bounding box coincides with its own rotation axis, and its center coordinates remain (0, 0, 0), with a radius of 44 mm. The distance d between the two centers is calculated. If d > 83.81 + 44 = 127.81 mm, it is determined that there is no collision between the hob and the gear blank, and the detection in this frame terminates; if d ≤ 127.81 mm, the second-level detection begins.
[0144] The secondary detection employs an inner layer OBB optimized based on the SAH algorithm to improve the accuracy of potential collision screening. The detection targets are the four inner layer sub-OBBs of the hobbing cutter (generated by a 20° segmentation scheme, containing 21001, 25399, 20288, and 24512 triangular facets respectively) and the gear blank OBB. Six potential separation axes (each with its own local coordinate system X, Y, and Z axes) are extracted from the two OBBs, and all vertices are projected onto each axis to obtain the projection intervals. If the projection intervals of any separation axis do not overlap, no potential collision is determined; if the projections of all six axes overlap, the process proceeds to the tertiary detection stage.
[0145] The third-level inspection uses X-ray projection to precisely locate the cutting contact. Starting from the cutting edge point set of the hob, rays are emitted point by point, and the number of effective intersections between the rays and the gear blank surface is counted. The principle for determining the number of intersections is as follows: Figure 5 As shown, odd-numbered intersections indicate that the cutting edge is cutting into the tooth blank, while even-numbered intersections indicate no contact. If the starting point of the ray falls on the surface, it is directly determined to be a collision.
[0146] 6. Simulation of material removal and analysis of tooth surface morphology;
[0147] In the animation, the hob rotates 2° per frame, and the workpiece rotates 0.1° per frame. During the hob's first revolution, from frame 10 (first collision) to frame 190 (one hob revolution, completing the machining of one tooth), the cutting edge point set and trajectory point coordinates are continuously recorded (recorded once every 2° hob rotation). Based on the recorded trajectory, a sweep sub-body is generated using a dual-track sweep algorithm, with each 360° rotation of the hob as an interval. The sub-bodies are then merged to obtain the complete sweep body, as shown below. Figure 6 As shown.
[0148] Perform a Boolean difference operation between the swept body and the gear blank model to cut out the tooth grooves machined by the hob rotating once, such as Figure 7 As shown; using Open3d animation, the hobbing process is rendered frame-by-frame, depicting the hob rotation, axial feed, gear blank tooth splitting motion, and material removal, outputting a 30fps hobbing simulation animation. This clearly demonstrates the complete forming process from blank to finished gear, with the gear blank morphology during the intermediate processes as shown. Figure 8 As shown, the final tooth profile conforming to the tooth profile parameters (module 4mm, number of teeth 20) is obtained, as follows. Figure 9 As shown.
[0149] After enlarging the model and adjusting the viewing angle, the result is as follows: Figure 10 The detailed view shown allows for observation of the macroscopic morphology of the gear workpiece and provides a direct visual inspection of whether there are overcutting or undercutting phenomena in the tooth tip, tooth surface, and tooth root areas. It is quite obvious that there are specific machining marks in the tooth root transition curve area. The surface of this area exhibits a regular stepped morphology, manifested as a series of periodic stripes distributed along the workpiece axis. This phenomenon stems from the limited number of cutting edges per revolution of the hob, resulting in a discontinuous envelope forming process of the tooth root transition circle, making it impossible to form an ideal smooth surface. Therefore, the following improvement schemes can be deduced: (1) Reduce the axial feed per revolution of the hob; (2) Select a hob with more chip grooves; (3) Perform shaping treatment on the hob tooth tip and transition area.
[0150] 7. Display of undeformed chips and cutting edge point sets;
[0151] During gear machining simulation, the chip morphology generated during material removal and the point set area where the cutting edge enters the workpiece can be visualized in real time, intuitively recreating the dynamic interaction process of cutting. Furthermore, the system automatically counts the number of times each point in the discrete point set of the cutting edge enters the workpiece, accurately capturing the working state and contact frequency of the cutting edge. After starting the analysis module, the following will be presented: Figure 11 The complete user interface shown features a real-time chip display at the bottom and a cutting edge entry area marking and entry count statistics on the right, providing intuitive and comprehensive visualization support for dynamic monitoring of the machining process and subsequent error analysis.
Claims
1. A method for detecting contact between a composite tool and a workpiece and simulating material removal during a cutting process, characterized in that, Includes the following steps: Step 1. Extraction of cutting edge feature points based on Open3D: The tool STL model is imported into Open3d. The adjacent faces of the model's triangular facets are traversed and non-repeated adjacent faces are selected. The angle between the normal vectors of adjacent faces is calculated, and shared edges with an angle greater than a preset threshold are selected as candidate edges for the cutting edge. The candidate edges are connected to form candidate lines for the cutting edge, and candidate lines with a length less than a preset value are eliminated. The candidate lines are precisely selected in combination with the tool structure parameters, and then the point set is homogenized by curvature weighting to obtain the feature point set of the cutting edge. Step 2. Constructing a hybrid bounding box based on Open3D: Based on the triangular facets of the tool STL model, and combined with Open3d's geometric visualization capabilities and surface area heuristic algorithm, a hybrid hierarchical structure of outer spherical bounding boxes and inner oriented bounding boxes is constructed to balance collision detection accuracy and efficiency. Step 3. Construction and testing of the composite tool-workpiece contact judgment model: Based on Open3d reading of the vertex coordinates of the tool's STL model, an outer spherical bounding box with its axis of rotation located on the tool's rotation axis is first constructed. Then, triangular facets within this spherical bounding box are selected to construct a parent directed bounding box, and four inner sub-bounding boxes are obtained according to a preset algorithm. A three-level progressive detection logic is adopted, consisting of coarse judgment of the spherical bounding box, fine judgment of the inner sub-directed bounding boxes, and confirmation by ray projection of the cutting edge feature point set. Combined with the effective intersection point statistical rules, the contact judgment between the tool and the workpiece is performed after each frame of motion, and the contact detection result is generated. Step 4. Motion Control and Sweep Generation: Set the sweep point and define the tool's spatial position; control the tool's movement through the displacement matrix and rotation matrix, and synchronously update the position and orientation of the sweep point, the mixed-level bounding box, and the cutting edge feature point set; when the cutting edge is detected to be in contact with the workpiece, record the cutting edge feature point set during the contact period, and obtain the tool sweep body through the dual-track sweep algorithm according to the preset trigger timing; perform Boolean difference operation between the sweep body and the workpiece model to obtain the machined workpiece model and the undeformed chip model; Step 5. Material removal and animation demonstration.
2. The method for detecting contact between a composite tool and a workpiece and simulating material removal during the cutting process according to claim 1, characterized in that, Step one includes the following specific processes: (1) Call the adjacency_list property of the Open3d model. adjacency_list[i] returns a list containing the indices of all faces that share a common edge with the i-th triangle face; iterate through all faces that share an edge with face i, and only keep faces with indices greater than i for calculation. (2) Call the Open3d compute_triangle_normals method to automatically calculate the unit normal vector of the triangular facets, assuming , Since j>i, substitute into the calculation formula: ; In the formula, It is the angle between the unit normal vectors of the two facets; x is the unit normal vector of the i-th triangular facet. i y i , z i It is its three-dimensional components; x is the unit normal vector of the j-th triangular facet. j y j , z j It is its three-dimensional components; when If the value is greater than the preset threshold, it indicates that the shared edge formed by two adjacent facets is a potential sharp edge, and this shared edge is a component edge of a candidate cutting edge line; the preset threshold is adjusted according to the tool type, and the larger the threshold, the sharper the edge; (3) Obtain the vertex adjacency relationship of the cutting edge candidate line, and extract the adjacent vertex coordinates from the adjacency_list attribute of the model and write them into the list L i , 0 < i < n, where n is the total number of cutting edge candidate lines, and calculate L i the distances l of all adjacent vertices in j , 0 < j < m, where m represents the total number of edges forming the candidate line; (4) Connect the edges into a continuous curve according to vertex connectivity, and for each candidate line l j The cumulative arc length is obtained by summing. In the case where one vertex connects to multiple vertices, the arc length of each branch is summed separately, and only the longest side is retained. For all candidate lines, noise with a length less than 3mm is removed to obtain one or more cutting edge candidate lines. (5) Conduct targeted screening based on the core structural features of different cutting tools to accurately locate the real cutting edge and eliminate interference edges of non-cutting edges; (6) To homogenize the points on the effective cutting edge line, first calculate the weighted average of the unit normal vectors of adjacent vertices, using the length of adjacent edges as the weight: ; In the formula, V p These are the vertices where the weighted average normal vector needs to be calculated; N(V) p ) is vertex V p The set of adjacent vertices; V q It is a set N(V) p Any adjacent vertex in ); Vertex V p With adjacent vertex V q The length of the adjacent edge between them; It is the adjacent vertex V q The unit normal vector at that location; Then, the curvature can be approximated by the angle between the vertex's own normal vector and the weighted average normal vector: ; In the formula, K(V) is the unit normal vector of the target vertex, directly extracted from Open3d; p The value range is 0~2; (7) Set the curvature threshold K th Based on the sampling density ρ, K(V) is selected. p )>K th The vertices are used as reserved points, which divide an effective cutting edge into multiple intervals. The number of sampling points in each interval is obtained based on the sampling density and interval length. The coordinates of the sampling points in each interval are obtained by linear interpolation. Finally, the coordinates of the cutting edge point set are merged with the reserved points to obtain a list of cutting edge point coordinates. The closed curve of each cutting edge is generated according to the vertex connectivity.
3. The method for detecting contact between a composite tool and a workpiece and simulating material removal during the cutting process according to claim 2, characterized in that, In step (5), for the hob, a theoretical helical reference is first generated based on the input maximum outer diameter and helix angle of the hob. The minimum spatial distance between each point on the candidate cutting edge line and the corresponding position of the theoretical helical line is calculated. Only line segments with a distance less than a set threshold are retained, and the real cutting edge line that conforms to the structural characteristics of the hob is selected.
4. The method for detecting composite tool-workpiece contact and simulating material removal during cutting as described in claim 2, characterized in that, In step (5), for end mills, the cylindrical generatrix reference where the main cutting edge is located is first fitted according to the input end mill diameter and cutting edge length parameters. The radial deviation of each point of the candidate cutting edge line to the cylindrical generatrix reference is calculated. Only the line segments with deviations less than the set threshold are retained to determine the effective cutting edge line of the end mill.
5. The method for detecting composite tool-workpiece contact and simulating material removal during cutting as described in claim 1, characterized in that, The construction process of the outer spherical enclosure box in step two is as follows: Based on Open3d's STL model loading capability, the tool's triangular mesh data is read, and the vertex coordinates are obtained through open3d.io.read_triangle_mesh. The smallest bounding sphere containing all vertices and whose axis is on the tool's rotation axis is calculated, with the radius being the distance from the center of the sphere to the farthest vertex.
6. The method for detecting contact between a composite tool and a workpiece and simulating material removal during cutting, as described in claim 1, is characterized in that... The construction process of the inner layer directed bounding box in step two is as follows: Using Open3d's vertex indexing feature, all triangular faces falling within the spherical bounding box are precisely selected. Parent directed bounding boxes are then generated based on these selected triangular faces, serving as the basis for inner bounding box segmentation. In determining the segmentation dimension, the longest axis of the model is selected as the height retention direction, and a quadtree structure is used to implement the segmentation in a two-dimensional plane perpendicular to the longest axis. Specifically, by setting two orthogonal segmentation lines in this two-dimensional plane, the projection rectangle of the parent bounding box in the plane is divided into 4 sub-rectangles, forming a set of quadtree segmentation schemes. The intersection of the orthogonal dividing lines is fixed on the tool axis. Multiple schemes are generated by changing the angle of the two dividing lines: with a fixed step of 5°, the dividing lines are rotated from 0° to 90°, generating a total of 18 dividing schemes in different directions. For each candidate segmentation scheme, its segmentation cost is calculated using a surface area heuristic algorithm to quantitatively evaluate the scheme's merits: the surface area SA of the parent bounding box is obtained based on Open3d. Parent The surface areas SA1, SA2, SA3, and SA4 of the four candidate sub-bounding boxes in this scheme are then calculated. Next, all the filtered triangular faces are traversed, and the number of triangular faces n1, n2, n3, and n4 contained within each sub-bounding box are counted. Finally, these parameters are substituted into the SAH cost formula: ; The program iterates through all candidate splitting schemes and calculates their respective C. SAH Finally, the solution with the lowest cost is selected as the final partitioning solution.
7. The method for detecting composite tool-workpiece contact and simulating material removal during cutting as described in claim 1, characterized in that, The specific process of step three includes: (1) A hybrid layer bounding box is used as the pre-filtering layer and the cutting edge feature point set is used as the post-confirmation layer. The bounding box is used to filter out collision-free scenes quickly. Then, the point set detection accuracy is used to detect the starting point of potential collision scenes, forming a progressive logic of fast elimination of collision-free scenes and accurate confirmation of collisions. The spherical bounding box, the directed bounding box and the cutting edge point set are converted into wireframe models by open3d.geometry.LineSet, and different colors are assigned to them and they are rendered together with the tool model to verify the rationality of the generation. (2) In the simulation, the composite detection is initiated after the tool completes one frame of movement. The process is as follows: The first level is spherical bounding box detection: calculate the distance between the center of the tool and the center of the workpiece's spherical bounding box, compare the sum of the radii, if the distance between the center of the spheres is greater than the sum of the radii, then it is determined that there is no collision and the detection of this frame is terminated; otherwise, it proceeds to the second level. The second level is directed bounding box detection: obtain the inner bounding box of the tool and the workpiece, extract the three orthogonal local axes of the two, a total of six separation axes, project the vertices of the two bounding boxes onto each separation axis and calculate the projection range; if there is no overlap in the projection of any separation axis, it is determined that there is no potential collision and the detection is terminated; if all six axes overlap, proceed to the third level; The third level is the cutting edge point set ray projection detection: Rays are emitted from each feature point of the cutting edge, and the effective intersection points with the workpiece triangular facets are counted: if the ray intersects the facet internally, the number of effective intersection points is incremented by 1; if the two have no intersection or intersect but are parallel, the number of effective intersection points remains unchanged; if the ray intersects the facet on the edge, the number of effective intersection points is incremented by 1, and other facets sharing the same edge are skipped; if the ray intersects the facet at a vertex, the number of effective intersection points is incremented by 1, and other facets sharing the same vertex are skipped; if the ray originates directly on the facet, the entire traversal process ends, and the point is determined to be on the model surface; after traversing all facets, if the number of effective intersection points is odd, the point is either inside the model or on the model surface, and the cutting edge of the tool is determined to be in contact with the workpiece; if the number of effective intersection points is even, the point is outside the model, and the cutting edge of the tool is determined to be not in contact with the workpiece.
8. The method for detecting composite tool-workpiece contact and simulating material removal during cutting as described in claim 1, characterized in that, The specific process of step four is as follows: The tool position point is set according to specific circumstances and G-code, defining the overall spatial position of the tool based on the tool position point. Two sweep points are extracted for each cutting edge to construct two sweep paths: in the point set of the cutting edge, the position of the tool tip is first determined and selected as the first sweep point; simultaneously, in the point sequence of the cutting edge, the nth sampling point is selected along the extension direction of the cutting edge, based on the tool tip point, as the second sweep point. These two points represent both the axial direction of the cutting edge and indirectly reflect the spatial posture of the cutting edge after rotation around the tool axis. In motion control, two sets of transformation matrices need to be solved synchronously for each frame the tool moves. One set consists of a displacement matrix containing linear and circular interpolation, responsible for driving the overall position change of the tool model. It is directly applied to the model through Open3d's translate function to realize the change of its spatial position. The other set consists of a rotation matrix about the tool's own axis, which is adjusted by Open3d's rotate function to adjust the tool's attitude. The movement of the sweep point needs to be controlled by the combination of the above displacement matrix and rotation matrix, thereby driving the hybrid layer bounding box and the cutting edge point set to synchronously complete the update of position and attitude, ensuring that the local motion attitude and the overall position change are always coordinated. After collision detection, if the cutting edge contacts the workpiece, the cutting edge point set of the current frame is recorded as the sweep surface boundary point. Subsequently, the sweep sub-body of the cutting edge is generated based on the motion trajectory of the sweep points within the corresponding motion range through the dual-track sweep algorithm. The generation of the sweep body is triggered in two ways: one is to continuously record the point set during the contact period, and stop recording and generate when there is no collision between the cutting edge and the workpiece; the other is to set a fixed angle interval, and generate once every time the tool rotates through the angle.
9. The method for detecting contact between a composite tool and a workpiece and simulating material removal during the cutting process according to claim 8, characterized in that, The value of n is determined based on the sampling density of the cutting edge, ensuring that the distance between two points is greater than or equal to 10% of the effective length of the cutting edge, and n = 20 is taken.
10. The method for detecting composite tool-workpiece contact and simulating material removal during cutting as described in claim 1, characterized in that, The material removal in step five involves integrating all the sweeping sub-bodies of the cutting edges to construct a complete tool sweeping body, and then performing a Boolean difference operation between it and the workpiece model to obtain the amount and shape of material removed within the corresponding motion range. The animation demonstration in step five is based on Open3d. Through Open3d's three-dimensional visualization function, the pose information of the tool, workpiece and sweep body in each frame is rendered into an animation to realize a visual demonstration of the machining process.
Citation Information
Patent Citations
Implicit function-based bump detection method for five-axis machining for complex curved surface
CN108469785A
Five-axis numerical control machining simulation-oriented tool swept volume entity modeling method
CN120688104A
STL-model-based material removal algorithm in numeral control machining geometric simulation
CN107037738A
Auxiliary machining quality evaluation method based on three-dimensional point cloud data, medium and equipment
CN119444736A