Sharp angle compensation method and device based on vector path, equipment and medium

By acquiring vector graphics files and parsing path data, the sharp corners in the engraving machine are identified and compensated, solving the accuracy and continuity problems of the engraving machine in cutting sharp corner areas, and achieving high-precision path optimization and stable cutting results.

CN121300236APending Publication Date: 2026-01-09环盛智能(深圳)有限公司
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511472534.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-15
Publication Date
2026-01-09

AI Technical Summary

Technical Problem

Existing engraving machines lack effective sharp corner recognition and compensation mechanisms when cutting sharp corner areas, resulting in cutting path offset, discontinuous transitions, and reduced shape accuracy. This is especially true in two-dimensional cutting equipment without rotation control, where traditional methods suffer from unstable compensation angle calculations and uneven path planning.

Method used

By acquiring vector graphics files, parsing path data, identifying the coordinate information of straight and curved segments, determining the set of sharp corners, calculating supplementary corners and generating compensation parameters, and adjusting the cutting path to generate optimized toolpath commands, precise compensation and path optimization for sharp corner areas can be achieved.

Benefits of technology

It improves cutting accuracy and edge forming quality, reduces path deviation and corner errors, and ensures the continuity of the cutting trajectory and the stability of the processing effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121300236A_ABST
    Figure CN121300236A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of numerical control machining and path planning, and discloses a sharp corner compensation method, device and equipment based on a vector path and a medium. The sharp corner compensation method comprises the steps that a vector graphic file is obtained, path data is extracted, and coordinate information of a straight line segment and a curve segment in the path is analyzed; judging sharp corners and generating a sharp corner set according to the line segment connection relation and the side length non-zero condition, calculating a supplementary angle of each sharp corner and determining a compensation parameter by combining the radius of the cutter, generating a compensation point coordinate set based on the compensation parameter, and adjusting the cutting path according to the compensation point coordinate set to generate a cutter path optimization instruction. According to the method, the geometric features of the vector path are automatically identified and the compensation point of the sharp corner area is calculated, so that accurate compensation and path optimization of the sharp corner in the two-dimensional cutting equipment without rotation control are realized, the cutting precision and the edge forming quality are effectively improved, the path offset and the corner error are reduced, and the product quality is improved. And the continuity of the cutting track and the stability of the machining effect are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of CNC machining and path planning technology, and in particular to a method, apparatus, device and storage medium for sharp corner compensation based on vector path. Background Technology

[0002] In the fields of CNC machining and graphic cutting, sharp corner compensation is a common geometric path correction technique, typically applied in the machining of parts on CNC machine tools. Traditional CNC machine tools possess tool rotation control and multi-axis coordinated motion capabilities, enabling them to adjust the tool rotation direction in real time during machining commands, thereby achieving precise compensation for sharp corner positions. By rotating the tool's posture or adjusting the tool tip incident angle, the machine tool can create a smooth toolpath at sharp corners, ensuring the continuity of the part's contour and the quality of the machined surface. However, this type of compensation process often relies on high-precision rotation control systems and complex tool motion coordination algorithms, requiring high hardware specifications and making it unsuitable for simplified or low-cost equipment.

[0003] In lightweight 2D cutting equipment such as engraving machines, there is usually no independent tool rotation control mechanism; the cutter head can only move in a plane. The tools used in engraving machines generally rely on a tool-supporting structure to change direction. When the cutting path passes through a sharp corner, a deviation occurs between the force direction of the tool and the movement path, resulting in a cutting path that does not match the desired geometric contour. This is especially problematic when processing vector graphics files (such as SVG format), where the path contains numerous complex connection points between straight and curved segments, often forming sharp corners. Because the tool cannot rotate actively, precise correction of sharp corner areas is difficult to achieve solely through path movement, easily leading to problems such as over-cutting of sharp corners, rounded corners, or incomplete edges, thus affecting the overall cutting accuracy and the appearance quality of the text and patterns.

[0004] Existing engraving machine control systems mostly employ direct path tracking for cutting, meaning the cutter head moves sequentially according to the coordinates of the vector path, lacking intelligent recognition and compensation algorithms for sharp corner areas. This method lacks specific path adjustment strategies at sharp corners, and uneven force on the cutter when entering or leaving the corner can lead to toolpath deviation. Furthermore, while some improved solutions attempt to correct sharp corners through deceleration, interpolation, or fixed-angle compensation, they generally suffer from two problems: first, the compensation angle calculation lacks adaptive judgment based on geometric features, resulting in unstable performance under different corner shapes; second, uneven distribution of compensation points or lack of optimized path planning can easily cause discontinuous path transitions, tool jitter, or decreased processing efficiency.

[0005] Therefore, in order to address the problems of insufficient compensation accuracy, poor path continuity, and weak processing trajectory optimization capabilities of engraving machines without rotation control when performing sharp corner cutting, there is an urgent need for a solution that can automatically identify the position of sharp corners, analyze geometric features, and generate compensation paths based on vector paths, so as to achieve a high-precision, highly controllable sharp corner compensation processing method applicable to ordinary engraving machine equipment. Summary of the Invention

[0006] The main objective of this invention is to provide a vector path-based method, apparatus, device, and storage medium for sharp corner compensation, aiming to solve the technical problem that the prior art lacks a sharp corner recognition and compensation mechanism for two-dimensional cutting equipment without rotation control, resulting in cutting path offset, discontinuous transition, and reduced shape accuracy in sharp corner areas.

[0007] To achieve the above objectives, the present invention provides a sharp corner compensation method based on vector paths, comprising:

[0008] Obtain a vector graphics file and extract path data from the vector graphics file;

[0009] Parse the path data to extract the coordinate information of straight line segments and curve segments;

[0010] Based on the coordinate information of the straight line segment and the curve segment, the sharp angles are determined according to the connection relationship of the line segments and the condition that the side length is non-zero, and a set of sharp angles is generated.

[0011] For each sharp angle in the set of sharp angles, determine the coordinates of the starting point, vertex, and ending point;

[0012] Calculate the supplementary angle for the sharp angle based on the coordinates of the starting point, vertex, and ending point;

[0013] The compensation parameters are determined based on the tool radius and the sharp corner supplement.

[0014] Generate a set of compensation point coordinates based on the compensation parameters;

[0015] The cutting path is adjusted based on the set of compensation point coordinates to generate optimized toolpath commands.

[0016] Furthermore, to achieve the above objectives, the present invention provides a sharp corner compensation device based on a vector path, comprising:

[0017] The vector file parsing module is used to obtain vector graphics files and extract path data from the vector graphics files.

[0018] The path data parsing module is used to parse the path data and extract the coordinate information of straight line segments and curve segments;

[0019] The sharp angle recognition module is used to determine sharp angles based on the coordinate information of the straight line segment and the curve segment, according to the connection relationship of the line segments and the condition that the side length is non-zero, and generate a set of sharp angles.

[0020] The geometric coordinate extraction module is used to determine the starting point, vertex, and ending point coordinates for each sharp corner in the set of sharp corners;

[0021] The supplementary angle calculation module is used to calculate the supplementary angle of a sharp angle based on the coordinates of the starting point, vertex, and ending point.

[0022] The compensation parameter generation module is used to determine the compensation parameters based on the tool radius and the sharp corner compensation.

[0023] The compensation point calculation module is used to generate a set of compensation point coordinates based on the compensation parameters;

[0024] The toolpath optimization module is used to adjust the cutting path based on the set of compensation point coordinates and generate optimized toolpath commands.

[0025] Furthermore, to achieve the above objectives, the present invention also provides a computer device, the computer device including a memory, a processor, and a vector path-based corner compensation program stored in the memory and executable on the processor, wherein when the vector path-based corner compensation program is executed by the processor, it implements the steps of the vector path-based corner compensation method as described above.

[0026] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a vector path-based corner compensation program, wherein when the vector path-based corner compensation program is executed by a processor, it implements the steps of the vector path-based corner compensation method as described above.

[0027] Beneficial Effects: This invention relates to the field of CNC machining and path planning technology, and discloses a method, device, equipment, and medium for sharp corner compensation based on vector paths. The method includes: acquiring vector graphics files and extracting path data; parsing the coordinate information of straight and curved segments in the path; determining sharp corners and generating a set of sharp corners based on the connection relationship of line segments and the condition that the side length is non-zero; calculating the compensation angle for each sharp corner and determining compensation parameters based on the tool radius; generating a set of compensation point coordinates based on the compensation parameters; and adjusting the cutting path according to the set of compensation point coordinates to generate optimized toolpath commands. This invention achieves accurate compensation and path optimization for sharp corners in two-dimensional cutting equipment without rotational control by automatically identifying the geometric features of the vector path and calculating compensation points in sharp corner areas. This effectively improves cutting accuracy and edge forming quality, reduces path offset and corner errors, and ensures the continuity of the cutting trajectory and the stability of the processing effect. Attached Figure Description

[0028] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings:

[0029] Figure 1 This is a schematic diagram of an application environment for a vector path-based sharp corner compensation method according to an embodiment of the present invention;

[0030] Figure 2 This is a flowchart illustrating an embodiment of the vector path-based sharp corner compensation method of the present invention.

[0031] Figure 3 This is a schematic diagram of the functional modules of a preferred embodiment of the vector path-based sharp corner compensation device of the present invention;

[0032] Figure 4 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention;

[0033] Figure 5 This is another structural schematic diagram of a computer device according to one embodiment of the present invention;

[0034] Figure 6 This is a schematic diagram of the sharp corner compensation method based on vector path of the present invention;

[0035] Figure 7 Comparison images of existing sharp corner burrs without sharp corner compensation;

[0036] Figure 8 This is a diagram illustrating the effect of cutting sharp corners according to the present invention. Detailed Implementation

[0037] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.

[0038] The vector path-based sharp corner compensation method provided in this invention can be applied to, for example... Figure 1In this application environment, the client communicates with the server via a network. The server can obtain vector graphics files from the client and extract path data, parse the coordinate information of straight and curved segments in the path, determine sharp corners based on the connection relationship of line segments and the condition that the side length is non-zero, generate a set of sharp corners, calculate the compensation angle for each sharp corner, determine the compensation parameters based on the tool radius, generate a set of compensation point coordinates based on the compensation parameters, and adjust the cutting path according to the set of compensation point coordinates to generate optimized toolpath instructions. This invention achieves accurate compensation and path optimization for sharp corners in two-dimensional cutting equipment without rotation control by automatically identifying the geometric features of the vector path and calculating compensation points in sharp corner areas. This effectively improves cutting accuracy and edge forming quality, reduces path offset and corner errors, and ensures the continuity of the cutting trajectory and the stability of the processing effect. The client can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented using a standalone server or a server cluster composed of multiple servers. The invention will be described in detail below through specific embodiments.

[0039] Please see Figure 2-8 , Figure 2 This is a flowchart illustrating an embodiment of the vector path-based corner compensation method provided by the present invention. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.

[0040] like Figure 2 As shown, the sharp corner compensation method based on vector path proposed in this invention includes the following steps:

[0041] S10, Obtain a vector graphics file and extract path data from the vector graphics file;

[0042] In this embodiment, the process of acquiring vector graphics files involves reading graphic file data containing path information from an input device, storage medium, or remote network. Vector graphics files are typically stored using structured description languages ​​such as SVG, DXF, and AI, recording the shape and boundaries of graphic objects through path commands and parameters. The file reading stage requires parsing the file's header information and identifying the encoding method and coordinate system definition to ensure correct mapping of subsequent coordinate data. The file reading module can be implemented using a standard input stream interface or a custom parsing module, and performs file integrity checks and abnormal data filtering during the import process to prevent path information loss due to file corruption or format errors.

