A barrel mold complex cavity multi-axis machining tool path optimization method

CN123031289APending Publication Date: 2026-11-03XIAN KUNLUN IND GRP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611051209.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-15
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

Existing multi-axis machining toolpath planning methods struggle to balance machining accuracy and efficiency when machining tube mold cavities, resulting in problems such as tool wear, vibration, workpiece deformation, and path interference. They also cannot adapt to changes in the axial diameter of the cavity or helical rifling structures.

Method used

A hybrid slicing system combining axial layering and radial partitioning is adopted. By combining an adaptive arc length discretization algorithm and an improved particle swarm optimization algorithm, a feasible region of the tool axis vector that includes geometric interference, machine tool motion and cutting stability is generated. A smooth initial tool path is generated through a multi-objective optimization model, and a helical transition connection path that satisfies the G² continuity condition is constructed.

Benefits of technology

This technology enables high-precision machining of the tube mold cavity, reduces computational complexity, improves machining stability and surface quality, reduces machining deformation and tool wear, and increases machining efficiency and tool life.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123031289A_ABST
    Figure CN123031289A_ABST
Patent Text Reader

Abstract

The application discloses a kind of complex cavity multi-axis machining tool path optimization method of body tube mould, belong to machining technical field.The application is aimed at the problems, such as machining precision and efficiency of body tube mould cavity are difficult to balance in prior art, tool shaft vector planning is not comprehensive, material removal rate is uneven and interlayer transition is easy to interfere, etc., using the hybrid slicing system combining axial layering and radial zoning, the tool contact point sequence is generated by combining adaptive arc length discrete algorithm;A multi-constrained tool shaft vector feasible region containing geometric interference, machine tool motion and cutting stability is constructed, and the global optimal tool shaft vector is solved by improving particle swarm optimization algorithm;With the axis in cavity as guide, generate variable-density helical base path, and generate initial tool path by cubic B-spline interpolation mapping;A multi-objective optimization model is constructed to solve the optimal path of a single layer, and a helical transition path that meets the G2 continuity condition is used to solve the interlayer interference problem, and finally the NC code is output after global consistency verification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machining technology, specifically to a method for optimizing tool paths in multi-axis machining of complex cavities in tube molds. Background Technology

[0002] The barrel is a core functional component of firearms, artillery, and other weapon systems, and its performance directly depends on the machining quality of the barrel mold cavity. Barrel mold cavities are characterized by deep cavity structures, complex variable-diameter surfaces, and continuous helical rifling, making machining highly precise and challenging. Existing multi-axis machining toolpath planning methods still have many shortcomings in practical applications: uniform thickness slices cannot adapt to drastic changes in the cavity's axial diameter, making it difficult to balance machining accuracy and efficiency; fixed arc length sampling leads to insufficient contour restoration in areas of high curvature and redundant sampling points in flat areas; tool axis vector planning often only considers geometric interference constraints, ignoring machine tool motion limitations and cutting stability, easily causing vibration, chatter, and tool wear; traditional path methods are incompatible with helical rifling structures, and fixed row spacing causes uneven residual height and material removal rate fluctuations, easily leading to workpiece deformation; straight transitions between layers are prone to interference in narrow areas of deep cavities, and abrupt tool axis changes disrupt machining continuity; single-objective optimization cannot simultaneously meet multiple mutually constraining machining requirements. Summary of the Invention

[0003] To address the shortcomings of existing technologies, this invention provides a method for optimizing tool paths in multi-axis machining of complex cavities in tube molds, thus solving the problems mentioned in the background section.

[0004] To achieve the above objectives, the present invention provides the following technical solution: a method for optimizing the toolpath in multi-axis machining of complex cavities in a tube mold, comprising the following steps: Step S1: Based on the three-dimensional geometric model of the body tube mold cavity, construct a hybrid slicing system that combines axial layering and radial partitioning, extract the inner and outer contour boundaries of each slice, and use an adaptive arc length discretization algorithm to generate the tool contact point sequence; Step S2: Establish a local differential geometric coordinate system at each tool contact point, and combine the tool geometric parameters with the local curvature characteristics of the cavity surface to construct a feasible domain for the tool axis vector that includes geometric interference constraints, machine tool motion constraints and cutting stability constraints; Step S3: With the global smoothness of the tool axis vector as the objective, the improved particle swarm optimization algorithm is used to solve for the optimal tool axis vector at each tool contact point within the feasible region; Step S4: Extract the central axis of each cavity contour as the guide baseline, and adaptively adjust the row spacing based on local curvature to generate a variable density helical base path; Step S5: Perform cubic B-spline interpolation mapping on the optimal tool axis vector along the helical base path to generate an initial tool path with complete tool axis information; Step S6: Construct a multi-objective optimization model that includes path smoothness, tool axis smoothness, material removal rate uniformity, and interference avoidance, and obtain the optimal tool path for a single layer through iterative solution; Step S7: Establish the path association matrix between adjacent machining layers and analyze the interference risk areas of tool path jumps between layers; Step S8: For interlayer transition regions with interference risks, generate spiral transition connection paths that satisfy the G² continuity condition; Step S9: Perform a global consistency check on the toolpaths of all machining layers to eliminate abrupt path changes and tool axis vector jumps; Step S10: Convert the optimized complete toolpath into an NC code file that conforms to the multi-axis CNC machine tool standard and output it.

