A method and system for 3D modeling of CNC milling machine workpieces
A CNC milling machine system using an industrial camera and a dual-sided line laser has been developed to achieve high-precision 3D modeling of spiral groove workpieces, solving the problems of missing groove bottom data and excessive noise in traditional methods, and improving detection accuracy and efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JIANGXI SPECIAL ELECTRIC MOTOR CO LTD
- Filing Date
- 2026-01-16
- Publication Date
- 2026-07-31
AI Technical Summary
Traditional 3D modeling methods are difficult to effectively handle the deep groove structure with small helix angle of spiral groove workpieces (such as ball screws and worm gears), resulting in insufficient lighting at the bottom of the groove, missing point cloud data and excessive noise, making it impossible to accurately restore the geometric features of the spiral groove.
By acquiring a sequence of spiral images using an industrial camera, calculating path deviations and correcting the linkage parameters of the CNC milling machine, and combining this with complementary projection of the bottom of the spiral groove using dual-side line lasers, full-coverage acquisition is achieved. Spatiotemporal registration and texture mapping are then performed to generate high-precision 3D point cloud data.
It enables seamless acquisition of deep groove structures with small helical angles, eliminates visual obstruction, improves the detection accuracy and modeling efficiency of helical groove workpieces, and reduces the correction costs caused by model reconstruction distortion.
Smart Images