[0043] The process of extracting path data from vector graphics files involves structural parsing, hierarchical traversal, and command recognition of the file content. Path data typically consists of linear and curved commands, including commands such as moving, drawing straight lines, drawing Bézier curves, and closing paths. The parsing phase requires identifying path nodes, control points, and connection relationships, and converting path commands into a sequence of coordinate points. The extracted path data is stored as a coordinate array, serving as input for subsequent geometric analysis and sharp corner recognition. The parsing module can be implemented using regular expression matching, syntax tree parsing, or label-based path node extraction algorithms. If the file contains multi-level paths, the hierarchical attributes and transformation matrix information of the paths should be preserved during the parsing process to maintain the geometric consistency of the original graphics.

[0044] In one implementation, an SVG format graphic file is loaded via a file input interface. A DOM parser traverses the file structure, locates nodes containing path tags, and extracts path commands and parameter values. For transformation matrices present in the path, matrix operations are used to convert local coordinates to global coordinates, unifying the coordinate reference. In another implementation, for DXF files, path entity information can be directly read through the instruction stream parsing module. The module can distinguish between straight lines, arcs, or spline curves based on object type and extract their geometric parameters. Alternatively, in a networked environment, vector file stream data can be obtained from a remote design system via an HTTP interface and then structuredly parsed after local caching. For files containing multi-level paths, a multi-threaded parsing mechanism can be used to extract paths in parallel, improving the overall parsing speed.

[0045] This embodiment achieves compatible processing of different file formats and coordinate systems through structured reading and path data extraction of vector graphics files, providing a unified data foundation for subsequent geometric calculations and path compensation. It effectively avoids the distortion of sharp corner recognition caused by differences in coordinate systems or path parsing errors, and improves the accuracy of path analysis and processing data conversion.

[0046] S20, parse the path data and extract the coordinate information of the straight line segments and curve segments;

[0047] In this embodiment, the process of parsing path data aims to transform structured vector path information into a set of numerical coordinates that can be used for geometric calculations. Path data is typically recorded in a graphics file in the form of command sequences and parameters, with each path containing several consecutive drawing instructions. During parsing, the command identifier is first read to identify the drawing type, such as a straight line, a quadratic Bézier curve, a cubic Bézier curve, or an elliptical arc. Each drawing type comes with a set of coordinate parameters, and the corresponding point set can be generated through parameter parsing and numerical conversion. For straight line segments, only the coordinates of the start and end points need to be extracted and combined according to the drawing order. For curve segments, the coordinates of control points need to be parsed, and the intermediate points need to be calculated using the curve equation to generate a smooth curve coordinate sequence. During the extraction process, the parsing module should simultaneously record the absolute and relative coordinate states of the path. If the file uses a relative coordinate system, the offset needs to be gradually accumulated to restore the global coordinates.

[0048] While parsing path data, the system also needs to handle the state inheritance relationship between commands. For example, multiple consecutive curve commands may share endpoint coordinates or control points, requiring the parser to retain the context state of the previous command. To improve numerical accuracy, floating-point precision conversion and rounding control mechanisms can be used during parsing to ensure geometric consistency in subsequent sharp corner identification and compensation calculations. For nested paths or multi-level structures that may appear in the file, document level mapping should be performed before path parsing to ensure that the coordinate system of different path segments is consistent.

[0049] In one implementation, a path parsing module reads the path command sequence character by character, mapping each command and parameter pair to a data object. For a straight line drawing command, the coordinates of both ends are extracted and stored as line segment records. For a cubic Bézier curve command, the coordinates of control points are extracted, and the coordinates of intermediate points are calculated using a subdivision algorithm to generate a set of curve segment coordinates composed of discrete points. In another implementation, existing parsing engines, such as Cairo, Skia, or custom geometry calculation modules, can be called through a graphics library interface to directly generate standardized path objects, and then the system extracts the coordinate array of each path object. A coordinate smoothing module can also be added after parsing to interpolate and correct the discrete points of the curve, improving coordinate accuracy and curve continuity.

[0050] This embodiment quantifies and structures the geometric description in the vector file by parsing the path data and extracting the coordinate information of line and curve segments, providing a unified geometric input basis for subsequent sharp angle determination and path compensation. This parsing mechanism avoids parameter errors between different drawing command types, improves the accuracy of curve and line segment recognition, and ensures the accuracy of angle and distance calculations in subsequent geometric operations.

[0051] S30, Based on the coordinate information of the straight line segment and the curve segment, determine the sharp angles according to the connection relationship of the line segments and based on the condition that the side length is non-zero, and generate a set of sharp angles;

[0052] In this embodiment, the process of determining sharp angles based on the coordinate information of straight and curved segments hinges on identifying the geometric angle formed between two adjacent line segments in the path and determining whether it belongs to a sharp angle region based on the angle and side length conditions. First, the system needs to construct the connection relationships between line segments. Adjacency is determined by comparing the endpoint coordinates of each line segment. If the endpoint of one line segment is numerically equal to the starting point of another line segment, or equal within a tolerance range, then the two are considered connected. For curved segments, their discretized endpoint sequence can be extracted first, and the connection of endpoints or approximately linear segments can be used as the basis for determination.

[0053] After establishing the connection, the included angle is calculated for each pair of adjacent line segments. The angle is calculated based on the direction vectors of the two line segments, and the angle value is obtained through the vector dot product. If the angle is less than a preset threshold and the lengths of both line segments are non-zero, the connection point is determined to be a sharp corner. The non-zero side length condition is used to eliminate invalid or overlapping paths to prevent misjudgments caused by zero-length line segments or duplicate nodes. During the calculation process, the system needs to dynamically correct the length threshold, adjusting the side length tolerance range according to the graphic size, coordinate units, and processing scale to ensure the geometric stability of the judgment.

[0054] When the angle meets the criteria for a sharp angle, the coordinates of the connection point, the angle value, and the index information of the two adjacent line segments are grouped into a data unit and stored. All sharp angle data units that meet the criteria constitute a sharp angle set. Each sharp angle in the set records its geometric attributes, including the included angle size, the index of adjacent line segments, the direction vector, and the position coordinates. If the path is a closed structure, periodic checks must be performed when processing the connection of the first and last line segments to prevent missing closed sharp angles.

[0055] In one implementation, the system establishes a line segment connection table using an endpoint comparison algorithm and calculates the included angle for each pair of adjacent line segments. If the included angle is less than 30 degrees and the lengths of all line segments are greater than a set threshold, the system marks the point as a sharp angle. In another implementation, a linear approximation can be performed on the curve segment during the preprocessing stage, discretizing the Bézier curve or arc into multiple short straight line segments, and then using the same judgment method to identify sharp angles at curve transitions. An adaptive threshold algorithm can also be introduced to automatically adjust the sharp angle threshold based on the overall path complexity, achieving adaptive recognition under different graphic structures. For coordinate points with floating-point errors, endpoint alignment can be performed using a spatial tolerance method to improve the matching accuracy of connection relationships.

[0056] This embodiment determines sharp angles and generates a set of sharp angles based on the coordinate information of straight and curved segments, achieving automatic identification of path geometry and reducing manual intervention. The determination mechanism, which combines the non-zero side length condition with an included angle threshold, effectively avoids misidentification of short line segments and false sharp angles, improving the accuracy and robustness of sharp angle detection and providing high-precision sharp angle input data for subsequent compensation point calculations.

[0057] S40, for each sharp corner in the set of sharp corners, determine the coordinates of the starting point, vertex, and ending point;

[0058] In this embodiment, for each sharp corner in the set of sharp corners, three key coordinates constituting the sharp corner need to be determined based on its geometry: the coordinates of the starting point, the vertex, and the ending point. The system first reads the coordinates of the connection points, the indices of adjacent line segments, and the direction information of the line segments recorded in the set of sharp corners. The two boundary line segments that participate in forming the sharp corner are located using the line segment indices, and the coordinates of the two ends of each line segment are extracted. Based on the geometric connection relationship, the common endpoint of the two line segments is identified as the vertex of the sharp corner. The non-common endpoints are marked as the starting point and the ending point, respectively, to describe the two sides of the sharp corner's boundaries.

[0059] In scenarios involving multiple paths or closed paths, the system needs to further correct the directional relationships of the coordinates. To this end, the direction vector of each line segment can be calculated, and the order of the start and end points can be determined by the included angle. If the included angle between the direction vectors of two line segments is acute and the paths are aligned, the start and end points are determined according to the path drawing order; if the directions of two line segments are opposite, the rotation direction is determined by the sign of the cross product of the direction vectors to ensure that the coordinate arrangement conforms to the geometric continuity of the path. To prevent coordinate drift, a numerical tolerance method can be used for coordinate alignment to ensure the numerical consistency between the sharp corner vertices and the endpoints of the two boundary line segments.

[0060] The system can establish a geometric center reference point during the coordinate determination process to assist in verifying the topological correctness of the three points. The geometric center is calculated by taking the average of the three point coordinates and determining whether the three points are collinear by calculating the cross product of vectors. If they are collinear, they are marked as invalid sharp angles and removed from the set. After the calculation is completed, the coordinates of the start point, vertex, and end point are recorded in structured data form to provide accurate input for subsequent angle supplementation calculations.

[0061] In one implementation, the system traverses the set of sharp corners and directly reads the coordinate endpoints of two boundary line segments using line segment indexes. The coordinate values ​​of the two line segment endpoints are compared; if the difference is within a set tolerance range, they are determined to be the same point and designated as a vertex. The remaining two endpoints are designated as the start and end points, respectively. In another implementation, when dealing with complex curve structures, endpoint extraction and control point calculation can be performed on the curve segments. The extension direction of the curve is estimated using the control point direction vector to determine the start and end point positions. This process can also be extended in a three-dimensional coordinate system by projecting spatial sharp corners onto a plane, maintaining geometric consistency to support compensation calculations for non-planar paths.

[0062] This embodiment precisely determines the coordinates of the start point, vertex, and end point within the set of sharp corners, forming a structurally complete geometric unit for the sharp corner, providing stable input for subsequent angle calculations and compensation path generation. This processing method ensures the consistency of geometric connections between different types of line segments (straight lines and curves), avoiding angle deviations caused by coordinate errors or inconsistent path directions, and improving the accuracy of sharp corner identification and geometric analysis.

[0063] S50, calculate the supplementary angle of the sharp corner based on the coordinates of the starting point, vertex and ending point;

[0064] In this embodiment, the process of calculating the corner supplement based on the coordinates of the starting point, vertex, and ending point is an angle restoration and spatial reconstruction of the geometric features of the corner. The calculation process first uses the coordinates of the three points as input to construct direction vectors from the starting point to the vertex and from the vertex to the ending point, respectively. The direction vectors are obtained by calculating the difference between the coordinates of the two points, and their direction reflects the geometric orientation of the path boundary. The system then standardizes the two direction vectors to make their lengths uniform to a unit length, so as to avoid angle offsets caused by different line segment lengths. Next, the included angle value is obtained by using the vector dot product formula. This included angle represents the geometric sharpness of the original corner of the path.

[0065] After obtaining the included angle, the system calculates the corner compensation based on the geometric angle compensation relationship, that is, subtracting the included angle value from 180 degrees to obtain the turning angle that the tool movement should compensate for. If the tool radius is large or the path requires a smooth transition during machining, a corner compensation correction coefficient can be introduced. The calculation result is corrected by the tool size and machining accuracy parameters to ensure that the actual motion path of the corner compensation is more in line with the physical conditions of cutting. For sharp corners formed by curve segments, the direction vector needs to be corrected by curvature continuity constraints to prevent corner compensation distortion caused by errors in the calculation of the curve tangent direction.