[0005] Preferably, the method for constructing the hybrid slice system in step S1 is as follows: Along the axial direction of the body tube mold cavity, the entire cavity is divided into several axial machining segments according to the cavity diameter change rate. Each machining segment is sliced ​​at equal intervals using a different layer thickness. For variable diameter segments with a diameter change rate greater than a preset threshold, a smaller layer thickness is used. For constant-diameter sections with a diameter change rate less than or equal to a preset threshold, a larger layer thickness is used. ; among which the layer thickness and All of them satisfy the following constraints: ; In the formula, For the tool radius, This is the maximum allowable forward tilt angle of the cutter shaft. This refers to the maximum permissible depth of cut calculated based on the allowable residual height. The Canny edge detection algorithm is used to extract the inner contour boundary curve of the cavity for each slice. and outer contour boundary curve ,in For layer number, , This represents the total number of floors. For the first Axial position coordinates of the layer.

[0006] Preferably, the adaptive arc length discretization algorithm in step S1 is as follows: For the Inner contour boundary curve of the layer and outer contour boundary curve Perform curvature analysis separately and calculate the curvature value at each point on the curve. ,in For arc length parameters; The arc length spacing of discrete sampling is adaptively adjusted based on the curvature value. The calculation formula is as follows: ; In the formula, Minimum arc length spacing, The maximum arc length spacing, This is the curvature sensitivity coefficient, with a value range of [value range missing]. , This represents the average curvature of the contour boundary curve of this layer. According to adaptive arc length spacing Discrete sampling of the contour boundary curve yields the knife contact point sequence. ,in , For the first Total number of blade contacts in the layer.

[0007] Preferably, step S2 specifically includes the following sub-steps: Step S21: At the tool contact point Establish a local differential geometric coordinate system ,in The direction of the principal curvature of the cavity surface at that point. For the direction of secondary curvature, It is the surface normal vector; Step S22: In the local coordinate system, set the tool axis vector... Represented as lean angle and roll angle The function of the forward tilt angle, where the forward tilt angle is .... For the tool axis vector in - Projection in the plane and The included angle of the shaft, the yaw angle For the tool axis vector in - Projection in the plane and The included angle of the axis; Step S23: Construct geometric interference constraints. By calculating the minimum distance between the tool envelope and the cavity surface, eliminate all factors that could cause tool-workpiece collisions. combination; Step S24: Construct machine tool motion constraints. Based on the rotary axis travel limits and angular velocity limits of the multi-axis CNC machine tool, determine the forward tilt angle. and roll angle The range of values ​​for; Step S25: Construct cutting stability constraints. Based on the chatter stability lobe diagram, determine the range of tool axis vectors that can guarantee stable cutting under the current cutting parameters. Step S26: Take the intersection of the above three constraints as the feasible region of the tool axis vector constraint. .

[0008] Preferably, the improved particle swarm optimization algorithm described in step S3 is as follows: The tool axis vector at each tool contact point As a particle, the particle's position vector is The velocity vector is ; The fitness function of a particle is defined as follows: ; In the formula, For the first The first blade contact point and the first The change in the angle between the tool axis vectors of each tool contact point. For the first The first blade contact point and the first The change in the angle between the tool axis vectors of each tool contact point. and Let be the weighting coefficient, satisfying ; Change in included angle Calculated using the following formula: ; In the formula, and These are the unit vectors of the tool axis at the two tool contact points; During the iteration process, each particle updates its velocity and position based on its own historical best position and the group's global best position until the convergence condition is met, thus obtaining the optimal tool axis vector at each tool contact point. .

[0009] Preferably, step S4 specifically includes the following sub-steps: Step S41: For the first Inner contour boundary curve of layered cavity and outer contour boundary curve An improved Voronoi diagram algorithm was used to extract its central axis. ; Step S42: Calculate the centerline curvature values ​​at each point ,in This is the arc length parameter of the central axis; Step S43: Adaptively adjust the row spacing based on the local curvature of the central axis. The calculation formula is as follows: ; In the formula, For reference line spacing, This is the curvature adjustment coefficient, with a value range of [value range missing]. , Central axis The average curvature; Step S44: Along the central axis Direction, according to adaptive line spacing Equal offsets are made on both sides of the central axis to generate a series of path nodes that spiral around the central axis. Step S45: Connect all path nodes according to the processing sequence to form a variable density spiral base path.