Figure CN121999175B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method and system for three-dimensional modeling of CNC milling machine workpieces. Background Technology
[0002] The key features of 3D modeling technology for helical groove workpieces (such as ball screws and worm gears) in CNC machining are their accuracy and completeness in reproducing continuous complex curved surfaces, aspect ratio structures, and high-precision geometric parameters (such as pitch and lead angle). These workpieces, during actual machining and inspection, exhibit continuous helical groove structures, often accompanied by large aspect ratios and small helix angles (typically less than 15°). These structural factors necessitate addressing challenges such as cross-scale motion splicing, deep groove optical occlusion, and the coordination of rotation and axial feed during 3D reconstruction. However, traditional 3D modeling methods are limited by optical imaging principles. When processing deep groove structures with small helix angles, external light sources are easily blocked by the dense screw threads, leading to insufficient illumination at the bottom of the helical groove. This results in large-area loss of point cloud data at the groove bottom or excessive noise, making it impossible to completely reproduce the cross-sectional contour. Consequently, this leads to excessive deviations in the cumulative pitch measurement and distortion in the reconstructed helical groove cross-sectional contour. Summary of the Invention
[0003] Based on this, the present invention provides a method and system for three-dimensional modeling of CNC milling machine workpieces to solve at least one of the above-mentioned technical problems.
[0004] To achieve the above objectives, a method for three-dimensional modeling of CNC milling machine workpieces includes the following steps: Step S1: Clamp the workpiece on a CNC milling machine, control the workpiece to rotate at a constant speed and feed it axially at the same time, and use an industrial camera to acquire surface images along the spiral unfolding path to obtain an initial spiral image sequence. Step S2: Calculate the deviation between the actual spiral path and the theoretical path based on the initial spiral image sequence, and use the corresponding deviation to correct the linkage control parameters of the CNC milling machine to drive the workpiece to perform a secondary spiral advance. During the secondary spiral advance, the corrected spiral image sequence and the groove bottom image sequence are acquired simultaneously. Step S3: Obtain the motion position of the CNC milling machine during the turning process, and perform spatiotemporal registration of the correction spiral image sequence and the groove bottom image sequence to extract workpiece modeling feature data; Step S4: Based on the workpiece modeling feature data, perform the polar coordinate to rectangular coordinate conversion, calculate the three-dimensional spatial coordinates and their corresponding surface attribute values, and generate the workpiece three-dimensional point cloud data; Step S5: Input the 3D point cloud data of the workpiece into the 3D modeling software, and obtain the 3D digital model of the workpiece through meshing and texture rendering.
[0005] The present invention also provides a three-dimensional modeling system for CNC milling machine workpieces, which executes the three-dimensional modeling method for CNC milling machine workpieces as described above. The three-dimensional modeling system for CNC milling machine workpieces includes: The workpiece pre-scanning module is used to clamp the workpiece on the CNC milling machine, control the workpiece to rotate at a constant speed and feed axially synchronously, and use an industrial camera to acquire surface images along the spiral unfolding path to obtain an initial spiral image sequence. The image acquisition module is used to calculate the deviation between the actual spiral path and the theoretical path based on the initial spiral image sequence, and to use the corresponding deviation to correct the linkage control parameters of the CNC milling machine to drive the workpiece to perform a secondary spiraling motion. During the secondary spiraling process, the corrected spiral image sequence and the groove bottom image sequence are acquired and corrected simultaneously. The feature extraction module is used to obtain the motion position of the CNC milling machine during the turning process, and to perform spatiotemporal registration of the correction spiral image sequence and the groove bottom image sequence to extract workpiece modeling feature data; The point cloud mapping module is used to perform polar coordinate to rectangular coordinate conversion on the workpiece modeling feature data, calculate the three-dimensional spatial coordinates and their corresponding surface attribute values, and generate three-dimensional point cloud data of the workpiece. The 3D modeling and rendering module is used to input the 3D point cloud data of the workpiece into the 3D modeling software, and obtain the 3D digital model of the workpiece through meshing and texture rendering.
[0006] The beneficial effects of this invention are as follows: By calculating path deviations based on the initial image sequence and correcting the CNC milling machine's linkage parameters, the workpiece is driven to perform adaptive tracking helical motion. Simultaneously, dual-sided line lasers provide complementary projection onto the bottom of the helical groove, achieving comprehensive, blind-spot-free acquisition of deep groove structures with small helix angles (less than 15°). During adaptive tracking, the acquisition device remains in the center of the helical groove's field of view. The dual-sided lasers effectively avoid visual obstruction caused by dense threads, accurately acquiring complete groove bottom depth information and surface texture. This acquisition method can compensate for trajectory deviations caused by workpiece manufacturing errors in real time, avoiding the problems of large-area data loss and excessive noise in traditional methods due to lighting obstruction and fixed paths.
[0007] Based on the real-time feedback of motion position from the CNC milling machine, spatiotemporal registration is performed between the correction helical image sequence and the groove bottom image sequence, followed by texture mapping processing. This ensures the geometric topological accuracy of the workpiece in the 3D reconstruction process. Utilizing high-precision machine tool coordinates as rigid constraints eliminates the cumulative drift caused by pure visual stitching, accurately reproducing the cumulative pitch error and lead angle characteristics of the workpiece. This spatiotemporal registration-based modeling mechanism avoids the helical unfolding distortion caused by asynchronous rotation and translation in existing technologies, significantly improving the detection accuracy of precision transmission components such as ball screws and worm gears.
[0008] Based on the workpiece modeling feature data, a polar coordinate to Cartesian coordinate conversion is performed to calculate the 3D spatial coordinates and their corresponding surface attribute values, generating 3D point cloud data of the workpiece containing geometric position and surface attributes. This data processing method can efficiently integrate multi-source heterogeneous monitoring data (laser depth and camera texture) into a 3D digital model with clear physical and visual meaning. In practical applications, whether for ball screws with continuous helical groove structures or irregular worm gears, this method can quickly process massive amounts of scanning data and convert them into intuitive, high-precision 3D point clouds. This efficient data processing and application method improves the efficiency and automation of 3D modeling of helical workpieces and reduces the subsequent correction costs caused by model reconstruction distortion. Attached Figure Description
[0009] Figure 1 This is a schematic diagram of the steps in the CNC milling machine workpiece three-dimensional modeling method of the present invention; Figure 2 This is a schematic diagram of the modules of the CNC milling machine workpiece three-dimensional modeling system of the present invention; Figure 3 This is an example diagram of three-dimensional point cloud modeling of ball screws in this invention; Figure 4 This is a schematic diagram of the three-dimensional modeling structure of the spiral groove workpiece of the present invention; The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0010] The technical method of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0011] Furthermore, the accompanying drawings are merely illustrative of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor methods and / or microcontroller methods.
[0012] It should be understood that although the terms "first," "second," etc., may be used herein to describe various units, these units should not be limited by these terms. These terms are used merely to distinguish one unit from another. For example, without departing from the scope of the exemplary embodiments, a first unit may be referred to as a second unit, and similarly, a second unit may be referred to as a first unit. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0013] To achieve the above objectives, please refer to Figures 1 to 4 This invention provides a method for three-dimensional modeling of CNC milling machine workpieces, comprising the following steps: Preferably, step S1: clamp the workpiece on a CNC milling machine, control the workpiece to rotate at a uniform speed and feed it axially at the same time, and use an industrial camera to acquire surface images along the spiral unfolding path to obtain an initial spiral image sequence. Optionally, step S1, which involves controlling the workpiece to rotate at a constant speed and simultaneously performing axial feed, includes: Obtain the theoretical lead value and diameter of the workpiece; Calculate the theoretical axial feed per revolution of the workpiece based on the theoretical lead value; The theoretical axial feed rate is input into the linkage control unit of the CNC milling machine to generate a control command that makes the rotary axis and the translation axis move synchronously in a fixed ratio, which is used as the first control command. The workpiece is controlled to rotate at a constant speed and be fed axially synchronously based on the first control command.
[0014] In one embodiment, the specific operation for obtaining the theoretical lead value and diameter of the workpiece is as follows: the operator retrieves the computer-aided design drawing data of the workpiece to be measured through the human-machine interface of the CNC milling machine; and extracts the geometric parameters of the workpiece from the attribute list of the drawing data.
[0015] In one implementation of this embodiment, when calculating the theoretical axial feed per revolution of the workpiece based on the theoretical lead value, the following calculation logic is used: First, the angular resolution of the rotary axis and the linear resolution of the translation axis of the CNC milling machine are determined; in this embodiment, the minimum command unit for the rotary axis is 0.001 degrees, and the minimum command unit for the translation axis is 0.001 millimeters. A linear mapping relationship between the rotation angle and the axial displacement is established, and the calculation formula is as follows: ; in, This is the theoretical axial feed rate. The angle through which the axis of rotation rotates. This is the theoretical lead value. It should be noted that this is calculated when the workpiece rotates one revolution. When equal to 360 degrees, the theoretical axial feed rate The value is directly equal to the theoretical lead value; this value is stored in the register of the motion controller as a reference synchronization parameter.
[0016] In another operation step of this embodiment, the process of inputting the theoretical axial feed amount into the linkage control unit of the CNC milling machine to generate the first control command is as follows: The linkage control unit adopts an electronic gear ratio control mode, sets the rotary axis as the master axis and the translation axis as the slave axis; and sets the electronic gear ratio of the master and slave axes according to the theoretical lead value. The servo drive system of the CNC milling machine is started, and the constant speed of the rotary axis is set to 60 revolutions per minute; according to the first control command, the linkage control unit drives the rotary axis to rotate at 60 revolutions per minute while simultaneously driving the translation axis to translate along the workpiece axis at a speed of 6 millimeters per second; during the movement, the grating ruler of the CNC system provides real-time feedback on the actual position of the translation axis, and the encoder provides real-time feedback on the actual angle of the rotary axis, monitoring the synchronization error between the two. If the synchronization error exceeds 0.01 millimeters, an alarm is immediately triggered and the movement is stopped.
[0017] Preferably, step S2: calculate the deviation between the actual spiral path and the theoretical path based on the initial spiral image sequence, and use the corresponding deviation to correct the linkage control parameters of the CNC milling machine to drive the workpiece to perform a secondary spiral advance motion. During the secondary spiral advance process, the corrected spiral image sequence and the groove bottom image sequence are acquired simultaneously. Optionally, step S2, which involves correcting the linkage control parameters of the CNC milling machine using the corresponding deviation to drive the workpiece to perform a secondary rotary motion, includes: In each frame of the initial spiral image sequence, grayscale scanning is performed along the spiral groove extension direction to identify grayscale peak points, and two adjacent peak points are defined as the spiral tooth period. Calculate the actual helix angle for each thread cycle to determine the linkage proportional compensation amount; The first control command is adjusted by the linkage proportional compensation amount to obtain the corrected second control command. The second control command is updated to the linkage control unit of the CNC milling machine, driving the workpiece to run along the corrected trajectory.
[0018] In one embodiment, an initial spiral image sequence acquired by an industrial camera is read, and each frame of the image in the sequence is preprocessed to extract a region of interest containing spiral groove texture features. Within the region of interest, a two-dimensional coordinate system in pixels is established, and the scanning path is set parallel to the horizontal axis of the image. The grayscale values of pixels are read one by one along the scanning path to generate a grayscale distribution curve. The grayscale distribution curve is subjected to extreme value detection using a first-order difference thresholding method to identify the points with the local maximum grayscale value as grayscale peak points. These points correspond to the ridge reflection positions of the workpiece screw thread. The pixel coordinates of all grayscale peak points are recorded, and the data segment between two adjacent grayscale peak points appearing in the horizontal direction in the image is defined as a complete screw thread cycle.
[0019] In another operation step of this embodiment, adjusting the first control command by means of the linkage proportional compensation amount to obtain the corrected second control command specifically involves: reading the numerator and denominator of the translation axis electronic gear ratio set in the first control command; correcting the pulse transmission frequency of the translation axis using the linkage proportional compensation amount, or directly adjusting the feed rate parameter of the linkage control unit to generate a set of commands containing the corrected pulse frequency or feed rate, and marking it as the second control command.
[0020] In one embodiment, driving the workpiece to run along the corrected trajectory includes: using the macro variable interface of the CNC system to write the key parameters in the second control command into the system variable address of the controller in real time; when the next interpolation cycle arrives, the updated system variable is automatically called to drive the rotary axis to maintain the original speed of 60 revolutions per minute, while driving the translation axis to adjust the speed from 6 mm / s to 6.02 mm / s; thus, during one rotation of the workpiece, the axial translation distance accurately matches the actual lead value of 6.02 mm, ensuring that the optical axis of the acquisition device is always vertically aligned with the center position of the spiral groove, avoiding the deviation of the groove bottom field of view caused by workpiece manufacturing errors.
[0021] Please see Figure 4This is a schematic diagram of the three-dimensional modeling structure of the spiral groove workpiece of the present invention. The spiral groove workpiece is a cylindrical structure with continuous spiral groove features. It is fixed on a CNC milling machine by a rotating shaft support. The rotating shaft support includes two symmetrically distributed bearing seats, which are respectively installed at both ends of the workpiece to support the workpiece and achieve synchronous rotational motion. The industrial camera is an area array image acquisition device, installed on the side of the workpiece, with the lens aimed at the workpiece surface, used to continuously acquire texture image sequences of the workpiece surface along the spiral unfolding path. Laser 1 and laser 2 are structured light projection devices configured on both sides, symmetrically installed on both sides of the workpiece. The laser emitting unit directly projects a linear laser beam to the bottom of the spiral groove. The laser beam penetrates the screw thread gap and reaches the bottom surface of the groove, achieving effective imaging of the deep groove area. The system includes an industrial camera that receives the light stripe image formed by the laser at the bottom of the tank to extract depth information; a rotary axis encoder, an angular position sensor installed at the drive end of the rotary axis, detects the rotation angle of the workpiece in real time and outputs an angular displacement signal; a translation axis encoder, a linear position sensor installed at the feed end of the translation axis, detects the axial position of the workpiece in real time and outputs a displacement signal; and a linkage control unit, the core processing module of the CNC system, receives position feedback signals from the rotary axis encoder and the translation axis encoder, and coordinates the synchronous execution of the rotational motion and the axial feed motion according to preset linkage ratio parameters to ensure that the workpiece completes a precise spiraling motion along a helical path.
[0022] Of particular importance is calculating the actual helix angle for each thread cycle to determine the linkage proportional compensation amount, including: Calculate the actual helix angle for each thread cycle; The theoretical helix angle is calculated based on the workpiece's theoretical lead value and diameter. Subtract the actual helix angle from the theoretical helix angle to obtain the helix angle deviation for that thread cycle; calculate the average helix angle deviation for multiple consecutive thread cycles as the path deviation; The linkage ratio compensation amount is calculated based on the path deviation.
[0023] In one implementation of this embodiment, the theoretical helix angle is calculated using the basic geometric formulas of a spiral. The calculation formula is: ; In the formula, The theoretical helix angle; This is the theoretical lead value; The diameter is the workpiece diameter; the theoretical helix angle is stored as a constant reference comparison value in the system's temporary memory.
[0024] In another embodiment, the method for calculating the linkage proportional compensation amount based on path deviation is to construct a correction coefficient model based on the tangent function. This model aims to compensate for angular errors by adjusting the proportional relationship between axial feed rate and rotational speed; linkage proportional compensation amount. The calculation formula is as follows: ; In the formula, This is a dimensionless linkage proportional compensation amount. The theoretical helix angle obtained from the aforementioned calculations; The path deviation is statistically obtained; the physical meaning of this formula is to calculate the axial feed rate ratio required to maintain the helical motion trajectory based on the angular offset of the actual path relative to the theoretical path. When the value is greater than 1, it indicates that the axial feed rate needs to be increased to match the larger actual helix angle, and vice versa.
[0025] It should be added that the calculation of the actual helix angle for each thread cycle includes: Record the workpiece's rotation angle and axial position when the initial peak point occurs within each thread cycle, as the cycle start point data; Record the rotation angle and axial position at the peak point at the end of the cycle as the data for the end of the cycle. The actual helix angle of the thread cycle is calculated based on the axial displacement difference and angle difference between the data at the start and end of the cycle.
[0026] In one embodiment, the specific operation of recording the workpiece's rotation angle and axial position when the starting peak point appears in each thread cycle is as follows: when the vision acquisition system identifies the first grayscale peak point marking the start of the thread cycle in the image sequence, it immediately triggers the synchronization signal latching function; this function instructs the motion controller of the CNC system to freeze the current coordinate state, read the absolute angle value fed back by the rotary axis encoder and the axial coordinate value fed back by the linear axis grating ruler; these two values are associated and stored, defined as cycle start point data, and the data structure includes frame index number, absolute angle value and axial coordinate value.
[0027] Similarly, when the vision acquisition system identifies the next adjacent grayscale peak point that marks the end of the screw thread cycle, it triggers the synchronization signal latching function again, reads the absolute angle value of the rotary axis encoder and the axial coordinate value of the linear axis grating ruler at this time, and stores them as cycle end point data.
[0028] It should be noted that the mathematical model for calculating the actual helix angle of this thread cycle is constructed as follows: ; In the formula, This represents the calculated actual helix angle of the thread cycle, in degrees. This represents the calculated difference in axial displacement, in millimeters. This represents the calculated angle difference, in degrees. This indicates the pre-obtained workpiece diameter, in millimeters. Pi is the mathematical constant of a circle. This formula converts the rotation angle into the corresponding circumferential arc length and uses geometric trigonometric relationships to accurately calculate the true helical tilt angle of the current thread cycle in physical space.
[0029] Preferably, step S3: obtain the motion position of the CNC milling machine during the turning process, and perform spatiotemporal registration of the correction spiral image sequence and the groove bottom image sequence to extract workpiece modeling feature data; Optionally, step S3, which involves acquiring the motion position of the CNC milling machine during the turning process and performing spatiotemporal registration of the corrected helix image sequence and the groove bottom image sequence, includes: During the secondary spiral advance, a sequence of images of the bottom of the spiral groove of the workpiece is simultaneously acquired by projecting images onto the bottom of the groove using a dual-side line laser. Based on the real-time readings fed back by the rotary axis encoder and translation axis encoder of the CNC milling machine at the moment of each frame image acquisition, a first index containing rotation angle and axial position is generated for each frame image in the corrected spiral image sequence, and a corresponding second index is generated for each frame image in the groove bottom image sequence. The spiral image with the same first index and second index is paired with the groove bottom enhancement image to form an image pair to be fused.
[0030] In one embodiment, during the secondary spiral advance process, the operation of simultaneously acquiring a sequence of images of the bottom of the spiral groove by projecting images onto the workpiece using dual-sided line lasers is as follows: blue line lasers with a wavelength of 450 nanometers are installed on both sides of the workpiece, and the illumination angle of the lasers is adjusted so that their light planes form a 45-degree angle with the optical axis of the camera, thereby complementaryly illuminating the left and right sidewalls and the bottom of the spiral groove; when the CNC milling machine drives the workpiece to perform the corrected secondary spiral advance motion, a high frame rate industrial camera is triggered to acquire images; the camera adopts a multi-exposure mode, alternately acquiring two frames of images at the same field of view: the first frame has the laser off, and only ambient diffuse light is used to acquire the texture information of the workpiece surface, which is recorded as the corrected spiral image; the second frame has the laser on, and the laser stripe pattern projected on the surface of the spiral groove is acquired, which is recorded as the bottom image; this cycle is repeated until the entire length of the workpiece is covered, forming two sets of one-to-one corresponding image sequences.
[0031] In one implementation of this embodiment, an electrical connection is established between the camera exposure signal and the high-speed position latch port of the CNC system. When the camera starts acquiring the correction spiral image, a first strobe signal is output to the CNC system, triggering the system to latch the current rotation axis angle value and translation axis coordinate value. This set of position data is packaged and timestamped to generate a first index. Then, when the camera acquires the bottom image of the trench, a second strobe signal is output, triggering the system to latch the position data again to generate a second index.
[0032] In this embodiment of the invention, a position matching tolerance threshold is set, wherein the rotation angle tolerance is set to 0.01 degrees and the axial position tolerance is set to 0.001 millimeters; each first index in the correction spiral image sequence is traversed, and a search is performed in all second indices of the trough bottom image sequence; the absolute value of the difference between the coordinate values of the first index and the candidate second index is calculated; if the absolute value of the rotation angle difference is less than 0.01 degrees and the absolute value of the axial position difference is less than 0.001 millimeters, it is determined that the images corresponding to these two indices were acquired near the same spatial location; a correction spiral image that meets the above conditions is bound to a trough bottom image, and defined as a pair of images to be fused; the above steps are repeated until the pairing of all sequence images is completed, and redundant frames that cannot be matched are removed.
[0033] Optionally, step S3, which involves acquiring the motion position of the CNC milling machine during the turning process and performing spatiotemporal registration of the corrected helix image sequence and the groove bottom image sequence, further includes: Construct a cylindrical unfolding mapping space for the workpiece, where the horizontal axis is defined as the unfolding length of the workpiece's rotational phase and the vertical axis is defined as the workpiece's axial feed position. Extract the first index from the image pair to be fused, and calculate the texture projection region of each frame of spiral image in the cylindrical unfolding mapping space by combining the internal and external calibration parameters of the industrial camera. For overlapping pixels within the texture projection area, calculate the angle between the pixel's line of sight during imaging and the workpiece surface normal, and select the pixel value with the smallest angle to fill the cylindrical unfolding mapping space to form spiral texture distribution data. The center position of the light stripe in the enhanced image of the trench bottom in the image to be fused is identified and converted into a radial depth value. Based on the second index, the radial depth value is mapped to the cylindrical unfolding mapping space to form spiral depth topology data.
[0034] In one embodiment, constructing the cylindrical unfolding mapping space of the workpiece specifically includes: opening a two-dimensional digital matrix storage area in computer memory, the width of which corresponds to the unfolding length of the cumulative circumferential surface area of the workpiece after one or more rotations, and the height corresponding to the physical length of the workpiece in the axial travel. In one implementation of this embodiment, the process of calculating the texture projection region of each frame of the spiral image in the cylindrical unfolding mapping space is as follows: read the rotation angle and axial position data contained in the first index of the image pair to be fused, and determine the pose of the camera relative to the workpiece in the world coordinate system when capturing the image of that frame; call the pre-calibrated camera intrinsic parameter matrix (including focal length, principal point coordinates) and distortion coefficients, and use the inverse transformation of the pinhole imaging model to project the four corner pixels of the corrected spiral image inversely into the cylindrical unfolding mapping space to obtain an irregular quadrilateral region, which is the texture projection region; all the grid points in this region are the workpiece surface range covered by the current frame image.
[0035] Crucially, the operation of calculating the included angle and selecting the pixel value for overlapping pixels within the texture projection region is as follows: When texture projection regions from multiple different frames cover the same grid point in the cylindrical unfolded mapping space, the system needs to determine which frame's pixel to select as the best texture; for each candidate pixel, a gaze vector is constructed from the camera's optical center to the physical location of that grid point. Simultaneously, the surface normal vector at that grid point is obtained based on the workpiece's geometric model. Calculate the angle between these two vectors. The calculation logic follows the vector dot product formula: ; Compare the included angles of all overlapping pixels. The smaller the value, the more perpendicular the line of sight is to the workpiece surface, and the smaller the imaging distortion; therefore, the system selects the included angle. The grayscale value or RGB color value of the smallest candidate pixel is filled into the corresponding grid in the cylindrical unfolded mapping space, and after traversing the entire space, a seamless spiral texture distribution data is formed.
[0036] In another embodiment, the specific steps for identifying the center position of the light stripe in the enhanced image of the bottom of the groove and converting it into a radial depth value are as follows: Gaussian filtering is applied to the enhanced image of the bottom of the groove for noise reduction, and the gray-scale centroid method or Steger algorithm is used to scan line by line along the direction perpendicular to the light stripe to extract the sub-pixel-level center coordinates of the laser stripe; using the principle of laser triangulation, combined with the relative position calibration parameters of the camera and the laser emitter, the center coordinates of the light stripe on the image are converted into distance data in three-dimensional space, and the Euclidean distance from the point to the axis of rotation of the workpiece is calculated, which is the radial depth value.
[0037] It should be noted that the operation of mapping the radial depth value to the cylindrical unfolding mapping space based on the second index is as follows: read the real-time rotation angle and axial position in the second index to determine the corresponding row and column of the current laser cut surface in the cylindrical unfolding mapping space; fill the calculated radial depth value into the corresponding grid cell; if there are multiple depth measurement values in the same grid, use the arithmetic mean method to fuse them, and the final generated two-dimensional matrix is the spiral depth topology data, which intuitively reflects the depth variation of the spiral groove and the groove bottom morphology.
[0038] Optionally, step S3, which involves acquiring the motion position of the CNC milling machine during the turning process and performing spatiotemporal registration of the corrected helix image sequence and the groove bottom image sequence, further includes: The spiral depth topology data is processed by second-order differential to solve for local curvature extrema; the curvature extrema are selected and connected into a line, and the geometric center line of the groove bottom is obtained by fitting. Extract the spiral groove texture feature center line from the spiral texture distribution data. The texture feature center line is determined based on the minimum value region of texture gray level or the symmetry center of texture gradient. Based on the preset step size, the sampling section is extracted along the vertical axis of the cylindrical mapping space. The lateral distance difference between the geometric center line of the groove bottom and the center line of the texture feature on each sampling section is calculated, and the average of the lateral distance differences of all sampling sections is used as the phase offset.
[0039] In one embodiment, the operation of performing second-order differential processing on the helical depth topology data to fit the geometric center line of the groove bottom specifically involves: calling the helical depth topology data matrix generated in the aforementioned steps; and applying a one-dimensional Laplacian operator of length 5 to each row of data in the matrix (corresponding to the workpiece circumferential unfolding direction). Perform convolution operations to calculate the second derivative value; traverse the convolution results to find the positive maxima of the second derivative, which correspond to the lowest point of the spiral groove cross-sectional profile, i.e., the position with the greatest curvature change; set the curvature threshold to 0.5, remove pseudo-extreme points with second derivative values less than 0.5, and retain the effective groove bottom feature points; use the least squares method to perform polynomial fitting on all retained feature points, with the fitting order set to 3, to obtain a smooth curve equation, which is the geometric center line of the groove bottom.
[0040] In one implementation of this embodiment, the operation of extracting the spiral groove texture feature center line from the spiral texture distribution data includes: reading the spiral texture distribution data and treating it as a high-resolution grayscale image; analyzing each row of pixels along the vertical axis of the image; since the bottom of the spiral groove is usually darker, it appears as a region with extremely low grayscale values; in each row, finding the coordinates of the pixel with the smallest grayscale value, or calculating the geometric centroid of the region with a grayscale value below a threshold (e.g., grayscale value 50); connecting these centroids in order along the vertical axis, and smoothing them using a moving average filter (window size set to 10), the resulting trajectory line is the texture feature center line. Another optional approach is to calculate the center of symmetry of the image's horizontal gradient: for each row, calculating the gradient magnitude, and finding the position where the left and right gradient magnitudes are equal and opposite in direction as the center point. This method has better robustness for uneven lighting conditions.
[0041] Optionally, step S3, which involves extracting workpiece modeling feature data, includes: Based on the phase offset, coordinate offset compensation is performed on the horizontal axis coordinate of the spiral depth topology data in the cylindrical unfolding mapping space to obtain the registration depth topology data; Using the geometric center line of the groove bottom in the registration depth topology data as a reference, the effective repair domain of the spiral groove is defined by extending a set width to both sides. Within the effective repair domain of the spiral groove, traverse the pixels and detect coordinates of points with empty depth values in the registration depth topology data, marking them as depth-deficient pixels.
[0042] In one embodiment, the phase offset calculated in the aforementioned steps is used, assuming its value is 0.25 pixels (corresponding to a physical offset of 0.005 millimeters); a new matrix with the same size as the original spiral depth topology data matrix is created and named the registration depth topology data matrix; for each non-empty data point in the original matrix... Set its x-coordinate Updated to Since pixel coordinates must be integers, a bilinear interpolation algorithm is used to calculate the new coordinates. The depth value at that location; specifically, finding Two adjacent integer coordinates and ,according to and , The distance weights are used to calculate the target depth value and fill it into a new matrix. After all points are migrated, the new matrix is the registered depth topology data after eliminating systematic misalignment. At this time, the geometric center of the depth data and the visual center of the texture data are precisely coincident in space.
[0043] In one implementation of this embodiment, the process of defining the effective repair domain of the spiral groove based on the groove bottom geometric center line in the registration depth topology data includes: extracting the groove bottom geometric center line in the registration depth topology data; setting the extension width parameter to 80% of the nominal width of the spiral groove, for example, if the width of the spiral groove of the workpiece is 10 mm, then the extension width is set to 8 mm; in the cylindrical unfolding mapping space, taking each point on the groove bottom geometric center line as the center, extending 4 mm to the left and right sides (corresponding to 200 pixels, calculated at a resolution of 0.02 mm); constructing a binary mask image, marking all pixel positions within the above extension range as 1 (effective area), and marking the remaining positions as 0 (background area); the area covered by this mask is the effective repair domain of the spiral groove, focusing on processing the key data of the groove bottom and sidewalls, ignoring the non-critical areas at the top of the screw thread.
[0044] Optionally, step S3, in order to extract workpiece modeling feature data, may also include: Perform interpolation repair on pixels with missing depth values and integrate them with the valid depth values in the registered depth topology data to obtain complete depth topology data; By associating the complete depth topology data with the corresponding coordinates of the spiral texture distribution data, workpiece modeling feature data containing spatial location, depth geometry information, and surface texture information is constructed.
[0045] In one embodiment, the specific process of associating the complete depth topology data with the texture grayscale values of corresponding coordinates in the spiral texture distribution data to construct workpiece modeling feature data includes: creating a multi-dimensional point cloud data structure, which reserves a three-dimensional spatial coordinate field for each data point. and surface attribute fields ; Traverse every grid point in the complete depth topology data matrix Read its depth value and the texture grayscale value at the same coordinate in the spiral texture distribution data. The three-dimensional spatial coordinates are solved using the inverse polar coordinate transformation algorithm. The solution formula is as follows: ; ; ; In the formula, , , These represent the spatial coordinates of the workpiece modeling feature data in a Cartesian coordinate system; Indicates the nominal radius of the workpiece; This represents the radial depth value recorded in the matrix; and These are the x and y coordinates of the cylindrical expansion mapping space, respectively; This is the restored rotational phase angle (in radians); after the calculation is completed, the calculated... Coordinates and corresponding texture grayscale values (Assigning a value to an attribute field) The data is packaged and stored in a point cloud data structure. The final output dataset is the workpiece modeling feature data containing precise geometric positions and high-fidelity surface textures.
[0046] Of particular importance is the interpolation repair operation performed on the missing depth pixels, which is then integrated with the valid depth values in the registered depth topology data to obtain complete depth topology data, including: Calculate the tangent vector of the geometric center line of the groove bottom in the neighborhood of the depth-gap pixel, and construct a groove-direction guiding vector field that is parallel to the tangent vector and covers the effective repair domain of the spiral groove. In the slot-guided vector field, starting from the depth-deficient pixel, the search proceeds along the direction indicated by the vector to obtain the effective pixel at a known depth. Extract the depth values of the effective pixels and calculate their first derivative along the direction of the spiral groove; Based on the depth values of the effective pixels and their first derivatives, a cubic spline interpolation function is constructed along the trajectory of the spiral groove. The depth estimate of the missing pixels is calculated using the cubic spline interpolation function, which serves as the complete depth topology data.
[0047] In one embodiment, the process of calculating the tangent vector of the groove bottom geometric centerline in the neighborhood of the depth-gap pixel and constructing the groove-direction guiding vector field is as follows: First, read the groove bottom geometric centerline equation generated by the previous step, calculate the first derivative of the equation with respect to the horizontal axis coordinate, and obtain the tangent slope of each discrete point on the centerline; convert the tangent slope into a unit direction vector, denoted as the tangent vector; then, create a two-dimensional vector matrix with the same size as the effective repair domain of the spiral groove; for any pixel in the repair domain, find the point on the groove bottom geometric centerline that is closest to it in the vertical axis direction, and assign the tangent vector of the centerline point to the pixel; after traversing the entire repair domain, the generated two-dimensional vector matrix is the groove-direction guiding vector field, and each vector in the field indicates the extension direction of the local spiral groove.
[0048] In one implementation of this embodiment, the steps for obtaining valid pixels of known depth, starting from a depth-deficient pixel, are as follows: Select a depth-deficient pixel to be repaired as the current origin; read the vector direction corresponding to the origin position in the slot-direction guiding vector field; perform a step search along the positive direction of the vector (i.e., the forward direction of the spiral extension) with a step size of 1 pixel, checking the value of each pixel on the path in the registration depth topology data until the first non-empty valid value is found, and record the point as a forward valid anchor point; similarly, perform a search along the negative direction of the vector (i.e., the backward direction of the spiral extension) until the first non-empty valid value is found, and record the point as a backward valid anchor point; if no valid anchor point is found within the preset maximum search radius (e.g., 50 pixels), skip the repair of that point or expand the search radius.
[0049] In one embodiment, the mathematical model for constructing a cubic spline interpolation function along the trajectory of the spiral groove and calculating the depth estimate is as follows: Define the normalized distance parameter. Its value is equal to the ratio of the distance from the depth-gap pixel to the forward effective anchor point to the total distance between the two anchor points, and its value ranges from 0 to 1; Construct a cubic spline function in the form of Hermit interpolation: ; In the formula, This represents the calculated depth estimate; , These are the depth values of the effective anchor points for the forward and backward directions, respectively. , These are the first derivative values of the effective anchor points for the forward and backward directions, respectively (the scale needs to be adjusted according to the physical distance between the two points). Preferably, step S4: Based on the workpiece modeling feature data, perform a polar coordinate to rectangular coordinate conversion, calculate the three-dimensional spatial coordinates and their corresponding surface attribute values, and generate three-dimensional point cloud data of the workpiece; Optionally, step S4 includes the following steps: Step S41: Perform polar coordinate to rectangular coordinate conversion based on the workpiece modeling feature data, and calculate the three-dimensional Cartesian space coordinates corresponding to each data point; Step S42: Extract the surface texture information from the workpiece modeling feature data, map it to the corresponding three-dimensional Cartesian space coordinates, and generate three-dimensional point cloud data of the workpiece containing geometric position and surface attributes.
[0050] Of particular importance is the extraction of surface texture information from the workpiece modeling feature data, mapping it to corresponding 3D Cartesian space coordinates to generate 3D point cloud data of the workpiece containing geometric position and surface attributes, including: Obtain the reference radius of the workpiece, and divide the horizontal axis coordinate in the workpiece modeling feature data by the reference radius to obtain the reconstructed polar angle; The vertical axis coordinate in the workpiece modeling feature data is directly mapped to the reconstructed axial height. Use the complete depth topology data in the workpiece modeling feature data as the reconstructed polar radius; Calculate the spatial coordinates in the three-dimensional Cartesian coordinate system based on the reconstructed polar angle, reconstructed polar radius, and reconstructed axial height. The surface texture information in the workpiece modeling feature data is mapped to surface attributes in spatial coordinates to generate 3D point cloud data of the workpiece containing geometric position and surface attributes.
[0051] In one embodiment, the process of obtaining the reference radius of the workpiece and calculating the reconstructed polar angle is as follows: the system reads the reference radius value of the workpiece from the digital process card of the workpiece or the parameter configuration table input by the user; calls the workpiece modeling feature data stored in the cache, which exists in the form of a two-dimensional matrix; traverses each non-empty data point in the matrix and reads its horizontal axis coordinate value, which physically represents the unfolded arc length of the workpiece surface; performs a division operation, dividing the horizontal axis coordinate value by the reference radius, and the result is the reconstructed polar angle (in radians); this angle directly reflects the angular displacement of the data point relative to the rotation center of the workpiece.
[0052] In one implementation of this embodiment, the operation of determining the reconstructed axial height and the reconstructed extreme diameter is as follows: directly read the longitudinal coordinate value of the data point. Since this coordinate value has been physically calibrated with the Z-axis feed position of the CNC machine tool during the modeling stage, it is directly defined as the reconstructed axial height. At the same time, read the complete depth topology data value corresponding to the data point. If the value records the distance from the surface to the rotation center, it is directly used as the reconstructed extreme diameter. If the value records the cutting depth relative to the reference surface, the reconstructed extreme diameter is obtained by subtracting the depth value from the reference radius. The reconstructed extreme diameter accurately describes the radial undulation characteristics of the bottom of the spiral groove.
[0053] Please see Figure 3 This is an example diagram of the 3D point cloud modeling of a ball screw in this invention. The main body of the ball screw is a helical groove workpiece with a continuous helical groove structure distributed on its outer surface, which is used to cooperate with the balls to achieve transmission. The helical groove is a continuously concave curved surface structure with small helix angle and deep groove characteristics, which is the core area that needs to be focused on in the modeling. The balls are spherical structures embedded in the helical grooves, and their surface texture and position are key elements in texture rendering in the modeling. The point cloud data covers the surface of the screw and balls in the form of dense pixels, containing geometric position and surface attribute information, and is the original data source for 3D modeling. The 3D digital model is generated by meshing and texture rendering of the point cloud data, which can completely reproduce the helical groove contour, ball distribution and surface details of the screw.
[0054] Preferably, step S5: input the workpiece's three-dimensional point cloud data into the three-dimensional modeling software, and obtain the workpiece's three-dimensional digital model through meshing and texture rendering.
[0055] In one embodiment, the surface texture attributes carried in the point cloud are mapped onto the generated triangular mesh. Since the vertices of the triangular mesh are directly derived from or interpolated from the original point cloud, the mesh vertices directly inherit the color or grayscale attributes of the original points. For the regions inside the triangular facets, a centroid interpolation algorithm is used for color rendering. Specifically, for any point inside the triangular facet, its color value is obtained by weighted summation of the color values of the three vertices according to distance weights. Finally, the software encapsulates the data containing the geometric mesh structure and surface texture color into a single object and outputs it in a common 3D model format (such as OBJ or STL), which is the 3D digital model of the workpiece. This model can be observed from multiple angles, measured virtually, and its processing quality evaluated in a virtual environment.
[0056] The present invention also provides a three-dimensional modeling system 100 for CNC milling machine workpieces, which executes the three-dimensional modeling method for CNC milling machine workpieces as described above. The three-dimensional modeling system for CNC milling machine workpieces includes: The workpiece pre-scanning module 101 is used to clamp the workpiece on the CNC milling machine, control the workpiece to rotate at a uniform speed and simultaneously perform axial feed, and use an industrial camera to acquire surface images along the spiral unfolding path to obtain an initial spiral image sequence. The image acquisition module 102 is used to calculate the deviation between the actual spiral path and the theoretical path based on the initial spiral image sequence, and use the corresponding deviation to correct the linkage control parameters of the CNC milling machine to drive the workpiece to perform a secondary spiral advance. During the secondary spiral advance, the image acquisition module 102 simultaneously acquires and corrects the spiral image sequence and the groove bottom image sequence. The feature extraction module 103 is used to obtain the motion position of the CNC milling machine during the turning process, and to perform spatiotemporal registration of the correction spiral image sequence and the groove bottom image sequence to extract workpiece modeling feature data; The point cloud mapping module 104 is used to perform polar coordinate to rectangular coordinate conversion on the workpiece modeling feature data, calculate the three-dimensional spatial coordinates and their corresponding surface attribute values, and generate three-dimensional point cloud data of the workpiece. The 3D modeling and rendering module 105 is used to input the 3D point cloud data of the workpiece into the 3D modeling software, and obtain the 3D digital model of the workpiece through meshing and texture rendering.
[0057] Therefore, the embodiments should be considered as exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of the equivalents of the application are intended to be included within the invention.
[0058] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features of the invention herein.
Claims
1. A method for three-dimensional modeling of CNC milling machine workpieces, characterized in that, Includes the following steps: Step S1: Clamp the workpiece on a CNC milling machine, control the workpiece to rotate at a uniform speed and simultaneously feed it axially, and use an industrial camera to acquire surface images along the spiral unfolding path to obtain an initial spiral image sequence. Step S1, controlling the workpiece to rotate at a uniform speed and simultaneously feed it axially, includes: Obtain the theoretical lead value and diameter of the workpiece; Calculate the theoretical axial feed per revolution of the workpiece based on the theoretical lead value; The theoretical axial feed rate is input into the linkage control unit of the CNC milling machine to generate a control command that makes the rotary axis and the translation axis move synchronously in a fixed ratio, which is used as the first control command. The workpiece is controlled to rotate at a constant speed and be fed axially synchronously based on the first control command. Step S2: Calculate the deviation between the actual spiral path and the theoretical path based on the initial spiral image sequence. Use the corresponding deviation to correct the linkage control parameters of the CNC milling machine to drive the workpiece to perform a secondary spiral advance. During the secondary spiral advance, simultaneously acquire and correct the spiral image sequence and the groove bottom image sequence. Step S2, using the corresponding deviation to correct the linkage control parameters of the CNC milling machine to drive the workpiece to perform a secondary spiral advance, includes: In each frame of the initial spiral image sequence, grayscale scanning is performed along the spiral groove extension direction to identify grayscale peak points, and two adjacent peak points are defined as the spiral tooth period. Calculate the actual helix angle for each thread cycle to determine the linkage proportional compensation amount; The first control command is adjusted by the linkage proportional compensation amount to obtain the corrected second control command. The second control command is updated to the linkage control unit of the CNC milling machine, driving the workpiece to run along the corrected trajectory; Step S3: Obtain the motion position of the CNC milling machine during the turning process, and perform spatiotemporal registration of the correction helix image sequence and the groove bottom image sequence to extract workpiece modeling feature data. Step S3, which involves obtaining the motion position of the CNC milling machine during the turning process and performing spatiotemporal registration of the correction helix image sequence and the groove bottom image sequence, includes: During the secondary spiral advance, a sequence of images of the bottom of the spiral groove of the workpiece is simultaneously acquired by projecting images onto the bottom of the groove using a dual-side line laser. Based on the real-time readings fed back by the rotary axis encoder and translation axis encoder of the CNC milling machine at the moment of each frame image acquisition, a first index containing rotation angle and axial position is generated for each frame image in the corrected spiral image sequence, and a corresponding second index is generated for each frame image in the groove bottom image sequence. The spiral image with the same first index and second index is paired with the bottom image sequence as the image pair to be fused; Step S4: Based on the workpiece modeling feature data, perform a polar coordinate to Cartesian coordinate conversion, calculate the three-dimensional spatial coordinates and their corresponding surface attribute values, and generate the workpiece three-dimensional point cloud data. Step S4 includes the following steps: Step S41: Perform polar coordinate to rectangular coordinate conversion based on the workpiece modeling feature data, and calculate the three-dimensional Cartesian space coordinates corresponding to each data point; Step S42: Extract the surface texture information from the workpiece modeling feature data, map it to the corresponding three-dimensional Cartesian space coordinates, and generate three-dimensional point cloud data of the workpiece containing geometric position and surface attributes; Step S5: Input the 3D point cloud data of the workpiece into the 3D modeling software, and obtain the 3D digital model of the workpiece through meshing and texture rendering.
2. The method for three-dimensional modeling of CNC milling machine workpieces according to claim 1, characterized in that, Step S3, which involves acquiring the motion position of the CNC milling machine during the turning process and performing spatiotemporal registration of the corrected helix image sequence and the groove bottom image sequence, also includes: Construct a cylindrical unfolding mapping space for the workpiece, where the horizontal axis is defined as the unfolding length of the workpiece's rotational phase and the vertical axis is defined as the workpiece's axial feed position. Extract the first index from the image pair to be fused, and calculate the texture projection region of each frame of spiral image in the cylindrical unfolding mapping space by combining the internal and external calibration parameters of the industrial camera. For overlapping pixels within the texture projection area, calculate the angle between the pixel's line of sight during imaging and the workpiece surface normal, and select the pixel value with the smallest angle to fill the cylindrical unfolding mapping space to form spiral texture distribution data. The center position of the light stripe in the enhanced image of the trench bottom in the image to be fused is identified and converted into a radial depth value. Based on the second index, the radial depth value is mapped to the cylindrical unfolding mapping space to form spiral depth topology data.
3. The three-dimensional modeling method for CNC milling machine workpieces according to claim 2, characterized in that, Step S3, which involves acquiring the motion position of the CNC milling machine during the turning process and performing spatiotemporal registration of the corrected helix image sequence and the groove bottom image sequence, also includes: The spiral depth topology data is processed by second-order differential to solve for local curvature extrema; the curvature extrema are selected and connected into a line, and the geometric center line of the groove bottom is obtained by fitting. Extract the spiral groove texture feature center line from the spiral texture distribution data. The texture feature center line is determined based on the minimum value region of texture gray level or the symmetry center of texture gradient. Based on the preset step size, the sampling section is extracted along the vertical axis of the cylindrical mapping space. The lateral distance difference between the geometric center line of the groove bottom and the center line of the texture feature on each sampling section is calculated, and the average of the lateral distance differences of all sampling sections is used as the phase offset.
4. The three-dimensional modeling method for CNC milling machine workpieces according to claim 3, characterized in that, Step S3 involves extracting workpiece modeling feature data, including: Based on the phase offset, coordinate offset compensation is performed on the horizontal axis coordinate of the spiral depth topology data in the cylindrical unfolding mapping space to obtain the registration depth topology data; Using the geometric center line of the groove bottom in the registration depth topology data as a reference, the effective repair domain of the spiral groove is defined by extending a set width to both sides. Within the effective repair domain of the spiral groove, traverse the pixels and detect coordinates of points with empty depth values in the registration depth topology data, marking them as depth-deficient pixels.
5. The three-dimensional modeling method for CNC milling machine workpieces according to claim 4, characterized in that, Step S3, which involves extracting workpiece modeling feature data, also includes: Perform interpolation repair on pixels with missing depth values and integrate them with the valid depth values in the registered depth topology data to obtain complete depth topology data; By associating the complete depth topology data with the corresponding coordinates of the spiral texture distribution data, workpiece modeling feature data containing spatial location, depth geometry information, and surface texture information is constructed.
6. A three-dimensional modeling system for CNC milling machine workpieces, characterized in that, For performing the CNC milling machine workpiece three-dimensional modeling method as described in claim 1, the CNC milling machine workpiece three-dimensional modeling system includes: The workpiece pre-scanning module is used to clamp the workpiece on the CNC milling machine, control the workpiece to rotate at a constant speed and feed axially synchronously, and use an industrial camera to acquire surface images along the spiral unfolding path to obtain an initial spiral image sequence. The image acquisition module is used to calculate the deviation between the actual spiral path and the theoretical path based on the initial spiral image sequence, and to use the corresponding deviation to correct the linkage control parameters of the CNC milling machine to drive the workpiece to perform a secondary spiraling motion. During the secondary spiraling process, the corrected spiral image sequence and the groove bottom image sequence are acquired and corrected simultaneously. The feature extraction module is used to obtain the motion position of the CNC milling machine during the turning process, and to perform spatiotemporal registration of the correction spiral image sequence and the groove bottom image sequence to extract workpiece modeling feature data; The point cloud mapping module is used to perform polar coordinate to rectangular coordinate conversion on the workpiece modeling feature data, calculate the three-dimensional spatial coordinates and their corresponding surface attribute values, and generate three-dimensional point cloud data of the workpiece. The 3D modeling and rendering module is used to input the 3D point cloud data of the workpiece into the 3D modeling software, and obtain the 3D digital model of the workpiece through meshing and texture rendering.