[0066] During the calculation process, the system can perform a reasonableness verification on the calculation results. If the supplementary angle value is less than the preset lower limit or exceeds the reasonable range of plane geometry, the sharp angle is marked as abnormal data and recalculated or removed. To improve calculation accuracy, double-precision floating-point calculation can be used and the value is retained to a specified number of decimal places at the end, ensuring that the angle value can be directly used for high-precision path calculation in the subsequent compensation point generation stage.

[0067] In one implementation, after acquiring the coordinates of three points, the system directly uses the geometric calculation module to calculate the included angle and supplementary angle, and records the results. In another implementation, to adapt to different coordinate systems, matrix operations can be introduced to convert the three-point coordinates into a local coordinate system before angle calculation, thus eliminating errors caused by global coordinate offset. The sign of the vector cross product can also be used to determine the angle direction, distinguishing between interior and exterior angles, thereby accurately adjusting the tool movement direction during path compensation. Furthermore, an adaptive precision control mechanism can be set in the calculation module to dynamically adjust the calculation precision based on the resolution of the input data.

[0068] This embodiment calculates the corner compensation based on the coordinates of the starting point, vertex, and ending point, accurately reflecting the turning characteristics of the path at the geometric level and providing a reliable angular basis for the subsequent generation of compensation points. This calculation mechanism takes into account both straight and curved connection scenarios, avoiding compensation offsets caused by angle errors or direction recognition mistakes in traditional methods, thereby improving the accuracy and stability of cutting path optimization.

[0069] S60, determine the compensation parameters based on the tool radius and the sharp corner supplement;

[0070] In this embodiment, the process of determining compensation parameters based on the tool radius and the corner compensation angle involves converting the geometric calculation results into spatial offset control quantities that can be used for cutting path correction. First, the tool radius parameter needs to be read. This parameter is typically stored in the CNC equipment configuration file or tool management database and represents the offset distance between the tool edge center and the actual cutting trajectory. The system calculates a safety distance offset based on the tool radius to ensure that the tool does not overcut or leave material when approaching a corner area due to the tool width. The offset calculation is based on the geometric relationship between the tool radius and the corner compensation angle, and a precise linear offset value can be obtained using trigonometric function formulas.

[0071] Subsequently, the system analyzes the angle value of the sharp corner compensation and solves it together with the tool radius to obtain the angle bisector interval parameter. This parameter reflects the angle distribution pattern between the two boundaries of the sharp corner and is used for subsequent angle division and path planning of compensation points. To improve computational flexibility, the system can introduce an angle density function to adaptively adjust the bisector interval according to the size of the sharp corner compensation, achieving distribution control of dense compensation in acute angle regions and sparse compensation in obtuse angle regions.

[0072] Simultaneously, the compensation point density parameter is set according to the machining accuracy requirements. This parameter defines the number of compensation points or the angular spacing to be generated within the compensation angle range, affecting the smoothness and transition accuracy of the final cutting path. During high-precision machining, the system dynamically increases the density parameter based on the preset machining level; if the path involves large-area cutting, the density can be reduced to decrease the computational load. Finally, the system integrates the safety distance offset, angular bisector interval parameter, and compensation point density parameter to generate a compensation parameter structure, which is then used for subsequent calculations of compensation point coordinates.

[0073] In one implementation, the system reads the tool radius parameter and calculates the safety distance offset by combining it with the corner compensation angle. The offset distance is obtained through the relationship R×sin(θ / 2), where R is the tool radius and θ is the corner compensation angle value. In another implementation, a nonlinear correction coefficient can be established through an empirical data model to make the compensation parameters more closely match the tool movement trajectory at small angles. An automatic tool type identification mechanism can also be introduced into the system, using different compensation coefficients for circular cutters, conical cutters, and V-shaped cutters to match the actual machining behavior under different tool cross-sectional shapes. The system can also adjust the compensation point density based on material property parameters, ensuring that path compensation for different objects such as metals, plastics, and composite materials balances strength and accuracy.

[0074] This embodiment determines compensation parameters based on the tool radius and sharp corner compensation, establishing a mapping relationship between the tool's physical properties and the path's geometric features, thus making path compensation more accurate. This process comprehensively considers tool size, angular geometry, and machining accuracy factors, effectively avoiding cutting errors in sharp corner areas and tool interference problems, significantly improving the fit of the cutting trajectory and the quality of the finished product's edge.

[0075] S70, Generate a set of compensation point coordinates based on the compensation parameters;

[0076] In this embodiment, the process of generating a set of compensation point coordinates based on compensation parameters is a geometric calculation process that transforms the tool geometry and sharp corner angle data into a spatial coordinate distribution. The system first parses the safety distance offset, angle bisector interval parameter, and compensation point density parameter contained in the compensation parameters, and reads the vertex coordinates of the sharp corner from the geometric calculation module as a reference point. Based on the angle value of the sharp corner compensation, the compensation area is divided into multiple sub-angles according to the angle bisector interval parameter. Each sub-angle corresponds to a compensation direction, used to generate a spatial distribution direction sequence of compensation points.

[0077] The system uses vertex coordinates as a reference and performs offset calculations for each sub-angle direction. The magnitude of the offset is determined by a safety distance offset, calculated by extending the offset along the radius in the corresponding sub-angle direction with the vertex as the center, thus obtaining the coordinates of the compensation point. If the path has nonlinearity or curvature continuity requirements, a polar coordinate transformation can be used to combine the angle and radius parameters and then convert them to Cartesian coordinates, thereby ensuring a smooth distribution of the compensation points in the local coordinate system.

[0078] To prevent excessive concentration of compensation points at sharp corners or coordinate overlap, the system dynamically adjusts the sub-angle distribution density based on the compensation point density parameter. The number of sub-angles is increased in acute-angle regions to improve compensation accuracy, while the number is reduced in obtuse-angle regions to improve computational efficiency. After generating the coordinates of each compensation point, the system performs a validity check on the coordinate values, detecting whether they overlap with the original path, exceed the cutting range, or violate tool safety distance limits. If abnormal coordinates are detected, interpolation between adjacent compensation points is used for correction, or the compensation direction is recalculated until all coordinates pass verification.

[0079] The generated set of compensation point coordinates is stored in a sequential structure. Each point contains its x-coordinate, y-coordinate, and corresponding angle index information, providing precise input for the subsequent cutting path adjustment module. The system can also attach compensation point type identifiers to the coordinate set to distinguish compensation strategies under different geometric shapes, such as linear compensation points and curve transition compensation points.

[0080] In one implementation, the system divides the compensation angle into equal-angle sections according to the angle bisector interval parameter, calculates the coordinate position of each compensation point using simple trigonometric functions, and records them sequentially to form a coordinate set. In another implementation, the distribution pattern of compensation points can be determined based on the tool radius and path curvature, employing a nonlinear segmentation algorithm to make compensation points more densely packed in areas with significant curvature changes. A dynamic optimization mechanism can also be introduced during the compensation point generation process, adaptively adjusting the angle interval of the next point based on the distance between two consecutive compensation points, achieving continuity and smoothness in the coordinate distribution. Furthermore, for sharp angles containing curve boundaries, compensation points can be calculated by combining the curve tangent direction and the angle offset, ensuring that the generated coordinate set maintains geometric consistency at the intersection of curve and straight line segments.

[0081] This embodiment achieves precise mapping from geometric angle information to path coordinate space by generating a set of compensation point coordinates based on compensation parameters. This process not only maintains the geometric continuity of sharp corner areas but also ensures a smooth transition of the tool path in space, effectively avoiding cutting errors and edge burrs caused by path discontinuities. The distribution of compensation points adapts to angle characteristics and tool parameters, improving the detail accuracy and surface quality of cutting sharp corner areas.

[0082] S80, adjust the cutting path according to the set of compensation point coordinates, and generate optimized toolpath instructions.

[0083] In this embodiment, adjusting the cutting path and generating optimized toolpath instructions based on the set of compensation point coordinates requires completing three closely linked geometric and CNC conversion tasks: path geometry reconstruction, kinematic execution, and instruction post-processing. First, the original cutting path is locally replaced, inserting the set of compensation point coordinates into the path sequence of the sharp-angle neighborhood. To avoid topology disruption, a parametric index is first established on the original path. The replacement window of the sharp-angle neighborhood is located using arc length parameters or command sequence indexes. Then, the window is aligned with the order of the compensation points and the angle index, achieving a one-to-one sequence splicing. After splicing, geometric consistency checks are performed, including node connectivity, segment direction consistency, detection of sign changes in the angle between adjacent segments, self-intersection and backtracking detection, and floating-point drift is handled with a numerical tolerance threshold. If necessary, adjacent points are merged using minimum distance.

[0084] After the path geometry reconstruction is completed, the curvature and smoothing control stage begins. Abrupt changes are screened using curvature estimation (based on three-point circles or Frenet estimation). For sharp-corner neighborhoods, a curvature-continuous transition configuration is adopted: circular arc fitting (least square constraint radius range and maximum radial error) can be performed on adjacent polyline segments, or quadratic or cubic B-spline fitting can be performed on the polyline sequence with a maximum deviation threshold set to ensure that the fitted path replaces the polyline under deviation control. To ensure tool envelope safety, equidistant offset verification is performed in conjunction with the safety distance offset, checking the minimum gap between the fitted path and the material boundary; if the gap is insufficient, the fitting order is reduced or the transition radius is decreased according to priority until the gap constraint is met. G¹ or G² continuity constraints are used for splicing curves and straight lines to avoid speed jumps and normal reversals. For extremely short segments, a blade-eliminating rule is applied: if the segment length is below the lower limit that the equipment step distance and control cycle can resolve, adjacent segments are merged or replaced with an equivalent circular arc to reduce minor jitter.

[0085] Kinematic execution transforms a geometric path into a time-parameterized trajectory. Based on the device's maximum feed, acceleration, and jump limits, the smoothed path undergoes forward and backward velocity propagation, with the feed upper limit constrained using the radius of curvature (e.g., ...). The feed rate is automatically reduced in high curvature regions (with a convergent upper limit) and resumed in straight or large-radius sections. Continuous velocity constraints are applied to the start and end velocities of adjacent segments, with S-shaped velocity transitions inserted when necessary to control position loop oscillations. Angle reduction coefficients and minimum dwell time thresholds are set according to the medium characteristics (film, paper, reflective film, etc.) to avoid dwell burns or indentations. For extremely sharp angles with a high risk of tool tip drift, a micro-feedforward segment is generated based on the compensation point density parameter, using velocity feedforward and path filtering to jointly suppress overshoot.

[0086] Post-processing maps time-parameterized geometric segments to a set of device instructions. For CNC controllers with G-code interpreters, straight segments are mapped to G1, and circular segments are mapped to G2 / G3, with feed F, unit, and plane settings output in the same sequence. When outputting HPGL or vendor protocol commands for engraving machines, splines and circular arcs are expanded into segmented straight lines, with the upper limit of segment length controlled by the maximum allowable chord error. A global strategy of unit and coordinate zero-point consistency is adopted to ensure consistency with the preceding coordinate standardization. Lead-in and lead-out micro-segments are added to the start and end segments of the path, with the direction selected consistent with the toolpath direction, and the length constrained by both material and tool radius. For multi-corner scenarios, path rearrangement is implemented, using nearest neighbor or graph optimization strategies to reduce idle travel and toolpath lifting times. Before finally generating the optimized toolpath command, simulation verification is performed: geometric simulation checks for out-of-bounds, overcutting, and undercutting; kinematic simulation checks for overspeed, over-acceleration, and command density overflow; if a risk is found, it is automatically corrected and the result is regenerated by rolling back to the smoothing and time parameterization stage according to priority.