[0010] Preferably, the cubic B-spline interpolation mapping method in step S5 is as follows: knife contact sequence and its corresponding optimal tool axis vector As control vertices and control vectors; A cubic B-spline curve was used to fit the knife contact sequence to obtain a parameterized representation of the helical base path. ,in For arc length parameters; The tool axis vector field is obtained by interpolating the tool axis vector using a cubic B-spline surface interpolation method. This ensures that at each tool contact point, the following conditions are met. ,in For the first The arc length parameter corresponding to each blade contact point; The tool axis vector field Mapping to helical base path Up, so that each point on the path Each corresponds to a tool axis vector This generates an initial toolpath with complete tool axis information.

[0011] Preferably, the objective function of the multi-objective optimization model in step S6 is: ; In the formula, The total objective function value, For path smoothness constraints, This is a constraint term for the smoothness of the tool axis vector. For the uniformity constraint of material removal rate, For interference and collision avoidance constraints, , , , Here are the weight coefficients for each constraint term, satisfying... ; Among them, the path smoothness constraint term Defined as the line integral of the square of the toolpath curvature: ; In the formula, For toolpath arc length parameters curvature at that point For the first Total arc length of the layer toolpath; The objective function is iteratively optimized using the gradient descent method until the change in the total objective function value is less than a preset threshold, thus obtaining the optimal toolpath for a single layer.

[0012] Preferably, steps S7 and S8 specifically include the following sub-steps: Step S71: Obtain the first End point of layer toolpath tangent vector and tool axis vector and the Start position of layer toolpath tangent vector and tool axis vector ; Step S72: Establish connection and For the straight line segment, perform tool envelope sweep interference detection on the straight line segment; Step S73: If there is no interference, the straight line segment is directly used as the interlayer transition path; if there is interference, proceed to step S81. Step S81: In and Generate a fifth-order polynomial spiral transition curve that satisfies the G² continuity condition. ,in For normalized parameters; Step S82: The fifth-order polynomial spiral transition curve satisfies the following boundary conditions: In the formula, and The first Layer endpoint and first Acceleration vector at the start of the layer; Step S83: Calculate the cutter axis vector at each point on the transition path using the spherical linear interpolation method. : ; In the formula, for and The angle between them ; Step S84: Perform interference detection on the generated transition path. If interference still exists, adjust the control point position of the transition curve until the interference-free requirement is met.

[0013] Preferably, the global consistency check in step S9 specifically includes: Step S91: Traverse the toolpaths of all machining layers and calculate the change in the tool axis vector angle between adjacent path points; Step S92: If the change in the included angle of the tool axis vector at a certain position is greater than a preset threshold, then mark that position as the tool axis jump point; Step S93: For each tool axis jump point, use the local smoothing algorithm to re-interpolate the tool axis vectors around it so that the tool axis vector change rate satisfies the machine tool motion constraints; Step S94: Calculate the curvature value of each point on the toolpath. If the curvature at a certain position is greater than a preset threshold, mark that position as a path abrupt change point. Step S95: For each abrupt change in the path, smooth the path using either circular arc transition or polynomial transition methods; Step S96: Perform a final global interference check on the processed toolpath to ensure that there are no tool, workpiece, or tool and fixture collisions during the entire machining process.

[0014] Beneficial Effects: This invention addresses the aforementioned problems by providing a toolpath optimization method for multi-axis machining of complex cavities in tube molds. Through systematic optimization of the entire process, it effectively solves the shortcomings of existing technologies. This invention employs a hybrid slicing system combining axial layering and radial partitioning, matching different layer thicknesses according to changes in cavity diameter to achieve an optimal balance between machining accuracy and efficiency. Simultaneously, based on an adaptive arc-length discretization algorithm using curvature, the sampling interval is dynamically adjusted, accurately restoring the cavity contour while reducing computational complexity. Furthermore, a multi-constraint tool axis vector feasible region incorporating geometric interference, machine tool motion, and cutting stability is constructed. An improved particle swarm optimization algorithm is then used to solve for the globally optimal tool axis vector, preventing collisions, overtravel, and chatter at the source, significantly improving machining stability and surface quality.

[0015] This invention generates a variable-density helical base path guided by the cavity centerline. Adaptive adjustment of the row spacing ensures uniform machining residual height and stable material removal rate, effectively reducing machining deformation and subsequent manual grinding processes. Simultaneously, cubic B-spline interpolation mapping generates a smooth initial tool path, ensuring a natural transition of the tool axis vector and laying a solid foundation for subsequent multi-objective optimization. Furthermore, a multi-objective optimization model is constructed, comprehensively considering multiple interdependent factors such as path smoothness, tool axis smoothness, material removal rate uniformity, and interference avoidance, to achieve global optimization of the machining process.

[0016] To address the inter-layer path transition problem, this invention employs a method that satisfies... The continuous spiral transition path solves the interference problem in the narrow region of the deep cavity, and the combination of spherical linear interpolation achieves smooth tool axis transition and avoids machine tool movement impact. Finally, the global consistency check completely eliminates path abrupt change points and tool axis jump points, further improving machining stability and quality consistency. The generated tool path can be directly applied to actual production. Attached Figure Description