[0087] One implementation employs a lightweight process of local replacement and arc priority. The replacement window is centered on the sharp corner vertex and expands outwards by a fixed proportion according to the arc length. The coordinate sets of compensation points are directly spliced ​​together, and then arc fitting is performed on the spliced ​​neighborhood. The radius range is limited to a multiple of the safe distance offset. If a stable fit cannot be achieved, it reverts to a polyline with a short rounded corner transition. Time parameterization uses a bidirectional speed limiting algorithm. A curvature threshold triggers local deceleration, and the output is mainly composed of G1 / G2 / G3 instructions, which are adapted to controllers with basic arc interpolation functions.

[0088] Another implementation approach, designed for lettering devices that do not support circular interpolation, employs B-spline fitting and piecewise linearization. Quadratic or cubic B-splines are constructed for the neighborhood of the compensation point, constraining the maximum deviation and upper limit of curvature. The splines are then cut into straight line segments using an adaptive step size, determined by both the curvature and the controller's minimum pulse resolution, ensuring that contour errors are controlled. Speed ​​planning uses both curvature and the device's stepping frequency upper limit to trim instantaneous feeds, and synchronously limits the command frequency when outputting HPGL-type commands to avoid buffer overflow.

[0089] Path reconstruction with global energy minimization can also be employed. Using the smoothed, optimized path as variables, an objective function is constructed, consisting of path bending energy, profile deviation, tool envelope, and minimum segment length. This objective function is then solved using sequential quadratic programming to obtain a high-order continuous path. This path is subsequently time-parameterized and adapted to the controller. In scenarios with numerous sharp corners, graph optimization can be introduced to rearrange the order of corner handling and cross-segment connections, reducing idle time. For scenarios with flexible media, the upper limits of feed and acceleration are dynamically adjusted according to curvature and tool tip orientation, and velocity perturbations are added to long-stroke straight segments to suppress resonance.

[0090] This embodiment achieves a robust conversion from discrete compensated geometry to an executable toolpath through geometric reconstruction driven by a set of compensated point coordinates, continuous curvature smoothing, and constrained time parameterization. Local replacement preserves the original topology and eliminates sharp corner abrupt changes; circular or spline transitions achieve G¹ / G² continuity within deviation and clearance constraints; speed planning ensures feed is constrained by both curvature and equipment limits without overshoot; and post-processing consistently maps geometric and temporal information into control commands. This reduces burrs and overcutting, minimizes chatter marks and corner scratches, improves contour accuracy in sharp corner areas and overall machining efficiency, and maintains stable output under different controller and media conditions.

[0091] This invention relates to the field of CNC machining and path planning technology, and discloses a method, device, equipment, and medium for sharp corner compensation based on vector paths. The method includes: acquiring vector graphics files and extracting path data; parsing the coordinate information of straight and curved segments in the path; determining sharp corners and generating a set of sharp corners based on the connection relationship of line segments and the condition that the side length is non-zero; calculating the compensation angle for each sharp corner and determining compensation parameters based on the tool radius; generating a set of compensation point coordinates based on the compensation parameters; and adjusting the cutting path according to the set of compensation point coordinates to generate optimized toolpath commands. This invention achieves precise compensation and path optimization for sharp corners in two-dimensional cutting equipment without rotational control by automatically identifying the geometric features of the vector path and calculating compensation points in sharp corner areas. This effectively improves cutting accuracy and edge forming quality, reduces path offset and corner errors, and ensures the continuity of the cutting trajectory and the stability of the processing effect.

[0092] In one embodiment, step S10 above includes:

[0093] S101, Receive vector graphics file input, and obtain file data content containing path description information;

[0094] S102, parse the document structure hierarchy of the file data content and locate the tag segment containing path description information;

[0095] S103: Read the coordinate system definition and unit identifier in the vector graphics file, unify the coordinate reference based on the coordinate system definition and unit identifier, and generate standardized coordinate data;

[0096] S104, Based on the standardized coordinate data, the document-level transformation is applied to the path level to obtain the transformed path description information;

[0097] S105, based on the tag segment, parse the transformed path description information and extract path data containing path command sequence and coordinate parameters.

[0098] In this embodiment, the process of receiving vector graphics file input addresses both file streams and discrete files. Input undergoes length recording and checksum calculation to confirm transmission integrity, followed by character encoding detection and unification. UTF-8 is prioritized for parsing, and compressed files are decompressed layer by layer. A read-only buffer is built in memory and file metadata is annotated for subsequent traceability. Obtaining file data containing path description information relies on structure-aware reading rather than regular expression extraction. A document object model is built using a securely configured parser, external entities and script execution are disabled, prefix binding is performed according to namespace registration rules, forming a hierarchical tree with the root node as the entry point. Simultaneously, a location index and attribute snapshot are created for each node to ensure the determinism and repeatability of subsequent location.

[0099] Parsing the document structure hierarchy is used to locate tag segments containing path description information. For SVG types, path, polyline, polygon, and group nodes containing equivalent path geometry are located through hierarchical traversal or path lookup, and their associated context attributes such as transform, style, clipPath, mask, and use are preserved. For DXF or similar structured vector formats, ENTITIES or equivalent sections are treated as semantic counterparts of tag segments, and entries such as LWPOLYLINE, SPLINE, and ELLIPSE are marked for subsequent unified processing. After location, a list of tag segments is generated, and each entry is bound to the in-situ hierarchical path, local style, and local transformation to ensure that the path source is clear and traceable.

[0100] When reading coordinate system definitions and unit identifiers from vector graphics files, coordinate conversion relationships are constructed by combining the unit and viewport parameters provided by the root node and document header. In SVG scenarios, the ratio of user coordinates to physical length is derived from width, height and their units, viewBox rectangle, and preserveAspectRatio strategy. In CAD-type data, unit fields and global scaling items are read, and DPI-to-length conversion is applied when necessary. The process of unifying the coordinate reference normalizes the scale, origin, and axis: millimeters or other internal standard units are selected as the sole measure; the coordinate orientation is unified on the 2D plane, and the differences in the original y-axis direction are recorded; a homogeneous transformation matrix from the document reference to the internal reference is constructed, generating standardized coordinate data. This data represents all lengths in double precision, eliminating unit ambiguity and providing a stable numerical domain for subsequent geometric operations.

[0101] Document-level transformations are applied to the pushdown and matrix multiplication of path-level dependent transformations. First, a chain of transforms is collected from the root node downwards, including translations, rotations, scaling, skewing, and arbitrary matrix forms. For groups with containment relationships, a cumulative matrix is ​​calculated and cached, then expanded all at once at the path level. For polylines and polygons, the cumulative matrix is ​​applied directly to each vertex; for Bézier curves, it is applied to endpoints and control points; for elliptical arcs, the endpoints, center, and principal axis directions are first made consistent within the parameter domain, then an equivalent transformation in Cartesian space is performed using linear algebra while maintaining consistency between the arc direction and the major arc label. After the transformation, the local transformations of the nodes are reset to identity matrices, ensuring that subsequent parsing depends only on the coordinate values ​​and no longer on the hierarchical context.

[0102] When parsing the transformed path description information to extract the path command sequence and coordinate parameters, a two-stage lexical and syntactic processing is performed on the SVG path data. First, the absolute and relative forms of M, L, H, V, C, S, Q, T, A, and Z are normalized. Then, abbreviated commands are expanded into equivalent explicit commands and unified into absolute coordinate representations. For curve segments, endpoints and all control points are recorded; for arc segments, endpoints, semi-axis, rotation angle, arc direction, and large arc markers are recorded. When necessary, arcs are converted into equivalent center parameterizations or several arc sub-segments. For multi-segment paths, the temporal order and closure semantics of the command sequence are maintained, and explicit backlink segments are added at closure points for subsequent topology checks. In DXF and other data, the nodes and weights of SPLINEs are converted into curve control point sequences, and the arc segments of LWPOLYLINEs are marked as equivalent arc parameters, ultimately unifying them into the data structure of path command sequences and coordinate parameters. Numerical stabilization is performed throughout the process, including ablation of overlapping adjacent points, adsorption of small jitters within the threshold, and merging of extremely short segments, while preserving the original document precision and rounding strategy for reverse compatibility.

[0103] The output of path data is a sequential set of records. Each record contains the command type, origin and destination coordinates, curve control parameters, and explicit closure flags, along with a source tag reference, a cumulative matrix snapshot, and a unit conversion factor. This ensures that the geometric source is verifiable, the parameter status is traceable, and the computational chain is recoverable. This output directly connects to subsequent segment classification, connection relationship identification, and sharp angle determination stages, eliminating the need to access the original document again or repeat unit and transformation processing, thus decoupling path parsing and geometric calculation at the boundary.

[0104] This embodiment achieves consistency in path data before geometric analysis by structurally locating tag segments, standardizing units and coordinate systems in one go, matrix-based pushdown of document-level transformations, and full normalization of commands and coordinates. This ensures consistency in single units, single coordinate systems, and absolute commands. Consequently, it avoids error propagation caused by differences in coordinate axis directions and superposition of parent transformation chains in subsequent connection relationship identification and angle calculation, reducing accuracy loss and performance overhead caused by repeated parsing and conversion. The unified path command sequence and coordinate parameters provide a definite set of endpoints and control points, enabling vector calculation and length determination of sharp corner neighborhoods to be performed within a stable numerical domain, reducing the probability of false positives and false negatives caused by unit ambiguity, relative command offsets, or omissions in local transformations. Furthermore, the path data after document context stripping maintains consistent performance across different format sources, facilitating continuous connection and consistent output across devices for subsequent corner supplementation, compensation, and toolpath generation.

[0105] In one embodiment, step S30 above includes:

[0106] S301, Traverse the coordinate information of the straight line segments and curve segments, identify the connection point positions of all line segments, and record the coordinates of the connection points;

[0107] S302, using the coordinates of the connection points, analyze the geometric relationship between adjacent line segments and classify them to obtain line segment type combinations;

[0108] S303, based on the line segment type combination, calculate the included angle value of the two line segments at the connection point, dynamically adjust the included angle threshold according to the processing parameters, compare the included angle value with the adjusted included angle threshold, and generate included angle determination conditions.

[0109] S304, Measure the actual length of adjacent line segments to verify the condition that the length is greater than zero;

[0110] S305, Combining the line segment type combination and the actual length value, the curve segment is approximated to calculate the approximate straight line segment parameters;

[0111] S306, combining the angle determination conditions, actual length value, adjusted angle threshold and approximate straight line segment parameters, perform a sharp angle screening operation to obtain a list of qualified sharp angles;

[0112] S307, Perform data anomaly checks on the qualified sharp corner list and implement error recovery processing;

[0113] S308: Based on the qualified sharp corner data after error recovery processing, generate a set of sharp corners and record the sharp corner identifier and sharp corner attribute information.

[0114] In this embodiment, when traversing the coordinate information of straight and curved segments, the input consists of endpoints, control points, and command sequences under a unified coordinate datum, and the output is an ordered set of connection point coordinates. In implementation, an endpoint index is first established for each line element. The common endpoints of adjacent line elements are extracted sequentially according to the path command order and topological closure relationship, recorded as connection point coordinates, and references to forward and backward line elements are attached at each connection point for subsequent geometric calculations. For geometries containing multiple sub-paths or loop closures, connection point coordinates are maintained in groups according to sub-paths, preserving the local order of connection points within the same sub-path. To improve noise resistance, multiple connection points within a distance threshold are merged by snapping, retaining the geometric center as the connection point coordinates, and the endpoint reference table is updated synchronously during merging.