[0017] Figure 1 This is a schematic diagram of the tool path optimization method for multi-axis machining of complex cavities in a tube mold according to the present invention. Detailed Implementation

[0018] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0019] like Figure 1 As shown, the present invention discloses a method for optimizing the tool path in multi-axis machining of complex cavities in a tube mold, which is implemented through the following steps: Step S1: Construction of the hybrid slicing system and generation of blade contact sequence: First, import the 3D geometric model of the tube mold cavity. This model is typically a parametric solid model in STEP or IGES format. Based on this model, a hybrid slicing system combining axial layering and radial partitioning is constructed. The specific implementation process is as follows: Along the axial direction of the barrel mold cavity, the diameter values ​​of the cavity at different axial positions are calculated, thus obtaining the curve of the cavity diameter changing with axial position. Based on the diameter change rate, the entire cavity is divided into several axial machining sections. For diameter-changing sections with a diameter change rate greater than a preset threshold (such as the rifling initiation section, the propellant chamber transition section, etc.), a smaller layer thickness is used. Perform equidistant slicing; for equal-diameter segments (such as the main body of the tube) with a diameter change rate less than or equal to a preset threshold, use a larger slice thickness. Perform equidistant slices. The layer thickness is... and All of them satisfy the following constraints: ; In the formula, The radius of the selected cutting tool. This refers to the maximum allowable forward tilt angle of the tool axis on a multi-axis CNC machine tool. The maximum allowable depth of cut is calculated based on the allowable residual height preset according to the surface quality requirements of the machined surface.

[0020] The Canny edge detection algorithm was used to extract the contour of each slice to obtain the inner contour boundary curve of the cavity. and outer contour boundary curve ,in For layer number, , This represents the total number of floors. For the first Axial position coordinates of the layer.

[0021] Subsequently, an adaptive arc length discretization algorithm is used to sample the contour boundary curve to generate a sequence of blade contact points: For the Inner contour boundary curve of the layer and outer contour boundary curve Perform curvature analysis separately and calculate the curvature value at each point on the curve. ,in This is the arc length parameter. The arc length spacing of the discrete sampling is adaptively adjusted based on the curvature value. The calculation formula is as follows: ; In the formula, The minimum arc length spacing is determined based on the machining accuracy requirements. The maximum arc length spacing, This is the curvature sensitivity coefficient, with a value range of [value range missing]. , This represents the average curvature of the contour boundary curve of this layer.

[0022] According to the above adaptive arc length spacing Discrete sampling of the contour boundary curve yields the knife contact point sequence. ,in , For the first Total number of blade contacts in the layer.

[0023] Step S2: Constructing the feasible region of the multi-constraint tool axis vector: Establish a local differential geometric coordinate system at each tool contact point and construct a feasible region for the tool axis vector containing multiple constraints. This includes the following sub-steps: Step S21: At the tool contact point Establish a local differential geometric coordinate system The origin of the coordinate system Contact point with the knife coincide, This refers to the direction of the maximum principal curvature of the cavity surface at that point. The direction of minimum principal curvature, Let be the unit normal vector of the surface at that point.

[0024] Step S22: In the above local coordinate system, the tool axis unit vector Represented as lean angle and roll angle The function of the forward tilt angle, where the forward tilt angle is .... For the tool axis vector in - Projection in the plane and The included angle of the shaft, the yaw angle For the tool axis vector in - Projection in the plane and The included angle of the axis.

[0025] Step S23: Construct geometric interference constraints, calculate the minimum distance between the tool envelope and the cavity surface using the discrete point distance detection method, and eliminate all factors that could cause tool-workpiece collisions. combination.

[0026] Step S24: Construct machine tool motion constraints. Based on the rotary axis travel limits and maximum angular velocity limits of the multi-axis CNC machine tool being used, determine the forward tilt angle. and roll angle The allowed range of values.

[0027] Step S25: Construct cutting stability constraints. Based on the pre-established cutting chatter stability lobe diagram, determine the tool axis vector range that can guarantee stable cutting under the current cutting parameters (including spindle speed, feed rate, depth of cut, etc.).

[0028] Step S26: The intersection of the above geometric interference constraints, machine tool motion constraints, and cutting stability constraints is taken as the feasible region of the tool axis vector constraint at the tool contact point. .

[0029] Step S3: Solving for the optimal tool axis vector based on the improved particle swarm optimization algorithm: With the global smoothness of the tool axis vector as the objective, an improved particle swarm optimization algorithm is used to solve for the optimal tool axis vector at each tool contact point within the feasible region. The specific implementation process is as follows: The tool axis vector at each tool contact point As a particle, the particle's position vector is The velocity vector is The fitness function of a particle is defined as: ; In the formula, For the first The first blade contact point and the first The change in the angle between the tool axis vectors of each tool contact point. For the first The first blade contact point and the first The change in the angle between the tool axis vectors of each tool contact point. and Let be the weighting coefficient, satisfying .

[0030] Change in included angle Calculated using the following formula: ; In the formula, and These are the unit vectors of the tool axis at the two tool contact points, and the operator " "Represents the vector dot product.