[0115] When analyzing the geometric relationships between adjacent line segments and classifying them into line segment type combinations using the coordinates of connection points, it is necessary to abstract the line elements on both sides into "straight line segments" or "curved line segments." Straight line segments are expressed using vectors, while curved line segments are expressed using tangent vectors at the contact points: quadratic and cubic Béziers use first-order directional vectors as tangent vectors, circular arcs use tangent direction angles as tangent vectors, and splines use parametric derivatives to calculate tangent vectors. Three types of labels are formed at the line segment type combination level: straight-straight line, straight-curved line, and curved-curved line. Each connection point stores the line segment type combination, the directional vectors on both sides, and their normalized results, while retaining the original geometric pointer to support subsequent length and approximation calculations.

[0116] When calculating the angle between two line segments at a connection point based on line segment type combinations, the vector angle formula is used. The angle θ = arccos(clamp(u·v,−1,1)) is calculated for the normalized lateral direction vectors u and v. To stabilize the value, minimum vectors are first eliminated, and Taylor expansion or atan2 form is used in the near-parallel and near-opposite intervals to avoid accuracy loss. In the curve-curve case, if the tangent vector is not unique, the left and right extreme directions are used for bidirectional evaluation, selecting a more conservative angle value and recording its source. Subsequently, the angle threshold is dynamically adjusted based on machining parameters to construct the angle determination condition. The dynamic adjustment uses equipment type, tool radius range, material hardness, and desired sharpness as independent variables to form a combined threshold θ* = θ0 + Δθ, where Δθ can be obtained by weighting local curvature, path scale, and sampling density. The angle determination condition is recorded simultaneously as a Boolean predicate "θ < θ*" and the interval of the upper and lower thresholds for convenient subsequent comprehensive determination.

[0117] Measuring the actual length of adjacent line segments is used to exclude edges with zero or near-zero length. The length of a straight line segment is the distance between its endpoints, while the length of a curve segment is obtained using piecewise adaptive Gaussian quadrature or arc length parameterization approximation, ensuring that the upper bound of the error does not exceed the preset tolerance. The actual length values ​​on both sides are compared with the minimum machinable length threshold to form a verification result and numerical margin for lengths greater than zero. This serves as a necessary condition for subsequent screening and is written into the attribute dictionary of the connection points.

[0118] When approximating curve segments by combining line segment type combinations and actual length values ​​to calculate approximate straight line segment parameters, a linear approximation is introduced to unify the geometric expression for angle calculation and subsequent screening. For curve-straight line and curve-curve connections, a local approximate straight line segment is constructed at the connection point along the tangent vector. The length is taken as the local equivalent length on the curve side or the arc length projection length within a defined range, and the direction is taken as the normalized result of the tangent vector. The approximate straight line segment parameters are output, including the approximate direction, approximate length, and approximate reliability score. For high curvature or noise-sensitive regions, the sampling density is increased to update the approximate reliability score; if it is below a threshold, it is marked as an object requiring conservative processing.

[0119] A list of qualified sharp angles is obtained by combining the angle determination criteria, actual length value, adjusted angle threshold, and approximate straight line segment parameters. The selection logic consists of multiple conditions: satisfying the bilateral constraint that the length is greater than zero; satisfying the angle determination criteria; if a curved side exists, its approximate reliability score is not lower than a set threshold; if a size effect exists, it is still judged as true after scale normalization. During the selection process, the determination path and key intermediate quantities of each record are retained to form an auditable list of qualified sharp angles. The list elements include the coordinates of the connection point, the combination of line segment types, the angle value, the length summary, the approximate straight line segment parameters, and the determination label.

[0120] When performing data anomaly checks and error recovery on the qualified sharp corner list, the goal is to remove duplicate, conflicting, and inconsistent records and repair them as much as possible. Duplicates are determined and merged based on spatial proximity and identical attributes; conflicts are triggered by multiple dissimilar occurrences at the same path location, and items are selected for retention by comparing scores and threshold priorities; inconsistencies include cases where only one side's length is valid or the tangent vector is abnormal, and priority is given to re-estimating the derivative or increasing the curve resolution, and if this fails, it is downgraded to a failure and the reason is recorded. After error recovery is completed, a clean list and recovery report are generated for easy quality tracking.

[0121] A set of sharp angles is generated based on the qualified sharp angle data after error recovery processing, and the sharp angle identifier and attribute information are recorded. The sharp angle set is a read-only sequence or index set, with each element assigned a unique sharp angle identifier. The attribute information includes the coordinates of the connection point, the combination of line segment types, the included angle value and threshold, the actual length values ​​on both sides, the approximate straight line segment parameters, the data quality label, and the source reference. The sharp angle set serves as the direct input for subsequent determination of three-point coordinates, calculation of supplementary angles, and determination of compensation parameters. The judgment conditions and scores in the attribute fields will be used throughout the process to ensure that subsequent processes can inherit the judgment context and quality status.

[0122] This embodiment integrates connection relationship identification, direction quantity construction, angle calculation, length verification, curve approximation, and dynamic thresholding into a continuous data chain. Sharp corner identification transitions from format-independent path data to a structured set of sharp corners. Each intermediate quantity is recorded and participates in subsequent decision-making, reducing repeated parsing and information loss. The combination of connection point coordinates and line segment types ensures that angle and length calculations fall within a clearly defined local neighborhood. Threshold verification of actual length values ​​suppresses misjudgments caused by zero edges and pseudo-intersections. The approximate straight line segment parameters on the curve side incorporate the curvature effect into a unified expression. Dynamic angle thresholding ensures that the judgment remains adaptable to changes in equipment, materials, and dimensions. An error recovery mechanism repairs boundary data while maintaining traceability, improving the completeness and stability of the sharp corner set.

[0123] In one embodiment, step 40 above includes:

[0124] S401, for each sharp corner in the set of sharp corners, locate the sharp corner region by the sharp corner identifier and calculate the coordinates of the geometric center;

[0125] S402, using the geometric center coordinates to identify the three boundary line segments that form the corresponding sharp corners, and extracting the endpoint coordinates of the boundary line segments;

[0126] S403, Based on the endpoint coordinates of the boundary line segments, calculate the vertex coordinates as the intersection point of the boundary line segments;

[0127] S404, Based on the vertex coordinates, distinguish the starting point coordinates and the ending point coordinates according to the geometric direction and connection order of the boundary line segments;

[0128] S405, perform integrity verification on the starting point coordinates, vertex coordinates and ending point coordinates, and record the verification results in the geometric database.

[0129] In this embodiment, the sharp corner set originates from the previous judgment result and is a group of record items with unique sharp corner identifiers. Each item contains at least the coordinates of the connection point, the combination of line segment types, the lengths on both sides, and the included angle data. The sharp corner identifier is used for stable indexing and tracking, which is equivalent to fixing a repeatedly accessible location on the path topology; in the implementation, a combination key of path number and node sequence number can be used, or a hybrid key of spatial hash and timestamp can be used to ensure that the same sharp corner record can still be accurately pointed back after multiple geometric reconstructions. The sharp corner region refers to a small geometric neighborhood around the connection point, and the radius or window length is related to the path scale, which is used to localize the computational load and isolate incoherent line segments. The geometric center coordinates are calculated within this neighborhood, which can be the centroid of the endpoint of the boundary line segment in the neighborhood, or the arc length weighted center of the local spline points, as a spatial reference for subsequent boundary identification. To suppress the influence of outliers, robust screening based on the absolute deviation of the median is performed on the candidate points before center calculation, and the screening parameters are normalized with the path size.

[0130] The three boundary segments are three geometric boundaries surrounding the connection point, typically including an entry edge, an exit edge, and a historical or auxiliary edge. In the common case of two segments forming an angle, one segment before and one after the connection point are taken as the entry and exit edges, respectively, with the third segment serving as a redundancy check or a closing edge. The identification process uses the geometric center as a reference, traversing the line elements within the sharp angle region. Based on the topological adjacency relationship with the sharp angle identifier, two directly adjacent segments are selected first, and their continuity with the connection point is verified. If a curved line element exists, the tangent vector is calculated at the connection point and used as a proxy for the boundary direction; if it is a straight line element, the endpoint difference vector is used directly. The endpoint coordinates of the boundary segments are obtained by reading the endpoint coordinates of the corresponding line element. For curved endpoints, the first derivative value and radius of curvature also need to be cached simultaneously for subsequent intersection and classification.

[0131] Vertex coordinates are the spatial representation of the intersection points of boundary line segments. In scenarios where path data is explicitly connected in the form of topological nodes, vertex coordinates can be directly taken from the coordinates of the connection points. In scenarios with numerical errors or multiple approximations, intersections need to be found through geometric extensions of the two sides. Lines intersect using analytical methods, lines intersect curves using tangents at the curve ends or local Newton iterations, and curves intersect using two-parameter equations combined with two-dimensional Newton's method or recursive bounding box subdivision. To avoid instability caused by ill-conditioned cases, threshold control and a maximum number of iterations are introduced in the intersection point solution, and if convergence fails, it backtracks to a conservative path with connection points as vertex coordinates. After calculation, source markers and residual metrics are recorded for vertices, and large residuals are weighted in the subsequent quality verification stage.

[0132] Geometric direction describes the direction of movement of boundary line segments near vertices. The direction of a straight edge is defined as a unit vector from its non-vertex endpoints to the vertex, while the direction of a curved edge is defined as a unit tangent vector of the curve at the vertex along the increasing direction of the path arc length. Connection order distinguishes the order of two edges. It originates from two sources: one is the drawing order of the original path commands, determining entering and exiting edges by comparing command sequence positions; the other is based on local kinematics, determining the order according to the expected feed direction of the toolpath or the increasing direction of the arc length parameter. Using geometric direction and connection order together allows for consistent origin and destination determination for the same spatial geometry without relying on global routing.

[0133] The starting and ending coordinates are reference points outside the vertices of the entering and exiting edges, respectively, used to define the direction and distance benchmarks on both sides of the vertex. The starting coordinates are selected on the entering edge, either directly from a non-vertex endpoint. If the entering edge is a long curve or contains numerical noise, it is sampled from the vertex along the direction of the entering edge with a fixed arc length or a proportional arc length, ensuring consistency between the distance scale and subsequent offset calculations. The determination of the ending coordinates is symmetrical to that of the starting coordinates, advancing the same arc length along the direction on the exit edge or using a non-vertex endpoint. To ensure scale invariance, the back-off arc length can be functionally related to the overall path size or tool radius, thereby achieving similar geometric stability on graphics of different sizes.

[0134] Integrity verification is used to review the availability and consistency of three-point coordinates. First, geometric constraints are verified, including whether the vertex lies in the common neighborhood of two boundary segments, whether the start and end points are each within the valid parameter range of the segment, and whether the three points are not concurrent, and whether the included angle is non-zero and less than a right angle or less than the dynamic threshold upper limit. Next, numerical constraints are verified, including the lower bound of the distance between the three points, the upper bound of the backslip sampling arc length error, and the upper bound of the intersection residual. Then, topological constraints are verified, including the validity of the command sequence of the start and end points, sub-path consistency, and closure consistency. Successful records are written to the geometry database, while failed records are labeled with the reason and added to the review queue. The geometry database provides a consistent read / write interface for subsequent modules, with fields including at least the corner identifier, geometric center, boundary segment endpoints, vertex coordinates, start coordinates, end coordinates, direction vector, connection order, quality label, and timestamp. To support traceability and playback, database records retain source references and version numbers, and allow both in-situ updates and snapshot-style persistence to disk.