[0031] During the iteration process, each particle updates its velocity and position based on its own historical best position and the global best position of the population until the convergence condition is met (such as the number of iterations reaching a preset maximum value or the change in the fitness function value being less than a preset threshold), and finally obtains the optimal tool axis vector at each tool contact point. .

[0032] Step S4: Variable density helical base path generation: The central axis of each cavity contour is extracted as the guiding baseline. Based on the local curvature, the row spacing is adaptively adjusted to generate a variable density helical base path. The specific steps include the following: Step S41: For the first Inner contour boundary curve of layered cavity and outer contour boundary curve An improved Voronoi diagram algorithm was used to extract its central axis. The central axis can accurately reflect the geometric center direction of the cavity profile.

[0033] Step S42: Calculate the centerline curvature values ​​at each point ,in This is the arc length parameter of the central axis.

[0034] Step S43: Adaptively adjust the row spacing based on the local curvature of the central axis. The calculation formula is as follows: ; In the formula, The reference row spacing is determined based on processing requirements. This is the curvature adjustment coefficient, with a value range of [value range missing]. , Central axis The average curvature. When the local curvature is greater than the average curvature, the row spacing automatically decreases to ensure machining accuracy; when the local curvature is less than the average curvature, the row spacing automatically increases to improve machining efficiency.

[0035] Step S44: Along the central axis Direction, according to the above adaptive line spacing Equal offsets are made on both sides of the central axis to generate a series of path nodes that spiral around the central axis.

[0036] Step S45: Connect all path nodes in the order of processing from the inside to the outside or from the outside to the inside to form a variable density spiral base path.

[0037] Step S5: Cubic B-spline tool axis vector interpolation mapping: The optimal tool axis vector is mapped by cubic B-spline interpolation along the helical basis path to generate an initial tool path with complete tool axis information. The specific implementation process is as follows: The knife contact sequence generated in step S1 and the optimal tool axis vector obtained by solving step S3. As the control vertex and control vector, a cubic B-spline curve is used to fit the tool contact sequence to obtain a parameterized representation of the helical base path. ,in This is the arc length parameter.

[0038] The tool axis vector is interpolated using a cubic B-spline surface interpolation method to obtain a continuous tool axis vector field. This ensures that at each tool contact point, the following conditions are met. ,in For the first The arc length parameter corresponding to each tool contact point. The tool axis vector field... Mapping to helical base path Up, so that each point on the path Each corresponds to a unique tool axis vector. This generates an initial toolpath with complete tool axis information.

[0039] Step S6: Solving the multi-objective optimization model: A multi-objective optimization model is constructed, incorporating path smoothness, tool axis smoothness, material removal rate uniformity, and interference avoidance. The optimal toolpath for a single layer is obtained through iterative solution. The specific implementation process is as follows: The objective function of the multi-objective optimization model is: ; In the formula, The total objective function value, For path smoothness constraints, This is a constraint term for the smoothness of the tool axis vector. For the uniformity constraint of material removal rate, For interference and collision avoidance constraints, , , , Here are the weight coefficients for each constraint term, satisfying... The weighting coefficients can be adjusted according to actual processing requirements.

[0040] Among them, the path smoothness constraint term Defined as the line integral of the square of the toolpath curvature: ; In the formula, For toolpath arc length parameters curvature at that point For the first The total arc length of the tool path in each layer.

[0041] The gradient descent method is used to iteratively optimize the above objective function. In each iteration, the node position of the tool path and the corresponding tool axis vector are updated until the change in the total objective function value is less than a preset threshold, and finally the optimal tool path of a single layer is obtained.

[0042] Steps S7-S8: Generation of inter-layer transition paths: Establish a path association matrix between adjacent machining layers, analyze the interference risk regions of tool path transitions between layers, and generate spiral transition connection paths that satisfy the G² continuity condition for regions with interference risks. This process includes the following sub-steps: Step S71: Obtain the first End point of layer toolpath tangent vector and tool axis vector and the Start position of layer toolpath tangent vector and tool axis vector .

[0043] Step S72: Establish connection and For the straight line segment, perform tool envelope sweep interference detection on the straight line segment to determine whether there is interference with the cavity wall within the sweep space. Step S73: If there is no interference, directly use the straight line segment as the interlayer transition path; if there is interference, proceed to step S81.

[0044] Step S81: In and Generate a fifth-order polynomial spiral transition curve that satisfies the G² continuity condition. ,in For normalized parameters. Step S82: The fifth-order polynomial spiral transition curve satisfies the following boundary conditions: In the formula, and The first Layer endpoint and first The acceleration vector at the start of the layer.

[0045] Step S83: Calculate the tool axis vector at each point on the transition path using the spherical linear interpolation method. : '' In the formula, for and The angle between them Step S84: Perform interference detection on the generated transition path. If interference still exists, adjust the control point positions of the transition curve and repeat the above steps until the interference-free requirement is met.