[0135] This embodiment employs a localized analysis and three-point coordinate determination process driven by sharp corner identifiers. Three key points are stably extracted within a unified scale and topological context, reducing geometric uncertainties caused by misintersections and drift. The geometric center serves as a spatial reference, improving the positioning accuracy of boundary identification. The decoupling of intersection point calculation and direction order determination makes the definition of vertex landing points and entry / exit edges more robust. The use of a distance criterion with consistent arc lengths between the start and end points ensures comparable measurements on both sides. Integrity verification unifies geometric, numerical, and topological constraints within a single checklist. Combined with quality tags and versioned storage, this provides a traceable data foundation for subsequent corner supplementation and compensation generation. This achieves low-error propagation from the sharp corner set to the three-point coordinates, reducing the cumulative error in subsequent angle and compensation parameter calculations, and improving the convergence speed and forming quality during the cutting path adjustment stage.

[0136] In one embodiment, step S50 above includes:

[0137] S501, based on the starting point coordinates, vertex coordinates and ending point coordinates, calculate the first direction vector from the starting point to the vertex and the second direction vector from the vertex to the ending point;

[0138] S502, calculate the angle between the sharp corners based on the first direction vector and the second direction vector;

[0139] S503, calculate the supplementary angle value of the sharp angle through geometric transformation based on the included angle value of the sharp angle;

[0140] S504, verify the geometric rationality of the sharp corner supplement value, and output the verified sharp corner supplement.

[0141] In this embodiment, the starting point coordinates, vertex coordinates, and ending point coordinates are derived from the three-point determination results of the previous processing step. These three points are located in the same two-dimensional coordinate system and share a unified dimension. Using these three points as input, two vector representations of the turning directions are first constructed. The first direction vector is the coordinate difference between the vertex and the starting point, and the second direction vector is the coordinate difference between the ending point and the vertex. Both vectors are normalized to eliminate scale effects, and the original modulus is recorded for subsequent consistency checks. If the entering or exiting edge is composed of a curve and more refined local direction information is required, the tangent of the curve can be sampled at the vertex with a small arc length step and compared with the difference direction for consistency. When the angle between the two is lower than a given tolerance, the unit difference direction is retained; otherwise, the unit tangent is used instead. To improve numerical stability, the lower bound of the modulus is checked before normalization. If it is lower than the threshold, a backtracking strategy is initiated, sampling a new reference point on the corresponding edge with a predetermined arc length and recalculating the difference direction.

[0142] The angle between sharp points is determined by the combined dot product and cross product of two unit vectors. The dot product is truncated to avoid inverse cosine overflow caused by floating-point errors, and the result is used in the inverse cosine operation to obtain the unsigned angle. The sign of the cross product is used to distinguish directionality and to assist in selecting the angle branch that is geometrically consistent with the path turning point when there is ambiguity between exterior and interior angles. When the path topology or processing settings provide turning constraints, the angle sign is corrected by the constraint. To ensure consistency with subsequent compensation geometry, the angle is stored in a consistent unit of radians or degrees, while retaining intermediate quantities in the calculation process for easy quality auditing and recalculation. For scenarios with discrete sampling noise, a three-point robust fitting filter can be performed on the two direction vectors before angle calculation to suppress abnormal disturbances by using the median value of multiple direction estimates in the neighborhood.

[0143] The supplementary angle value is obtained through geometric transformation from the included angle. In two-dimensional Euclidean space, with the straight angle as the reference, when using the definition of an interior angle, the supplementary angle equals the straight angle minus the included angle; when using the definition of an exterior angle, the included angle is first mapped to the corresponding interior angle before the same transformation is performed. To handle numerical boundaries, the included angle is normalized before calculation to ensure it falls within an open interval. The supplementary angle is then calculated, and the result is normalized in the same way to eliminate logical anomalies caused by extremely small negative values ​​or out-of-bounds values ​​at the 1e- level. If the processing flow uses a dynamic included angle threshold, the difference and ratio between the supplementary angle and the threshold are recorded simultaneously during supplementary angle generation as additional basis for subsequent parameter tuning and anomaly screening.

[0144] Geometric rationality verification employs a layered check on the supplementary angle output. Geometrically, the supplementary angle must fall within a reasonable range and align with the turning direction formed by the three points. Numerically, the difference between the supplementary angles obtained from two independent paths must not exceed the tolerance, for example, by cross-comparing two paths: dot product-inverse cosine and vector projection-inverse tangent. Topologically, the supplementary angle must be compatible with the connection order of the path, specifically by comparing the consistency between the arc length growth direction on both sides of the vertex and the cross product sign. If any level fails, a rollback process is triggered, including resampling the local direction, expanding the neighborhood for robust direction estimation, or restoring to a conservative upper bound on the angle. Verified data is output as "sharp angle supplementary angle," accompanied by a three-point snapshot for traceability, the magnitudes of the two vectors before and after normalization, the original values ​​of the dot product and cross product, the angle unit used, and the threshold version number. This ensures that subsequent parameter determination and path adjustment can directly consume this result without repeated geometric reconstruction.

[0145] This embodiment defines the direction using a combination of difference vectors and tangent, solves the included angle using a combination of dot product and cross product, and performs cross-checking on both numerical and topological sides. This results in stronger stability and traceability for supplementary angle calculations against sampling noise, scale variations, and ambiguities in exterior and interior angles. The normalization transformation from included angle to supplementary angle and boundary regularization avoid drift under extreme geometric configurations. Verification and backoff mechanisms limit anomalies to local areas and provide repeatable repair paths. Consequently, the output supplementary angle for sharp angles maintains consistency with subsequent parameter tuning in terms of units, range, and directionality, reducing accumulated errors and improving convergence speed and shaping consistency during the cutting path adjustment stage.

[0146] In one embodiment, step S60 above includes:

[0147] S601, Read the tool radius parameter value, and calculate the safety distance offset based on the tool radius parameter value;

[0148] S602, Analyze the angle value of the supplementary angle of the sharp corner, and determine the angle bisector interval parameter;

[0149] S603, determine the compensation point density parameters according to the machining accuracy requirements;

[0150] S604, integrate the safety distance offset, angle bisector interval parameter and compensation point density parameter to generate compensation parameters.

[0151] In this embodiment, the tool radius parameter value comes from the calibration data of the machining equipment or tool library, and the unit is consistent with the length unit of the path coordinates. During reading, unit unification and valid domain verification are first performed. If the input unit is inconsistent with the path unit, linear conversion is performed. If the value is lower than the manufacturer-given lower radius limit or higher than the machine tool's permitted upper limit, boundary clamping is triggered and an alarm is recorded. After successful reading, the calculation of the safety distance offset begins. The safety distance offset is used to leave a safety envelope for the tool tip near sharp corners. The calculation formula uses an additive model: Safety distance offset = Tool radius parameter value + Safety margin. The safety margin is not a constant; it is generated through a multi-factor function, prioritizing material removal state and kinematic constraints. The safety margin can be defined as: Safety margin = k1·v + k2·a + k3·εf, where v is the nominal value of the planned feed rate in the sharp corner neighborhood, a is the maximum corner acceleration, εf is the estimated value of the upper limit of the following error, and k1, k2, and k3 are non-negative coefficients obtained through equipment calibration. To avoid overexpansion, the safety distance offset must satisfy the following conditions: lower bound safety distance offset ≥ tool radius parameter value, and upper bound safety distance offset ≤ rmax, where rmax is limited by workpiece geometric clearance and tooling. If the upper bound constraint is tightly bounded due to local narrowing of the workpiece, this information is carried over to the subsequent point generation stage to reduce tool position jumps by using finer angle division.

[0152] The angle values ​​for supplementary corners must first undergo unit normalization and interval regularization. If the source angle is expressed in radians while the processing flow is primarily in degrees, then a radian-to-degree conversion is performed, and the angle is mapped to an open interval (0°, 180°). For extreme values ​​close to the interval boundary, a threshold δθ is applied to shrink them to avoid zero denominators or overly dense sampling in subsequent segmented calculations. If the supplementary corner angle exceeds the minimum or maximum angle limit allowed by the device, a strategy prompt is given for the upstream angle calculation module to back off.

[0153] The angle bisector interval parameter determines the discrete step angle within the supplementary arc domain. This parameter is determined by constraints imposed by geometric error and equipment capability. First, based on the allowable profile chord height error εc and the safety distance offset, the theoretical upper bound of the step angle Δθmax is derived, with the chord height-circular arc approximation giving Δθmax ≤ 2·arccos(1−εc / safety distance offset). Second, based on the control system's shortest interpolation cycle T, maximum command update rate fmax, and feed rate v, the upper bounds of the time domain Δθtime ≤ v·T / safety distance offset and the upper bound of the frequency domain Δθrate ≤ v / (fmax·safety distance offset) are derived. The minimum of these three values ​​is taken as the candidate step angle, and then the smaller of this value and the expected step angle Δθpref given by the user preference or process package is selected to obtain the angle bisector interval parameter. If the supplementary angle is very small and Δθmax is still small, resulting in an excessive number of segments, the minimum segment length constraint lmin is triggered. Under the premise of ensuring that the local tool position does not overcut, the angle bisector interval parameter is increased to keep the number of segments below the system upper limit Nmax.

[0154] The compensation point density parameter reflects the number of sampling points per unit angle. It is used to further adapt to surface quality and equipment response while maintaining the angle bisector interval parameter to meet geometric error constraints. Machining accuracy requirements can be mapped to the chord height error target εc and the surface roughness target Ra, and then Ra can be converted into the minimum number of points per degree nmin using an empirical model. The compensation point density parameter is set to max(1,ceil(Δθref / Δθtarget)), where Δθref is the reference angle step (e.g., 5°), and Δθtarget comes from the angle bisector interval parameter determined in the previous step. For extremely small compensation angles, the density parameter can be increased to the threshold nboost to make the compensation points more evenly distributed and avoid tool breakage caused by direct connections on both sides. For extremely large compensation angles and when the equipment has spline interpolation capabilities, the density can be reduced to decrease the number of program segments.

[0155] The safety distance offset, angle bisector interval parameter, and compensation point density parameter need to be integrated into a set of compensation parameters that can directly drive subsequent point generation and path adjustment. During integration, a structure containing fields and metadata is constructed: {safety distance offset, angle bisector interval parameter, compensation point density parameter, angle unit identifier, length unit identifier, segment upper limit Nmax, minimum segment length lmin, error target εc, source angle = cusp angle supplement}. Consistency verification is then performed: under the theoretical number of segments N = clamp(ceil(cusp angle supplement / angle bisector interval parameter)·compensation point density parameter, 1, Nmax) jointly determined by the supplement / angle bisector interval parameter / compensation point density parameter, the corresponding maximum chord height error is calculated and compared with εc; if the error exceeds the limit, the angle bisector interval parameter is reduced first, then the compensation point density parameter is increased, until the constraint is met or the system limit is reached; if the error redundancy is too large, the angle bisector interval parameter is increased to compress the number of segments. After integration, the units, constraints, and version information are fixed to ensure that subsequent modules can reliably reproduce the same discretization strategy without repeated derivation.