[0046] Step S9: Global Consistency Verification Perform a global consistency check on the toolpaths of all machining layers to eliminate abrupt path changes and tool axis vector jumps. This includes the following sub-steps: Step S91: Traverse the toolpaths of all machining layers and calculate the change in the tool axis vector angle between adjacent path points.

[0047] Step S92: If the change in the included angle of the tool axis vector at a certain position is greater than a preset threshold, then mark that position as the tool axis jump point.

[0048] Step S93: For each tool axis jump point, use the local smoothing algorithm to re-interpolate the tool axis vector within a certain range around it, so that the tool axis vector change rate satisfies the machine tool motion constraints.

[0049] Step S94: Calculate the curvature value of each point on the toolpath. If the curvature at a certain position is greater than a preset threshold, then mark that position as a path change point.

[0050] Step S95: For each abrupt change in the path, smooth the path using either circular transition or polynomial transition methods.

[0051] Step S96: Perform a final global interference check on the processed toolpath to ensure that there are no tool-workpiece collisions or tool-fixture collisions during the entire machining process.

[0052] Step S10: NC code output: The optimized complete toolpath is converted into an NC code file that conforms to the standards of the multi-axis CNC machine tool being used, including G code, M code, and S code, and then the file is exported and can be directly imported into the CNC machine tool for machining. Specific implementation examples: This embodiment takes the machining of the cold extrusion die cavity of a certain type of 5.8mm rifle barrel as an example. A DMG MORI DMU50 five-axis machining center is used for machining, employing a 6mm diameter carbide ball end mill with a tool radius of... The maximum allowable forward tilt angle of the cutter shaft Permissible residual height .

[0054] First, import the STEP format 3D geometric model of the barrel mold cavity. Based on the cavity diameter change rate, divide it into three axial machining sections: the chamber transition section (diameter change rate 0.12 mm / mm), the rifling initiation section (diameter change rate 0.08 mm / mm), and the barrel body section (diameter change rate 0.005 mm / mm). Set the diameter change rate threshold to 0.05 mm / mm; therefore, the chamber transition section and the rifling initiation section use smaller layer thicknesses. The main body of the tube adopts a larger layer thickness. Both layers satisfy the layer thickness constraint conditions. A total of 215 slices were generated, and the inner and outer contour boundary curves of each layer were extracted using the Canny edge detection algorithm.

[0055] An adaptive arc length discretization algorithm is used to sample the contour boundary curve, and the settings are... , Curvature sensitivity coefficient In the rifling guide region with greater curvature, the sampling interval automatically decreases to 0.08 mm; in the main cavity region with gentler curvature, the sampling interval automatically increases to 0.45 mm. Approximately 126,000 tool contact points are generated, reducing the number of sampling points by about 35% compared to fixed arc length sampling.

[0056] A local differential geometric coordinate system is established at each tool contact point, and a feasible region for the tool axis vector is constructed, including geometric interference constraints, machine tool motion constraints, and cutting stability constraints. The rake angle is then set. The range of values ​​is roll angle The range of values ​​is An improved particle swarm optimization algorithm is used to solve for the optimal tool axis vector. The particle swarm size is set to 50, the maximum number of iterations is set to 100, and the weight coefficients are set accordingly. , The calculated global maximum angle change rate of the tool axis vector is 0.8° / mm, which satisfies the machine tool motion constraints.

[0057] An improved Voronoi diagram algorithm is used to extract the central axis of each cavity profile as a guide baseline, and a reference row spacing is set. Curvature adjustment coefficient In areas with high curvature of the central axis, the line spacing automatically decreases to 0.22 mm; in areas with gentle curvature, the line spacing automatically increases to 0.3 mm. After generating the variable-density helical base path, a cubic B-spline interpolation mapping method is used to map the optimal tool axis vector onto the base path to generate the initial tool path.

[0058] Construct a multi-objective optimization model and set weight coefficients. , , , The gradient descent method was used for iterative optimization, with 50 iterations, to obtain the optimal toolpath for a single layer. Interference detection was performed on the path transitions between adjacent machining layers. Interference risks were detected at three interlayer locations in the chamber transition section. A fifth-order polynomial spiral transition curve satisfying the G² continuity condition was used for connection, and spherical linear interpolation was used for the tool axis vector to achieve a smooth transition.

[0059] Finally, a global consistency check was performed on the toolpaths of all machining layers, eliminating two tool axis jump points and one path abrupt change point. The optimized toolpaths were then converted into NC code files conforming to the DMU50 machine tool standard and output. Actual machining results show that the body tube mold cavity machined using the method of this invention achieves dimensional accuracy of IT6 and surface roughness of... Compared with traditional methods, the processing time is shortened by about 28%, the tool life is increased by about 35%, and there is no chatter or interference during the processing.

[0060] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for optimizing toolpaths in multi-axis machining of complex cavities in a tube mold, characterized in that, Includes the following steps: Step S1: Based on the three-dimensional geometric model of the body tube mold cavity, construct a hybrid slicing system that combines axial layering and radial partitioning, extract the inner and outer contour boundaries of each slice, and use an adaptive arc length discretization algorithm to generate the tool contact point sequence; Step S2: Establish a local differential geometric coordinate system at each tool contact point, and combine the tool geometric parameters with the local curvature characteristics of the cavity surface to construct a feasible domain for the tool axis vector that includes geometric interference constraints, machine tool motion constraints and cutting stability constraints; Step S3: With the global smoothness of the tool axis vector as the objective, the improved particle swarm optimization algorithm is used to solve for the optimal tool axis vector at each tool contact point within the feasible region; Step S4: Extract the central axis of each cavity contour as the guide baseline, and adaptively adjust the row spacing based on local curvature to generate a variable density helical base path; Step S5: Perform cubic B-spline interpolation mapping on the optimal tool axis vector along the helical base path to generate an initial tool path with complete tool axis information; Step S6: Construct a multi-objective optimization model that includes path smoothness, tool axis smoothness, material removal rate uniformity, and interference avoidance, and obtain the optimal tool path for a single layer through iterative solution; Step S7: Establish the path association matrix between adjacent machining layers and analyze the interference risk areas of tool path jumps between layers; Step S8: For interlayer transition regions with interference risks, generate spiral transition connection paths that satisfy the G² continuity condition; Step S9: Perform a global consistency check on the toolpaths of all machining layers to eliminate abrupt path changes and tool axis vector jumps; Step S10: Convert the optimized complete toolpath into an NC code file that conforms to the multi-axis CNC machine tool standard and output it.

2. The method for optimizing toolpaths in multi-axis machining of complex cavities in a tube mold according to claim 1, characterized in that, The specific method for constructing the hybrid slice system described in step S1 is as follows: Along the axial direction of the body tube mold cavity, the entire cavity is divided into several axial machining segments according to the cavity diameter change rate. Each machining segment is sliced ​​at equal intervals using a different layer thickness. For variable diameter segments with a diameter change rate greater than a preset threshold, a smaller layer thickness is used. For constant-diameter sections with a diameter change rate less than or equal to a preset threshold, a larger layer thickness is used. ; among which the layer thickness and All of them satisfy the following constraints: ; In the formula, For the tool radius, This is the maximum allowable forward tilt angle of the cutter axis. This refers to the maximum permissible depth of cut calculated based on the allowable residual height. The Canny edge detection algorithm is used to extract the inner contour boundary curve of the cavity for each slice. and outer contour boundary curve ,in For layer number, , This represents the total number of floors. For the first Axial position coordinates of the layer.

3. The method for optimizing toolpaths in multi-axis machining of complex cavities in a tube mold according to claim 2, characterized in that, The adaptive arc length discretization algorithm described in step S1 is as follows: For the Inner contour boundary curve of the layer and outer contour boundary curve Perform curvature analysis separately and calculate the curvature value at each point on the curve. ,in For arc length parameters; The arc length spacing of discrete sampling is adaptively adjusted based on the curvature value. The calculation formula is as follows: ; In the formula, Minimum arc length spacing, The maximum arc length spacing, This is the curvature sensitivity coefficient, with a value range of [value range missing]. , This represents the average curvature of the contour boundary curve of this layer. According to adaptive arc length spacing Discrete sampling of the contour boundary curve yields the knife contact point sequence. ,in , For the first Total number of blade contacts in the layer.

4. The method for optimizing the tool path in multi-axis machining of complex cavities in a tube mold according to claim 3, characterized in that, Step S2 specifically includes the following sub-steps: Step S21: At the tool contact point Establish a local differential geometric coordinate system ,in The direction of the principal curvature of the cavity surface at that point. For the direction of secondary curvature, It is the surface normal vector; Step S22: In the local coordinate system, set the tool axis vector... Represented as lean angle and roll angle The function of the forward tilt angle, where the forward tilt angle is .... For the tool axis vector in - Projection in the plane and The included angle of the shaft, the yaw angle For the tool axis vector in - Projection in the plane and The included angle of the axis; Step S23: Construct geometric interference constraints. By calculating the minimum distance between the tool envelope and the cavity surface, eliminate all factors that could cause tool-workpiece collisions. combination; Step S24: Construct machine tool motion constraints. Based on the rotary axis travel limits and angular velocity limits of the multi-axis CNC machine tool, determine the forward tilt angle. and roll angle The range of values ​​for ; Step S25: Construct cutting stability constraints. Based on the chatter stability lobe diagram, determine the range of tool axis vectors that can guarantee stable cutting under the current cutting parameters. Step S26: Take the intersection of the above three constraints as the feasible region of the tool axis vector constraint. .