[0156] This embodiment defines a safety distance offset primarily based on the tool radius parameter, incorporating quantified terms for velocity, acceleration, and following error. This allows for self-adaptive tool tip safety envelope under different materials and motion conditions, reducing the actual load peak at corner points. The angle bisector interval parameter is determined through a triple constraint of chord height error, control update rate, and minimum segment length. This ensures that angle discretization satisfies both geometric accuracy and the time-domain capability of the control system, avoiding jitter caused by overly dense interpolation or toolpath breaklines caused by overly sparse discretization. The compensation point density parameter is mapped to machining accuracy requirements, allowing for adjustments between the number of points and surface quality while maintaining error boundaries, reducing redundant segments and improving execution efficiency. After integration and consistency verification, the three types of parameters form compensation parameters, providing directly usable inputs with units, constraints, and version self-descriptions for subsequent point generation and path adjustment. This reduces cross-module coupling and redundant calculations, ensuring that compensation for sharp corner neighborhoods is both safe and controllable, and maintaining stable and reproducible experimental results across different devices and operating conditions.

[0157] In one embodiment, step S70 above includes:

[0158] S701, analyze the safety distance offset, angle bisector interval parameter and compensation point density parameter in the compensation parameters;

[0159] S702, based on the angle value of the supplementary angle, the angle bisector interval parameter and the compensation point density parameter, calculates the sub-angle sequence after the supplementary angle is bisected;

[0160] S703, Based on the sub-angle sequence, using the vertex coordinates as a reference, offset the safety distance offset along each sub-angle direction, and calculate the compensation point coordinates;

[0161] S704, verify the validity of the compensation point coordinates and integrate them to generate a set of compensation point coordinates.

[0162] In this embodiment, the input is first expanded into three types of numerical items and one type of geometric reference item: safety distance offset, angle bisector interval parameter, compensation point density parameter, and vertex coordinates and corner supplement associated with the current sharp angle. During the parameter parsing phase, the above quantities undergo unit unification, numerical domain verification, and dependency locking. The safety distance offset and path coordinates use the same length unit, and the angle bisector interval parameter and corner supplement use the same angle unit; if there is a unit inconsistency, a one-time linear conversion is performed, and the unit identifier is fixed within the parameter structure. Numerical domain verification requires that the safety distance offset be no less than the upper limit of the tool radius mapping value, the angle bisector interval parameter be located in the open interval (0, sharp corner supplementary angle], and the compensation point density parameter be an integer no less than 1. Dependency locking is used to determine the theoretical number of segments N0 = [sharp corner supplementary angle / angle bisector interval parameter], and based on this, the basic angle step Δθ = sharp corner supplementary angle / N0 is obtained; then, the subdivision number n within each basic step is generated by combining the compensation point density parameter, thus obtaining the final number of samples N = N0·n. If N exceeds the maximum segment threshold of the control system or is lower than the minimum segment threshold required for geometric accuracy, the combination of the angle bisector interval parameter and the compensation point density parameter is finely adjusted to make N fall into the permissible range and maintain the monotonical convergence of Δθ.

[0163] The sub-angle sequence is calculated using uniform or weighted uniform discretization within the closed interval [0, supplementary angle of the apex]. In uniform discretization, the micro-step δθ = Δθ / n is determined by Δθ and the subdivision number n, generating the sequence Θ = {k·δθ|k = 0, 1, ..., N}. To match different tool dynamics and material removal rates, a neighborhood weighting strategy can be introduced, making the ends denser and the middle sparser, or vice versa. The weight function w(φ), after normalization, maps the uniform sequence to a nonlinear sequence φ. i =F -1 (i / N), where F is the cumulative distribution of weights. Regardless of the discretization strategy used, it must be ensured that the sequence is strictly non-decreasing, the endpoints include φ0=0 and φ_N=sharp corners, and the adjacent angle difference Δφ must be calculated. i This is used for subsequent step size and chord height error estimation. For numerical ill-conditioned cases caused by extremely small sharp angles or extremely high density, threshold pruning is applied to reduce Δφ. i Suppress the value to the lower limit εθ to avoid loss of accuracy in subsequent trigonometric functions at angles close to zero.

[0164] Coordinate calculations use the vertex coordinates as the polar coordinate source point, constructing a locally orthogonal coordinate system within the apex plane. The selection of the reference edge remains consistent with the determination of the preceding coordinates: the angular domain is constructed by rotating counterclockwise around the interior angle with the starting direction as the local x-axis; if there is a convention to use the angle bisector as the local x-axis, this can also be achieved through a single fixed rotation. For each sub-angle φ in the sequence Θ...i Calculate the local direction unit vector u(φ) i )=[cosφ i sinφ i This leads to the compensation radius r = safety distance offset, and the corresponding local coordinates p of the compensation point. i ^loc=r·u(φ i The global coordinates are then obtained through a two-step mapping: first, the local coordinates are rotated to the direction of the reference edge (or the angle bisector), with the rotation matrix R = [[cosα, -sinα], [sinα, cosα]], where α is the polar angle of the reference edge in the global coordinate system; then, the local coordinates are translated to the vertex coordinates v to obtain p. i =v+R·p i ^loc. For 3D path data where sharp corners lie in the same plane, first fit a local plane using three points and establish an orthogonal basis within the plane, then calculate p in that plane using the same process. i Then it is mapped back to a three-dimensional coordinate system. After the calculation is completed, in order to ensure topological compatibility with the original path, the sequence index and angle order are kept consistent, and no sorting is performed based on the coordinate values, so as not to destroy the monotonicity of the angular domain.

[0165] Coordinate validity verification follows three types of constraints: geometric, technological, and control. Geometric constraints include: the chord height error of the polyline segment formed by adjacent compensation points and vertices does not exceed a preset threshold; compensation points do not cross the entity boundary or restricted area outside the original path; the minimum distance between compensation points and the original path is not less than the lower limit allowed by the tool radius. Technological constraints include: the tool spacing corresponding to adjacent compensation points is not less than the distance mapped from the machine tool's minimum interpolation resolution to the workpiece coordinate system; the angular acceleration estimation caused by changes in adjacent directions does not exceed the motion controller's capability curve. Control constraints include: at a preset feed rate, the segment frequency mapped by the compensation point sequence does not exceed the upper limit of the instruction update rate, and the shortest execution time of each segment is not less than the control cycle. Verification adopts a two-level screening mechanism: geometric first, then control. If some points violate any constraint, the sub-angle sequence is refined in the adjacent angular domain first, rather than globally, to reduce the number of segments. If refinement still cannot meet the constraints, the safe distance offset is yielded to a suboptimal value, and the adjustment mark of the angular domain is recorded for subsequent path smoothing stages to use higher-order interpolation to replace the multi-point polyline.

[0166] The integration phase generates a set of compensation point coordinates along with metadata. The set is expressed as an ordered container in angular order, containing a global coordinate array, a local angle array, and a verification identifier for each point. To ensure compatibility with subsequent path adjustment and toolpath generation, additional storage is required for anchor point information (vertex index, adjacent edge index) and unit identifiers used for splicing, as well as parameter snapshots for repeatability (safety distance offset, angle bisector interval parameter, compensation point density parameter, sharp corner compensation, reference axis polar angle α). After the set is generated, deduplication and ill-conditioned filtering are performed: points identical within the numerical precision range are merged into a single entry; redundant points with a spacing below the minimum segment length threshold are deleted according to priority rules, prioritizing the retention of corner endpoints and inflection points at arc features. Finally, the set is compressed and calibrated without disrupting the angular order, becoming the sole data source for the path adjustment phase.

[0167] This embodiment generates sub-angle sequences within the corner domain using uniform units, controlled density, and verifiable step sizes. Polar coordinate sampling is constructed using vertex coordinates as the source point and a safe distance offset as the radius. This allows for the rapid acquisition of a set of compensation point coordinates consistent with device capabilities and geometric accuracy in the neighborhood of sharp corners. Parameter analysis ensures consistency in angles and lengths, avoiding deviations caused by mixed coordinate systems and units. Sequence generation and local refinement couple the discrete point distribution with the error target and update rate upper limit, ensuring the number of segments is neither excessive nor insufficient. Coordinate calculation employs explicit rotation and translation decomposition, facilitating stable reuse in 2D and 3D scenes. Multi-constraint verification ensures that compensation points do not cause overcutting, collisions, or control overflow. The resulting set of compensation point coordinates requires no further correction during subsequent path insertion and toolpath conversion, reducing redundant calculations and segment frequency fluctuations, improving trajectory continuity and surface quality at sharp corners, and maintaining reproducible geometric accuracy and execution stability under different devices, materials, and feed strategies.

[0168] In one embodiment, a vector path-based sharp corner compensation device is provided, which corresponds one-to-one with the vector path-based sharp corner compensation method described in the above embodiments. (Refer to...) Figure 3 , Figure 3 This is a schematic diagram of the functional modules of a preferred embodiment of the vector path-based corner compensation device of the present invention. The modules include a vector file parsing module 10, a path data parsing module 20, a corner recognition module 30, a geometric coordinate extraction module 40, a corner compensation calculation module 50, a compensation parameter generation module 60, a compensation point calculation module 70, and a toolpath optimization module 80. Detailed descriptions of each functional module are as follows:

[0169] Vector file parsing module 10 is used to obtain vector graphics files and extract path data from the vector graphics files;

[0170] The path data parsing module 20 is used to parse the path data and extract the coordinate information of straight line segments and curve segments;

[0171] The sharp angle recognition module 30 is used to determine sharp angles based on the coordinate information of the straight line segment and the curve segment, according to the connection relationship of the line segments and based on the condition that the side length is non-zero, and generate a set of sharp angles.

[0172] The geometric coordinate extraction module 40 is used to determine the starting point, vertex, and ending point coordinates for each sharp corner in the set of sharp corners;

[0173] The supplementary angle calculation module 50 is used to calculate the supplementary angle of a sharp angle based on the coordinates of the starting point, vertex, and ending point;

[0174] The compensation parameter generation module 60 is used to determine the compensation parameters based on the tool radius and the sharp corner compensation.

[0175] Compensation point calculation module 70 is used to generate a set of compensation point coordinates based on the compensation parameters;

[0176] The toolpath optimization module 80 is used to adjust the cutting path according to the set of compensation point coordinates and generate optimized toolpath instructions.

[0177] In one embodiment, the vector file parsing module 10 is specifically used for:

[0178] Receive vector graphics file input and obtain file data content including path description information;

[0179] Parse the document structure hierarchy of the file data content to locate the tag segment containing path description information;

[0180] Read the coordinate system definition and unit identifier from the vector graphics file, and generate standardized coordinate data based on the unified coordinate reference of the coordinate system definition and unit identifier;

[0181] Based on the standardized coordinate data, document-level transformations are applied to the path level to obtain the transformed path description information;

[0182] Based on the tag segment, the transformed path description information is parsed to extract path data containing path command sequences and coordinate parameters.

[0183] In one embodiment, the sharp corner recognition module 30 is specifically used for:

[0184] Traverse the coordinate information of the straight line segments and curve segments, identify the positions of the connection points of all line segments, and record the coordinates of the connection points;

[0185] Using the coordinates of the connection points, the geometric relationships between adjacent line segments are analyzed, and line segment type combinations are classified.

[0186] Based on the combination of line segment types, the included angle value of the two line segments at the connection point is calculated, the included angle threshold is dynamically adjusted according to the processing parameters, and the included angle value is compared with the adjusted included angle threshold to generate included angle determination conditions.

[0187] Measure the actual length of adjacent line segments to verify the condition that the length is greater than zero;

[0188] By combining the line segment type combination and the actual length value, the curve segment is approximated, and the approximate straight line segment parameters are calculated.

[0189] Based on the aforementioned angle determination criteria, actual length value, adjusted angle threshold, and approximate straight line segment parameters, a sharp angle screening operation is performed to obtain a list of qualified sharp angles.

[0190] Perform data anomaly checks on the qualified sharp corner list and implement error recovery processing;

[0191] Based on the qualified sharp corner data after error recovery processing, a set of sharp corners is generated, and the sharp corner identifier and sharp corner attribute information are recorded.

[0192] In one embodiment, the geometric coordinate extraction module 40 is specifically used for:

[0193] For each sharp corner in the set of sharp corners, the sharp corner region is located by the sharp corner identifier and the coordinates of the geometric center are calculated;

[0194] The coordinates of the geometric center are used to identify the three boundary line segments that form the corresponding sharp corners, and the coordinates of the endpoints of the boundary line segments are extracted.

[0195] Based on the endpoint coordinates of the boundary line segments, the vertex coordinates are calculated as the intersection points of the boundary line segments;

[0196] Based on the vertex coordinates, the starting point coordinates and the ending point coordinates are distinguished according to the geometric direction and connection order of the boundary line segments;

[0197] The integrity of the starting point coordinates, vertex coordinates, and ending point coordinates is verified, and the verification results are recorded in the geometric database.

[0198] In one embodiment, the supplementary angle calculation module 50 is specifically used for:

[0199] Based on the starting point coordinates, vertex coordinates, and ending point coordinates, calculate the first direction vector from the starting point to the vertex and the second direction vector from the vertex to the ending point;

[0200] Calculate the angle between the sharp corners based on the first and second direction vectors;

[0201] Based on the value of the included angle of the sharp angle, the value of the supplementary angle of the sharp angle is calculated through geometric transformation;

[0202] Verify the geometric rationality of the stated corner supplement value and output the verified corner supplement.

[0203] In one embodiment, the compensation parameter generation module 60 is specifically used for:

[0204] Read the tool radius parameter value and calculate the safety distance offset based on the tool radius parameter value;

[0205] Analyze the angle values ​​of the supplementary angles to determine the angle bisector interval parameters;

[0206] Determine the density parameters of the compensation points based on the required machining accuracy.

[0207] The safety distance offset, angle bisector interval parameter, and compensation point density parameter are integrated to generate compensation parameters.

[0208] In one embodiment, the compensation point calculation module 70 is specifically used for:

[0209] The parameters for compensation include the safety distance offset, the angle bisector interval, and the compensation point density.

[0210] Based on the angle value of the supplementary angle, the angle bisector interval parameter, and the compensation point density parameter, calculate the sub-angle sequence after the supplementary angle is bisected;

[0211] Based on the sub-angle sequence, with the vertex coordinates as the reference, the compensation point coordinates are calculated by offsetting the safe distance along each sub-angle direction by the vertex coordinates.

[0212] Verify the validity of the compensation point coordinates and integrate them to generate a set of compensation point coordinates.

[0213] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 4 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external clients via a network connection. When executed by the processor, the computer program implements the functions or steps of a vector path-based sharp angle compensation method on the server side.

[0214] In one embodiment, a computer device is provided, which may be a client, and its internal structure diagram may be as follows: Figure 5As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface is used to communicate with an external server via a network connection. When executed by the processor, the computer program implements client-side functions or steps of a vector path-based sharp angle compensation method.

[0215] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0216] Obtain a vector graphics file and extract path data from the vector graphics file;

[0217] Parse the path data to extract the coordinate information of straight line segments and curve segments;

[0218] Based on the coordinate information of the straight line segment and the curve segment, the sharp angles are determined according to the connection relationship of the line segments and the condition that the side length is non-zero, and a set of sharp angles is generated.

[0219] For each sharp angle in the set of sharp angles, determine the coordinates of the starting point, vertex, and ending point;

[0220] Calculate the supplementary angle for the sharp angle based on the coordinates of the starting point, vertex, and ending point;

[0221] The compensation parameters are determined based on the tool radius and the sharp corner supplement.

[0222] Generate a set of compensation point coordinates based on the compensation parameters;

[0223] The cutting path is adjusted based on the set of compensation point coordinates to generate optimized toolpath commands.

[0224] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0225] Obtain a vector graphics file and extract path data from the vector graphics file;