5. The method for optimizing the tool path in multi-axis machining of complex cavities in a tube mold according to claim 4, characterized in that, The improved particle swarm optimization algorithm described in step S3 is as follows: The tool axis vector at each tool contact point As a particle, the particle's position vector is The velocity vector is ; The fitness function of a particle is defined as follows: ; In the formula, For the first The first blade contact point and the first The change in the angle between the tool axis vectors of each tool contact point. For the first The first blade contact point and the first The change in the angle between the tool axis vectors of each tool contact point. and Let be the weighting coefficient, satisfying ; Change in included angle Calculated using the following formula: ; In the formula, and These are the unit vectors of the tool axis at the two tool contact points; During the iteration process, each particle updates its velocity and position based on its own historical best position and the group's global best position until the convergence condition is met, thus obtaining the optimal tool axis vector at each tool contact point. .

6. The method for optimizing toolpaths in multi-axis machining of complex cavities in a tube mold according to claim 5, characterized in that, Step S4 specifically includes the following sub-steps: Step S41: For the first Inner contour boundary curve of layered cavity and outer contour boundary curve An improved Voronoi diagram algorithm was used to extract its central axis. ; Step S42: Calculate the centerline curvature values ​​at each point ,in This is the arc length parameter of the central axis; Step S43: Adaptively adjust the row spacing based on the local curvature of the central axis. The calculation formula is as follows: ; In the formula, For reference line spacing, This is the curvature adjustment coefficient, with a value range of [value range missing]. , Central axis The average curvature; Step S44: Along the central axis Direction, according to adaptive line spacing Equal offsets are made on both sides of the central axis to generate a series of path nodes that spiral around the central axis. Step S45: Connect all path nodes according to the processing sequence to form a variable density spiral base path.

7. The method for optimizing toolpaths in multi-axis machining of complex cavities in a tube mold according to claim 6, characterized in that, The cubic B-spline interpolation mapping method described in step S5 is as follows: knife contact sequence and its corresponding optimal tool axis vector As control vertices and control vectors; A cubic B-spline curve was used to fit the knife contact sequence to obtain a parameterized representation of the helical base path. ,in For arc length parameters; The tool axis vector field is obtained by interpolating the tool axis vector using a cubic B-spline surface interpolation method. This ensures that at each tool contact point, the following conditions are met. ,in For the first The arc length parameter corresponding to each blade contact point; The tool axis vector field Mapping to helical base path Up, so that each point on the path Each corresponds to a tool axis vector This generates an initial toolpath with complete tool axis information.

8. The method for optimizing the tool path in multi-axis machining of complex cavities in a tube mold according to claim 7, characterized in that, The objective function of the multi-objective optimization model in step S6 is: ; In the formula, The total objective function value, For path smoothness constraints, This is a constraint term for the smoothness of the tool axis vector. For the uniformity constraint of material removal rate, For interference and collision avoidance constraints, , , , Here are the weight coefficients for each constraint term, satisfying... ; Among them, the path smoothness constraint term Defined as the line integral of the square of the toolpath curvature: ; In the formula, For toolpath arc length parameters curvature at that point For the first Total arc length of the layer toolpath; The objective function is iteratively optimized using the gradient descent method until the change in the total objective function value is less than a preset threshold, thus obtaining the optimal toolpath for a single layer.

9. The method for optimizing toolpaths in multi-axis machining of complex cavities in a tube mold according to claim 8, characterized in that, Steps S7 and S8 specifically include the following sub-steps: Step S71: Obtain the first End point of layer toolpath tangent vector and tool axis vector and the Start position of layer toolpath tangent vector and tool axis vector ; Step S72: Establish connection and For the straight line segment, perform tool envelope sweep interference detection on the straight line segment; Step S73: If there is no interference, the straight line segment is directly used as the interlayer transition path; if there is interference, proceed to step S81. Step S81: In and Generate a fifth-order polynomial spiral transition curve that satisfies the G² continuity condition. ,in For normalized parameters; Step S82: The fifth-order polynomial spiral transition curve satisfies the following boundary conditions: In the formula, and The first Layer endpoint and first Acceleration vector at the start of the layer; Step S83: Calculate the cutter axis vector at each point on the transition path using the spherical linear interpolation method. : ; In the formula, for and The angle between them ; Step S84: Perform interference detection on the generated transition path. If interference still exists, adjust the control point position of the transition curve until the interference-free requirement is met.

10. The method for optimizing tool paths in multi-axis machining of complex cavities in a tube mold according to claim 9, characterized in that, The global consistency check mentioned in step S9 specifically includes: Step S91: Traverse the toolpaths of all machining layers and calculate the change in the tool axis vector angle between adjacent path points; Step S92: If the change in the included angle of the tool axis vector at a certain position is greater than a preset threshold, then mark that position as the tool axis jump point; Step S93: For each tool axis jump point, use the local smoothing algorithm to re-interpolate the tool axis vectors around it so that the tool axis vector change rate satisfies the machine tool motion constraints; Step S94: Calculate the curvature value of each point on the toolpath. If the curvature at a certain position is greater than a preset threshold, mark that position as a path abrupt change point. Step S95: For each abrupt change in the path, smooth the path using either circular arc transition or polynomial transition methods; Step S96: Perform a final global interference check on the processed toolpath to ensure that there are no tool, workpiece, or tool and fixture collisions during the entire machining process.