[0226] Parse the path data to extract the coordinate information of straight line segments and curve segments;

[0227] Based on the coordinate information of the straight line segment and the curve segment, the sharp angles are determined according to the connection relationship of the line segments and the condition that the side length is non-zero, and a set of sharp angles is generated.

[0228] For each sharp angle in the set of sharp angles, determine the coordinates of the starting point, vertex, and ending point;

[0229] Calculate the supplementary angle for the sharp angle based on the coordinates of the starting point, vertex, and ending point;

[0230] The compensation parameters are determined based on the tool radius and the sharp corner supplement.

[0231] Generate a set of compensation point coordinates based on the compensation parameters;

[0232] The cutting path is adjusted based on the set of compensation point coordinates to generate optimized toolpath commands.

[0233] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.

[0234] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0235] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0236] It should be noted that if any software tools or components not belonging to this company appear in the embodiments of this application, they are merely illustrative examples and do not represent actual use. The embodiments described above are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A sharp corner compensation method based on vector path, characterized in that, Includes the following steps: Obtain a vector graphics file and extract path data from the vector graphics file; Parse the path data to extract the coordinate information of straight line segments and curve segments; Based on the coordinate information of the straight line segment and the curve segment, the sharp angles are determined according to the connection relationship of the line segments and the condition that the side length is non-zero, and a set of sharp angles is generated. For each sharp angle in the set of sharp angles, determine the coordinates of the starting point, vertex, and ending point; Calculate the supplementary angle for the sharp angle based on the coordinates of the starting point, vertex, and ending point; The compensation parameters are determined based on the tool radius and the sharp corner supplement. Generate a set of compensation point coordinates based on the compensation parameters; The cutting path is adjusted based on the set of compensation point coordinates to generate optimized toolpath commands.

2. The sharp corner compensation method based on vector path as described in claim 1, characterized in that, Obtain a vector graphics file and extract path data from the vector graphics file, including: Receive vector graphics file input and obtain file data content including path description information; Parse the document structure hierarchy of the file data content to locate the tag segment containing path description information; Read the coordinate system definition and unit identifier from the vector graphics file, and generate standardized coordinate data based on the unified coordinate reference of the coordinate system definition and unit identifier; Based on the standardized coordinate data, document-level transformations are applied to the path level to obtain the transformed path description information; Based on the tag segment, the transformed path description information is parsed to extract path data containing path command sequences and coordinate parameters.

3. The sharp corner compensation method based on vector path as described in claim 1, characterized in that, Based on the coordinate information of the line segments and curve segments, and according to the connection relationship of the line segments and the condition that the side length is non-zero, a set of sharp angles is generated, including: Traverse the coordinate information of the straight line segments and curve segments, identify the positions of the connection points of all line segments, and record the coordinates of the connection points; Using the coordinates of the connection points, the geometric relationships between adjacent line segments are analyzed, and line segment type combinations are classified. Based on the combination of line segment types, the included angle value of the two line segments at the connection point is calculated, the included angle threshold is dynamically adjusted according to the processing parameters, and the included angle value is compared with the adjusted included angle threshold to generate included angle determination conditions. Measure the actual length of adjacent line segments to verify the condition that the length is greater than zero; By combining the line segment type combination and the actual length value, the curve segment is approximated, and the approximate straight line segment parameters are calculated. Based on the aforementioned angle determination criteria, actual length value, adjusted angle threshold, and approximate straight line segment parameters, a sharp angle screening operation is performed to obtain a list of qualified sharp angles. Perform data anomaly checks on the qualified sharp corner list and implement error recovery processing; Based on the qualified sharp corner data after error recovery processing, a set of sharp corners is generated, and the sharp corner identifier and sharp corner attribute information are recorded.

4. The sharp corner compensation method based on vector path as described in claim 1, characterized in that, For each sharp angle in the set of sharp angles, determine the coordinates of the start point, vertex, and end point, including: For each sharp corner in the set of sharp corners, the sharp corner region is located by the sharp corner identifier and the coordinates of the geometric center are calculated; The coordinates of the geometric center are used to identify the three boundary line segments that form the corresponding sharp corners, and the coordinates of the endpoints of the boundary line segments are extracted. Based on the endpoint coordinates of the boundary line segments, the vertex coordinates are calculated as the intersection points of the boundary line segments; Based on the vertex coordinates, the starting point coordinates and the ending point coordinates are distinguished according to the geometric direction and connection order of the boundary line segments; The integrity of the starting point coordinates, vertex coordinates, and ending point coordinates is verified, and the verification results are recorded in the geometric database.

5. The sharp corner compensation method based on vector path as described in claim 1, characterized in that, Calculating the supplementary angle of the sharp angle based on the coordinates of the starting point, vertex, and ending point includes: Based on the starting point coordinates, vertex coordinates, and ending point coordinates, calculate the first direction vector from the starting point to the vertex and the second direction vector from the vertex to the ending point; Calculate the angle between the sharp corners based on the first and second direction vectors; Based on the value of the included angle of the sharp angle, the value of the supplementary angle of the sharp angle is calculated through geometric transformation; Verify the geometric rationality of the stated corner supplement value and output the verified corner supplement.

6. The sharp corner compensation method based on vector path as described in claim 1, characterized in that, The compensation parameters are determined based on the tool radius and the sharp corner compensation angle, including: Read the tool radius parameter value and calculate the safety distance offset based on the tool radius parameter value; Analyze the angle values ​​of the supplementary angles to determine the angle bisector interval parameters; Determine the density parameters of the compensation points based on the required machining accuracy. The safety distance offset, angle bisector interval parameter, and compensation point density parameter are integrated to generate compensation parameters.

7. The sharp corner compensation method based on vector path as described in claim 1, characterized in that, A set of compensation point coordinates is generated based on the compensation parameters, including: The parameters for compensation include the safety distance offset, the angle bisector interval, and the compensation point density. Based on the angle value of the supplementary angle, the angle bisector interval parameter, and the compensation point density parameter, calculate the sub-angle sequence after the supplementary angle is bisected; Based on the sub-angle sequence, with the vertex coordinates as the reference, the compensation point coordinates are calculated by offsetting the safe distance along each sub-angle direction by the vertex coordinates. Verify the validity of the compensation point coordinates and integrate them to generate a set of compensation point coordinates.

8. A sharp corner compensation device based on vector path, characterized in that, The vector path-based sharp angle compensation device includes: The vector file parsing module is used to obtain vector graphics files and extract path data from the vector graphics files. The path data parsing module is used to parse the path data and extract the coordinate information of straight line segments and curve segments; The sharp angle recognition module is used to determine sharp angles based on the coordinate information of the straight line segment and the curve segment, according to the connection relationship of the line segments and the condition that the side length is non-zero, and generate a set of sharp angles. The geometric coordinate extraction module is used to determine the starting point, vertex, and ending point coordinates for each sharp corner in the set of sharp corners; The supplementary angle calculation module is used to calculate the supplementary angle of a sharp angle based on the coordinates of the starting point, vertex, and ending point. The compensation parameter generation module is used to determine the compensation parameters based on the tool radius and the sharp corner compensation. The compensation point calculation module is used to generate a set of compensation point coordinates based on the compensation parameters; The toolpath optimization module is used to adjust the cutting path based on the set of compensation point coordinates and generate optimized toolpath commands.

9. A computer device, characterized in that, The computer device includes a memory, a processor, and a vector path-based corner compensation program stored in the memory and executable on the processor, wherein the vector path-based corner compensation program, when executed by the processor, implements the steps of the vector path-based corner compensation method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The storage medium stores a vector path-based sharp corner compensation program, which, when executed by a processor, implements the steps of the vector path-based sharp corner compensation method as described in any one of claims 1-7.

Citation Information

Cited By

  • Workpiece burr cleaning method and device and medium

    CN121857545A