A method and system for programming a numerical control machining path based on a three-dimensional model hand drawing

CN122861160BActive Publication Date: 2026-11-03SUZHOU XINJIESHUN HARDWARE ELECTROMECHANICAL
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611376265.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-09-07
Publication Date
2026-11-03
Estimated Expiration
2046-09-07

AI Technical Summary

Technical Problem

现有数控加工软件难以将操作者在三维模型上的直观路线意图直接转换为可执行的刀具中心轨迹,且存在路径连接不安全、抬刀过多和程序一致性问题。

Method used

By hand-drawing the route in the 3D model view, combining geometric constraints and tool data, a hand-drawn guide curve is generated. The tool center trajectory is then generated through 3D mapping, safety verification, and simulation to ensure safe path connection and program consistency.

Benefits of technology

This achieves the correspondence between hand-drawn routes and 3D machining positions, reduces tool lifting and non-cutting paths, improves programming efficiency and the accuracy of path modification, and ensures the correctness and consistency of CNC programs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122861160B_ABST
    Figure CN122861160B_ABST
Patent Text Reader

Abstract

The present application relates to the technical fields of NC machining program control and computer-aided NC programming, and discloses a kind of NC machining path programming method and system based on three-dimensional model hand drawing.Establish or import product three-dimensional model, set up machining reference surface, allow machining area, avoid area and tool and process parameters;Receive the trajectory drawn by operator according to machining sequence, map hand-drawn trajectory points to machining reference surface, organize to form hand-drawn guide curve with source section mark, and generate tool center trajectory in combination with tool geometry;Generate candidate local connection for adjacent trajectories, select local connection or global safety plane transfer after tool and tool shank motion envelope safety check;Simulate to generate NC machining program after passing, and carry out version consistency check.The present application can reduce invalid air cutting and unnecessary tool lifting, improve path executability, modification efficiency and machining appearance consistency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of CNC machining program control and computer-aided CNC programming technology, specifically to a programming method and system that uses a 3D model of the product to be machined as the geometric constraint basis, allows the operator to manually draw the machining path in the model view, converts the hand-drawn path into an executable tool center trajectory, and generates a CNC machining program through connection safety verification, 3D machining simulation, anomaly backtracking, and program version verification. It is particularly suitable for precision hardware parts, frame parts, and appearance parts with multiple windows, holes, narrow edges, connecting bridges, or dispersed machining surfaces. Background Technology

[0002] In CNC machining, toolpath planning directly affects machining efficiency, machining safety, and surface finish. Existing computer-aided manufacturing software typically generates toolpaths automatically based on the selected machining area, tool, and machining strategy. For parts with multiple windows, holes, narrow edges, connecting bridges, or dispersed machining surfaces, the automatically generated toolpath often forms multiple independent machining segments. The transitions between these segments usually involve retracting the tool, raising it to a safe plane, and then moving it again, which can easily result in long non-cutting paths and numerous tool lifting movements.

[0003] In actual programming, programmers can usually determine a reasonable machining sequence and tool path based on the product structure, tooling, and clamping conditions. However, existing programming methods struggle to directly convert the operator's intuitive route intentions on the 3D model into executable tool center trajectories constrained by the product's geometry. Furthermore, adjacent machining paths must consider the safety of the workpiece, fixture, tool, and tool holder movement while minimizing tool lifting and idle cutting. When machining simulations detect interference, overcutting, or insufficient safety clearance, there are also issues with the efficiency of locating problematic paths and making local modifications. In addition, changes to the machining path or related basic data can lead to inconsistencies between the CNC program and the current model, tooling, or process data.

[0004] Therefore, it is necessary to provide a CNC machining path programming method that can express the intention of manual tool movement based on the product's 3D model and convert it into an executable CNC machining path, while taking into account path connection safety, abnormal local modifications, and program consistency. Summary of the Invention

[0005] Technical problems to be solved

[0006] The first problem this invention addresses is the lack of a direct correspondence between hand-drawn routes and actual 3D processing positions. It ensures that the trajectory drawn by the operator on the screen can stably fall on the selected processing reference surface, while promptly eliminating inputs that fall into restricted areas, cross windows, or lack effective 3D intersections to prevent erroneous trajectories from propagating further.

[0007] The second issue to address is the confusion between the concepts of "hand-drawn lines" and "tool center trajectory." Operators can choose to draw the tool center path directly or trace along the product boundary, but the software must convert the hand-drawn intention into a truly executable tool center trajectory according to the corresponding mode, taking into account the tool geometry and machining side.

[0008] Another issue to address is the safety of adjacent paths when reducing empty cuts and tool lifting. Low-level local connections are only permitted when the endpoint distance, directional relationship, and tool and tool holder motion envelope all meet the requirements; otherwise, the system returns to the global safety plane to ensure that efficiency improvements are based on feasibility and collision-free operation.

[0009] Finally, the efficiency of path modification and the consistency of program usage must be addressed. After problems are discovered in 3D machining simulation or first-piece trial cutting, it is necessary to be able to trace back to the original hand-drawn source segment from the abnormal location and recalculate only the truly affected path. After the program is finally fixed, it is also necessary to avoid situations where the product model, tool parameters, or hand-drawn paths have changed, but the old program is still mistakenly used on site.

[0010] Technical solution

[0011] The CNC machining path programming method of this invention uses a three-dimensional model of the product to be machined as its geometric basis. Upon entering the programming process, the machining reference surface corresponding to this process is first determined, and the allowable machining area and avoidance area are divided. Simultaneously, process data such as the effective dimensions of the predetermined tool, the tool and tool holder shape, the tool axis, the machining side, and the machining depth or machining allowance are read in. These data collectively constitute the constraints of the hand-drawn path, ensuring that the subsequently drawn path always corresponds to the specific product, specific process, and specific tool, rather than a free curve detached from the machining object.

[0012] The operator draws lines in the 3D model view according to the desired processing sequence. The system records the hand-drawn trajectory points according to the input sequence, and combines the current observation position, observation direction, and display transformation relationship to back-project the screen position into a spatial picking ray, which is then intersected with the selected processing reference surface. When multiple intersection points exist, the valid intersection point is selected based on the visible order of the current view and the allowed processing area; sampling points with no valid intersection points, approximately parallel to the reference surface, falling outside the allowed processing area, or entering the avoidance area are all treated as invalid points. When consecutive invalid inputs reach the disconnection condition, the hand-drawn trajectory is divided into different source segments at the corresponding positions, without forcibly connecting the valid points on both sides of the window or other restricted areas into one segment.

[0013] Before the effective mapping points form the hand-drawn guide curve, the system retains the original input order and source segment identifiers. For points with excessively dense sampling and minimal directional changes, they can be merged according to a preset sampling interval; positions where the directional change reaches a preset corner threshold are retained as candidate segmentation points. Each segment can continue to use a polyline, or it can be fitted into an arc or spline within a preset geometric deviation tolerance; if the fitting deviation exceeds the limit, control points are added or the segmentation is re-dismantled. Regardless of the expression method used, the processed derived curve still retains the correspondence of the original hand-drawn source segments for subsequent modification and backtracking.

[0014] The hand-drawn guide curve is used to express the operator's intended route; the actual tool center trajectory used for machine tool motion control is generated separately. When the operator has already drawn a line according to the tool center position, the centerline mode is used, assigning the corresponding machining depth to the hand-drawn curve. When tracing along the product boundary or retaining the contour, the boundary compensation mode is used, determining lateral compensation based on the local tangent of the curve, the normal of the machining reference surface, or the tool axis, machining side, and the effective radius of the tool. If discontinuities, overlaps, or self-intersections occur at corners after compensation, they are first shortened, rounded, or partially segmented before forming the tool center trajectory, which is then confirmed by subsequent 3D machining simulation.

[0015] Whether adjacent tool center trajectories are connected at a low level is determined by two levels of conditions: geometric and safety. The system first compares the distance between the end point of the previous segment and the starting point of the next segment, as well as the direction of the two ends. Only when the local connection conditions are met is a candidate connection generated. After the candidate connection is formed, spatial separation judgment is first performed using the candidate connection and the outer envelope of the tool and tool holder motion envelope, and the outer envelope of the obstacle. For intervals where safety cannot be directly confirmed, the specific safety clearance is calculated according to the discrete posture, and the intervals located in the critical clearance zone are further subdivided and re-checked. If the safety clearance requirements are confirmed to be met, a local connection is used; otherwise, a global safety plane transfer is used. After the complete path is formed, the length of the non-cutting path and the number of times the tool is lifted in the global safety plane are counted simultaneously for comparison of different hand-drawn sequences and connection settings.

[0016] A complete machining path requires 3D machining simulation. The simulation checks for interference between the tool and tool holder, the workpiece, and the fixture; it checks whether the tool sweep range enters entities that should not be removed in this process; and it checks the safety clearance of local connections. When an anomaly is detected, the system first determines the tool center trajectory segment where the anomaly occurs, and then uses the traceable relationship saved between the hand-drawn guide curve segment, the tool center trajectory segment, and the CNC program segment to find the corresponding source segment. After the operator only modifies the local hand-drawn segment corresponding to the anomaly, the system groups this segment, its preceding and following connections, and the trajectories directly affected by changes in geometric relationships into an affected set. Only this set is regenerated and simulated; other confirmed trajectories continue to be reused.

[0017] After the 3D machining simulation is successful, post-processing is performed on the complete machining path to generate a CNC machining program according to the instruction format of the target CNC machine tool. When the program is finalized or released, a correspondence is established between the product model version, tool and process parameter version, hand-drawn path version, and post-processing configuration version and the final CNC machining program. Before the program is transferred to the CNC machine tool, these basic data are checked again; if there is any version inconsistency, the old program is not allowed to directly enter the transfer or execution state, but instead prompts for regeneration or reconfirmation, to prevent the original program from being called on-site when the machining conditions have changed.

[0018] The CNC machining path programming system corresponding to the above method includes a display and input device, a memory, and a processor. The display and input device is responsible for displaying the product's 3D model, machining area, and machining path, and receiving hand-drawn and editing operations; the memory stores the model and area constraints, tool process data, original hand-drawn source data, derived tool trajectories, 3D machining simulation results, and CNC machining programs; the processor sequentially completes geometric constraint establishment, hand-drawn 3D mapping, curve processing, tool center trajectory generation, adjacent trajectory connection decision, safety verification, 3D machining simulation, anomaly backtracking, local regeneration, and post-processing.

[0019] The system continuously retains source segment association and data version information at each processing stage. When hand-drawn curves or basic data related to the machining path change, the truly affected trajectory range is first determined based on source segment association and adjacent dependencies, and then this range is regenerated and verified. When tool components, fixtures, or other data that may affect the safety conclusions of multiple segments change, the corresponding recalculation range is expanded. Finally, only after both path verification and version consistency verification pass can the CNC machining program enter a transmittable or executable state.

[0020] Beneficial effects

[0021] 1. Hand-drawn input is not simply recording screen coordinates, but rather landing on the selected processing reference surface and being constrained by the allowed processing area and avoidance area. This can convert the intention of the manual route into data with a clear three-dimensional geometric basis, reducing the risk of the hand-drawn trajectory crossing the window or landing on the wrong surface.

[0022] 2. Hand-drawn guide curves and tool center trajectories are saved in layers. The operator is responsible for expressing "how to move", and the system is responsible for converting the guide curve into an executable trajectory by combining tool size, machining side and machining depth. When the tool is changed, it can be recompensated without having to automatically generate the entire route from scratch.

[0023] 3. Local connections adopt the method of "judging geometric conditions first, verifying motion envelopes, and further subdividing critical intervals". Where it is safe to pass through at a low position, it is not necessary to rise to the highest safety plane every time. Where it crosses windows, holes or fixtures, it will not force a direct connection in order to reduce tool lifting.

[0024] 4. By using the non-cutting path length and the number of tool lifts in the global safety plane, the subjective feeling of "whether there is less empty tooling or less tool lifting" can be transformed into directly comparable data, making it easier for programmers to choose among multiple hand-drawn solutions.

[0025] 5. The hand-drawn source segment, tool center trajectory and CNC program segment are kept in relation. Anomalies in the 3D machining simulation can be directly traced back to the original hand-drawn segment. After modification, only the affected set needs to be recalculated, reducing the time spent on repeatedly generating and checking the entire toolpath.

[0026] 6. When the program is solidified, the model, tooling process, hand-drawn paths, post-processing configuration and final program are version-bound. This can reduce the risk of misusing old programs or programs with mismatched parameters on the production site and help maintain the consistency of routes and appearance when the same product is processed in batches. Attached Figure Description

[0027] Figure 1 This is a schematic diagram of the overall process of the CNC machining path programming method of the present invention.

[0028] Figure 2 This is a schematic diagram of a three-dimensional model of a frame-type product to be processed according to the present invention.

[0029] Figure 3 This is a schematic diagram illustrating the relationship between the hand-drawn trajectory 3D mapping and the tool center trajectory generation in this invention.

[0030] Figure 4 This is a hand-drawn schematic diagram illustrating the organization, segmentation, and fitting of mapping points in this invention.

[0031] Figure 5 This is a schematic diagram illustrating the partial connection and safety verification of the center trajectories of adjacent tools in this invention.

[0032] Figure 6 This is a schematic diagram illustrating the anomaly backtracking and local regeneration in the three-dimensional machining simulation of the present invention.

[0033] Figure 7 This is a schematic diagram illustrating the binding relationship between the model, tool parameters, hand-drawn paths, and program version when the program is released.

[0034] Figure 8 This is a schematic diagram of the CNC machining path programming system of the present invention. Detailed Implementation

[0035] The implementation of this invention will be described in more detail below with reference to the accompanying drawings. The following embodiments mainly use three-axis milling CNC machining as an example to clearly explain how data is acquired, processed, and how to roll back after a problem occurs. This does not mean that this invention can only be used on a certain type of machine tool or cutting tool. In actual use, as long as the programming environment can display a 3D product model, receive hand-drawn input, save cutting tool and process parameters, and output a machining program that matches the target CNC machine tool, the processing relationships of this invention can be followed.

[0036] The "hand-drawn guide curve" mentioned in this invention refers to the three-dimensional curve obtained after the operator directly expresses the machining path in the three-dimensional model view, and after three-dimensional mapping and necessary point sequence arrangement; the "tool center trajectory" refers to the tool reference point motion path calculated based on the hand-drawn guide curve and tool geometry, which is actually used to generate machine tool motion commands; the "allowed machining area" refers to the area where the tool is allowed to make effective cuts or allow local low-level passage in the current process; the "avoidance area" refers to the area where the tool or tool holder is not allowed to cross with a local connection height in the current process; the "global safety plane" refers to the transfer plane that is higher than the highest envelope of obstacles such as workpieces and fixtures in the current transfer process and leaves a safety margin; the "source segment identifier" refers to the unique corresponding information established by the system for a segment of original hand-drawn input, which is used to trace subsequent derived curves, tool center trajectories and program segments back to this original input.

[0037] Example 1: Main Process and Data Connection Relationship

[0038] Reference Appendix Figure 1 The entire process begins with the product's 3D model and the tooling information for the current process. Programmers first select the surfaces and areas to be machined, then begin manually drawing lines. The advantage of this approach is that the hand-drawing is not free drawing detached from the product's geometry, but rather an expression of the path on a pre-defined machining surface. After a hand-drawn action is completed, the system first obtains the 3D guide curve, then generates the tool center trajectory, and only then discusses whether adjacent trajectories can reduce tool lifting; the process sequence cannot be reversed.

[0039] In the master data structure, a programming task can be divided into five layers: product model data, process constraint data, hand-drawn source data, derived trajectory data, and release program data. Product model data provides the geometric basis; process constraint data provides conditions such as machining surfaces, allowable areas, avoidance areas, tooling, and depth; hand-drawn source data retains the operator's original route intention; derived trajectory data stores the executable trajectory after processing, compensation, and connection; and release program data stores the post-processing results and version information. Each layer is derived from the previous layer, but does not overwrite the previous layer, especially the original hand-drawn source segments should not be discarded due to curve fitting or post-processing.

[0040] When a problem is detected at any step, the system backtracks according to data dependencies. For example, if a large number of invalid points are found during the 3D mapping stage, the system returns to the hand-drawn input; if self-intersections or discontinuities occur during the tool compensation stage, the system returns to the corresponding guide curve; if a safety connection fails, the connection is simply changed to a global safety plane transfer, without negating the cutting trajectories on both sides; if overcutting is detected in the 3D machining simulation, the system returns to the original hand-drawn segment based on the source segment identifier associated with the abnormal trajectory segment. In this way, each type of anomaly has a clear backtracking point, avoiding the situation where "the entire toolpath is scrapped and restarted if a step fails."

[0041] Example 2: Establishment of 3D Model, Machining Area, Tools, and Process Parameters

[0042] Reference Appendix Figure 2 Taking a long, rectangular frame product as an example, this product has multiple rectangular windows along its length, connected by bridges, and several holes distributed around the perimeter. If the current process mainly processes the narrow edges and connecting bridges on the upper surface of the frame, the upper surface strip that needs to be actually cut can be selected as the allowable processing area, while the interior of the windows, the holes, the non-processed sidewalls, and the clamping positions of the fixtures can be designated as avoidance areas. This area division is not for the software to automatically replan the toolpath for the entire area, but rather to add a boundary layer to the subsequent manual drawing.

[0043] The machining reference surface should prioritize the product geometry surface directly associated with the current process. For planar milling, the plane on the model can be selected directly; for regions composed of multiple coplanar faces, a common reference surface can be established first, and these faces can be assigned to the same process. If later extended to gradually changing surfaces, the surface can still be selected as the reference surface, and the ray intersection or surface parameter intersection function of the geometric kernel can be used during 3D mapping. Regardless of whether a plane or a surface is used, the system should save the "current hand-drawn drawing to which machining reference surface" to prevent the same screen position from being interpreted as another surface after the viewpoint changes.

[0044] Tool parameters must include at least the tool type, effective diameter or effective radius, and the external dimensions of the tool and tool holder. For connection safety verification, not only the cutting edge diameter should be saved, but also the external dimensions of the tool holder, tool shank, or tool assembly involved in the low-position transfer. Process parameters must include at least the machining side, tool axis, depth of machining or machining allowance, global safety plane, and clearance requirements. In practice, these parameters can be created as process templates and directly called upon when producing the same product repeatedly. However, whenever the tool or clamping changes, a safety verification should be performed again.

[0045] After the region and tool data are completed, the system first performs an input integrity check. If the machining reference plane is not selected, the effective tool radius is less than or equal to zero, the global safety plane is lower than the highest envelope of the modeled fixture, or there are unresolved conflicts between the allowed machining area and the avoidance area, the system will not proceed to the formal hand-drawn trajectory generation, but will instead prompt for correction of the basic parameters. This prevents obvious configuration errors from being discovered until the 3D machining simulation.

[0046] Example 3: Hand-drawn point acquisition and 3D mapping from screen position to machining reference surface

[0047] Reference Appendix Figure 3 After the operator presses the mouse, stylus, or handwriting input device and begins to move, the system records the hand-drawn points according to a predetermined sampling period or predetermined screen displacement interval. The original hand-drawn points are first saved with their screen position and sampling order, and are not directly generated into CNC program points. This allows the handling of input device jitter to be performed uniformly at a later stage.

[0048] To map a screen sampling point onto a 3D machining reference surface, the system constructs a spatial picking ray based on the current view position and view direction. For a given screen point, the corresponding picking ray can be represented as:

[0049] ;

[0050] In the formula, Indicates the relationship between the ray and the parameter The corresponding three-dimensional position; Indicates the starting point of the ray obtained by backprojection of the current view; Indicates the normalized ray direction; This represents the non-negative distance parameter along the ray direction. The function of this formula is to convert a sampling position on the screen into a candidate spatial line in the product coordinate system; subsequently, it is only necessary to determine which processing surface this line intersects with.

[0051] When the current machining reference plane is a plane, the plane can be determined using a point on the plane and the unit normal. To avoid probing point by point, the intersection parameters of the ray and the plane can be obtained using the following formula:

[0052] ;

[0053] In the formula, This represents the parameter value corresponding to the intersection point of the ray and the machining reference surface; The unit normal to the machining reference surface; Represents any known point on the machining reference plane; the symbol "·" represents the dot product of vectors. When the denominator... When the absolute value is less than the parallel judgment tolerance set by the system, it means that the picked ray is approximately parallel to the processing reference surface. Instead of forcibly finding the intersection in this sampling, the point is recorded as an invalid point or the viewing angle is waited for.

[0054] After obtaining the intersection point, a region determination is required. If the intersection point is outside the allowed processing area, or if the intersection point, although falling on the processing reference surface, belongs to a avoidance area such as a window or hole, then the point will not be added to the current hand-drawn guide curve. In the case of multiple intersection points, the system prioritizes the intersection point that is closest to the observation position in the current view and meets the conditions of the processing reference surface and the allowed area; if the first intersection point belongs to an occluded surface or an invalid area, the system continues to search for subsequent intersection points until a valid intersection point is found or it is confirmed that there is no valid intersection point.

[0055] Special handling is required for consecutive invalid points. The system can use the cumulative distance traveled by consecutive invalid points on the screen input trajectory as the hand-drawn input span and set a preset break threshold. If only a few invalid sampling points appear, and the corresponding hand-drawn input span is less than the preset break threshold, the break point prompt can be retained, allowing the operator to decide whether to redraw; when the hand-drawn input span corresponding to consecutive invalid points reaches the preset break threshold, the original hand-drawn trajectory is broken at the corresponding position, without directly connecting the two valid points with a straight line. Figure 2 For frame products, this processing prevents the system from mistakenly interpreting the action of crossing a rectangular window as low-level continuous processing when swiping from one narrow edge to another.

[0056] If a curved reference surface is used, ray intersection can be calculated by calling a 3D geometry kernel to perform intersection point calculations on the curved surface or triangular mesh. In the case of a curved surface, the main logic of this invention does not need to be changed: the picking ray is still generated from a screen point, valid intersection points belonging to the current processing reference surface still need to be selected, and allowable and avoidance zone filtering still needs to be performed. The planar intersection formula only provides a common, directly implementable implementation and does not restrict the reference surface to be only a plane.

[0057] During the hand-drawing process, the operator may rotate, zoom, or pan the 3D view. To prevent the same unfinished hand-drawing trajectory from being mapped to different spatial locations due to sudden view changes, this implementation preferably locks the observation parameters used for back-projection during the entire hand-drawing action from pressing to releasing. If the software allows changing the view during hand-drawing, each sampling point simultaneously saves its view parameters at the sampling moment and uses the corresponding parameters to complete the back-projection. Both methods ensure that the original 3D landing point can be reproduced when the path is reopened later.

[0058] For points falling near the boundary of the machining reference surface, a boundary judgment tolerance can be set solely for numerical stability. Points within the boundary tolerance are not directly "snap-in" into the allowed area; instead, they are first displayed as boundary candidate points. If the operator confirms that the segment was indeed being machined along the boundary, the candidate points are then projected onto the corresponding boundary curve. This prevents the software from arbitrarily pulling hand-drawn points that should cross the window back to the solid edge in order to ensure curve continuity. Boundary snap-in is an auxiliary function explicitly selected by the user and does not change the principle of this invention, which uses actual 3D intersections and region constraints as the basis for validity.

[0059] After each hand-drawn stroke, the system assigns a source segment identifier to the input and records the start point, end point, number of sampling points, the corresponding machining reference surface, and the view parameters used. If a hand-drawn stroke is automatically broken into two segments due to consecutive invalid points, each segment obtains a traceable sub-source segment relationship. This allows for subsequent error backtracking, locating both the original entire input and the specific segment separated by the window or invalid area, making it convenient for on-site programmers to directly find the location that needs to be redrawn.

[0060] Example 4: Hand-drawn point redundancy removal, corner segmentation, and curve fitting

[0061] Reference Appendix Figure 4 After obtaining the hand-drawn mapping points, the system first "cleans up the points" rather than pursuing complex curve algorithms. If the hand-drawn sampling is too dense, the distance between adjacent points will be very small, and directly retaining them will increase the number of subsequent program segments; if slight back-and-forth movement occurs due to local hand tremors, it is unnecessary to treat this tremor as a genuine processing intention. The spatial distance between adjacent mapping points can be calculated using the following formula:

[0062] ;

[0063] In the formula, Indicates the first The spatial distance between each valid mapping point and its previous valid mapping point; Indicates the first One valid mapping point; This indicates the previous valid mapping point; the symbol "∥∥" indicates the vector length. When If the sampling interval is less than the preset interval and the curve direction does not change significantly at this position, the current point and the previous point can be merged, or only one of them can be retained.

[0064] A larger sampling interval is not always better. For areas with rapid curvature changes, many corners, or high requirements for appearance contours, more points should be retained; for long straight edges or narrow strips with minimal changes, the number of points can be appropriately reduced. Therefore, this implementation allows the use of both "distance conditions" and "direction change conditions" together, rather than simply applying a fixed distance.

[0065] To determine whether a directional change that needs to be preserved has occurred near a point, we can first construct a unit tangent based on neighboring points. The unit tangent can be represented as:

[0066] ;

[0067] In the formula, Indicates the first One point in the direction of the next point; Indicates the first There are 100 valid mapping points. After normalization, different sampling intervals will not directly affect the direction comparison. The rotation angle between adjacent directions can be further obtained through dot product.

[0068] ;

[0069] In the formula, Indicates the first The angle of change of direction at each point; Indicates the unit direction of entry into this point. When When the corner threshold is exceeded, the system prioritizes retaining the point as a segmentation point rather than smoothing it out as a jitter. The corner threshold can be set according to the tool diameter, product boundary, and surface requirements; the specific value does not affect the processing principle of this invention.

[0070] After redundancy removal and candidate segmentation, each segment can be retained as a polyline, or fitted as a circular arc or spline. The acceptability of the fit is primarily judged by geometric deviation. For a given fitted curve, the maximum distance from the original valid point to the fitted curve can be expressed as:

[0071] ;

[0072] In the formula, This indicates the maximum fitting deviation of the current segment; Indicates the first segment within this segment. One original valid mapping point; This represents the curve obtained through fitting; This represents the calculation of the shortest distance from a point to a curve. If the deviation is not greater than the preset geometric deviation tolerance, the fitted curve should be retained. If the deviation exceeds the tolerance, control points should be added or the curve should be re-segmented. The curve should not deviate significantly from the operator's original path in order to make it look smoother.

[0073] Point merging, segmentation, and fitting only change the derived curve representation, without modifying the original hand-drawn source data. The system can simultaneously save the "original point sequence" and the "processed guide curve," allowing users to view the differences when needed. If a segment after fitting significantly deviates from the actual processing intention, users can directly switch to a line representation or redraw that segment. This provides the software with the space to reduce redundant points without relying on an uninterpretable automatic smoothing process for manual process judgment.

[0074] Geometric deviation tolerances can be set in conjunction with the machining objective of the current process. For roughing or curves used only for non-cutting guidance, a relatively lenient tolerance can be used to reduce control points; for curves used for finishing boundaries, a stricter tolerance should be used, and original corners should be preserved first. The software interface can overlay the curves before and after adjustment simultaneously. If there is a significant local deviation between the two, the user can cancel the fitting for that segment. The emphasis here is on "reducing redundancy within the allowable error range," rather than changing the machining path to obtain a mathematically smooth curve.

[0075] When adjacent segments are fitted as arcs or splines, the system can also check for significant directional jumps at the connection points. If the directional jump originates from a genuine corner in the original hand-drawn curve, the segment is retained; if it's merely a small angular discontinuity caused by fitting two segments separately, the end control points can be adjusted to smooth the directional transition, provided it doesn't exceed the geometric deviation tolerance. After adjustment, the maximum fitting deviation is recalculated; if it exceeds the tolerance, the adjustment is revoked. Through this closed loop, curve refinement maintains the continuity of machine tool movement without losing the original hand-drawn curve path.

[0076] For very short hand-drawn source segments, if the number of points is insufficient to stably fit an arc or spline, the system will not force a fit, but will maintain it as a straight line or polyline. For very long source segments with many shape variations, they can be automatically divided into multiple sub-segments based on direction changes and fitting errors. All sub-segments remain under the same source segment identifier, and these sub-segments can be discarded all at once when the user redraws the source segment, avoiding the retention of old derived data.

[0077] Example 5: Conversion of hand-drawn guide curve to tool center trajectory

[0078] Reference Appendix Figure 3 The hand-drawn guide curve only indicates the intended path; the actual path sent to the machine tool is still the tool reference point's motion trajectory. To avoid conceptual confusion, this invention stores the two types of data separately and provides centerline mode and boundary compensation mode.

[0079] Centerline mode is suitable when the programmer already knows exactly where the tool center should pass through. For example, when machining a narrow groove or strip slightly wider than the tool, the operator can directly draw it at the desired center position. The system mainly assigns machining depth to the curve and generates a spatial trajectory along the tool axis.

[0080] Boundary compensation mode is suitable for tracing lines along product edges. For planar machining, the lateral compensation unit direction can be determined based on the tool axis and the local tangential direction of the hand-drawn curve.

[0081] ;

[0082] In the formula, Indicates the first hand-drawn curve The direction of the lateral compensation unit at each position; The unit vector representing the predetermined tool axis; This indicates the unit tangential direction of the hand-drawn guide curve at that position; the symbol "×" represents the cross product of vectors. If the tool axis is approximately parallel to the tangential direction, causing the denominator to approach zero, it means that the current geometry is not suitable for determining the lateral direction in this way. The system should use the local normal and tangential of the machining reference surface to redetermine the compensation direction, or require the user to adjust the tool axis settings.

[0083] Once the compensation unit direction is determined, the tool center position can be offset according to the machining side, the effective tool radius, and the machining depth. A commonly used expression for planar machining is:

[0084] ;

[0085] In the formula, Indicates the first The center position of each tool; This represents the three-dimensional point at which the hand-drawn guide curve is located; The symbol indicates the processing side, and is either positive or negative to distinguish the two sides of the curve; Indicates the effective radius of the predetermined cutting tool; Indicates the direction of the lateral compensation unit; This indicates the machining depth applied along the tool axis or the axial offset corresponding to the machining allowance. It still represents the unit vector along the tool axis. This relationship transforms the "line drawn along the boundary" into the "actual position where the tool center will move".

[0086] At corner locations, simply offsetting along adjacent directions may lead to two types of problems: first, a small discontinuity may appear between the two offset lines; second, overlap or even self-intersection may occur after offsetting. The system should first identify these geometric anomalies, and then, according to process requirements, choose to shorten the intersecting portion, connect the two ends with an arc, or re-divide this area into two independent processing segments. Whether overcutting will occur is not determined by the simple two-dimensional offset results, but rather by the subsequent three-dimensional processing simulation.

[0087] When changing tools along the same hand-drawn guide curve, the system can retain the original hand-drawn segment and regenerate the tool center trajectory using only the new tool's effective radius. This preserves the process judgment required for manual determination of the route framework based on the product and tool, while the software accurately incorporates the current tool conditions into the actual tool center trajectory.

[0088] Example 6: Local connection of adjacent trajectories, safety envelope and critical interval re-examination

[0089] Reference Appendix Figure 5 The connection between adjacent trajectory segments is a key aspect of this invention in reducing tool idle time and tool lifting. The system first obtains the endpoint of the previous tool center trajectory, the starting point of the next tool center trajectory, and the movement directions of the two segments near the connection point. The spatial distance between the two endpoints can be expressed as:

[0090] ;

[0091] In the formula, This represents the distance between the endpoints of two adjacent trajectory segments; Indicates the first The endpoint of the trajectory segment; This indicates the starting point of the next trajectory segment. When the endpoint distance exceeds the preset connection distance threshold, the system does not need to attempt low-level local connections; it is more reliable to directly use a global safe plane transfer.

[0092] Even if the endpoints are very close, it doesn't necessarily mean a direct connection is suitable; the directional relationship between the two segments must also be considered. If the unit directions at both ends are the departure direction of the first segment and the arrival direction of the second segment, respectively, then the angle between them can be obtained through a dot product:

[0093] ;

[0094] In the formula, Indicates the angle of change of direction between the ends of adjacent trajectories; Indicates the first The unit departure direction at the end of the segment trajectory; This indicates the unit entry direction at the beginning of the next trajectory segment. When the direction change is too large, a sharp turn is required, or the continuity of the appearance texture is disrupted, low-order connections may not be used even if the distance between the endpoints is small.

[0095] After determining the endpoint distance and orientation conditions, the system generates only "candidate" local connections. Candidate connections can be straight lines, arcs, or splines, with the choice based on the ease of continuous connection between the two endpoints in terms of position and orientation. Candidate connections cannot be directly output to the machine tool because they may pass through windows, holes, sidewalls, or fixtures.

[0096] During safety verification, the cutting portion of the tool, the tool holder, and the geometry of the tool shank that may enter the vicinity of the workpiece at the current height are considered together. The spatial region formed by the movement of the tool assembly along the candidate connection is regarded as the tool motion envelope, and the non-machined structure of the workpiece, the avoidance area, and the fixture are regarded as a set of obstacles. The minimum clearance between the two can be expressed as:

[0097] ;

[0098] In the formula, This represents the minimum safe gap during the candidate local connection process; It represents any point within the motion envelope of the tool or tool holder; Represents any point within the set of obstacles; This represents the envelope set formed by the movement of the tool assembly along the candidate connection; This represents the set of obstacles consisting of obstacle avoidance structures, non-machined workpiece structures, and fixtures. When If the gap is not less than the safety clearance set for the current process, the candidate connection can proceed to the next step; if it is less than the safety clearance, it is directly judged as failing.

[0099] In practice, software does not require performing an infinite number of calculations on two consecutive sets of entities. (See attached reference.) Figure 5 A layered inspection approach can be adopted. The first layer calculates the outer perimeter of candidate connections and tool assemblies. If there is a significant gap between the outer perimeter and the obstacle's outer perimeter, the interval is directly determined to be safe. The second layer only places tool assemblies in multiple orientations for intervals that may approach obstacles and calculates the specific distances. The third layer further subdivides the intervals whose distances fall within the critical gap zone. This avoids using high-precision collision calculations for the entire connection and also avoids missing dangerous locations near hole edges or fixture edges due to coarse sampling.

[0100] The critical gap zone referred to in this implementation refers to the gap range where the coarse inspection result is close to the safety threshold, and a pass or fail determination is not made directly at this time. After detailed re-inspection, if the result stably meets the safety requirements, local connection is allowed; if it is still uncertain, or if the model's triangular mesh is too coarse at this point, causing repeated fluctuations in the distance result, the system adopts a more conservative global safety plane transfer and marks this position as pending manual confirmation. The purpose of this approach is not to pursue the ultimate reduction in tool lifting, but to ensure that the reduction in tool lifting is based on clear safety evidence.

[0101] The candidate local connection can also be selected in different forms based on the geometry of the two ends of the trajectory. When the two ends are close in position and have basically the same direction, a straight line connection is preferred because it is simple to calculate and has the shortest path. When there is a certain angle between the two ends but a smooth transition is still desired, an arc or spline connection can be used. Regardless of the form used, the starting point of the connection curve must be consistent with the ending point of the previous tool center trajectory, and the ending point must be consistent with the starting point of the next tool center trajectory. The endpoints of the actual cutting trajectories on both sides cannot be changed for the sake of smoothing.

[0102] When performing discrete attitude checks on connection curves, the sampling interval can vary depending on local geometric risks. Larger step sizes are used in intervals far from obstacles, while smaller step sizes are used near window edges, holes, sharp corners of fixtures, or large-diameter parts of the tool holder. If two adjacent sampling attitudes are safe, but the tool envelope between them might cross a protruding obstacle, intermediate attitudes are continued to be inserted into that interval until the interval length reaches the set inspection resolution. This reduces missed detections caused by a fixed coarse step size.

[0103] After the safety check is passed, the "passing method" can be recorded for the connection segment, such as quick rejection, fine distance check, or critical interval re-check. If the fixture model, tool assembly shape, or safety clearance parameters change subsequently, the system will prioritize re-checking connection segments that previously relied on fine judgment; intervals that are significantly away from obstacles and whose basic geometry remains unchanged can reuse the outer bounding range results. This record is only used to narrow the recalculation range and does not change the fact that the final safety check result under the current parameters will still be used as the basis for deciding whether to perform a local connection.

[0104] Example 7: Comparison and Evaluation of Non-Cutting Paths and Tool Lifting Times

[0105] After the local connectivity is determined, the system distinguishes between cutting segments and non-cutting segments to save the paths. Summing the lengths of all non-cutting segments yields the total length of the non-cutting paths for the current solution:

[0106] ;

[0107] In the formula, This represents the total length of the non-cutting paths in the complete machining path; Indicates the first The length of each non-cutting transfer segment; the symbol "Σ" indicates the summation over all non-cutting transfer segments. Simultaneously, the system directly counts the number of tool lifts to the global safety plane in the complete path, excluding local low-level connections from the global safety plane tool lift count.

[0108] If you want to provide a simple sorting of multiple hand-drawn sequences in the interface, you can establish a comprehensive comparison index without changing the manual route:

[0109] ;

[0110] In the formula, This represents the path comparison index; the smaller the value, the less non-cutting movement and global safety plane tool lifting under the current weight settings. and These represent the comparison weights for non-cutting length and the number of tool lifts, respectively. and These represent the positive reference length and positive reference number used for normalization, respectively; This indicates the number of times the attack has been raised to the global safety plane along the current complete path. If only the raw statistics are needed, this composite metric can be omitted.

[0111] This indicator is only used for comparison and does not automatically change the path to the shortest route as determined by the system. For example, in two schemes, one has a shorter empty cut but requires changing the cutting direction on the surface, while the other has a slightly longer empty cut but provides a more stable appearance. Programmers can still choose the second scheme based on the actual product. This preserves the on-site process judgments in the manually drawn scheme and does not automatically rewrite the processing sequence determined by the operator due to comparison indicators.

[0112] Example 8: 3D Machining Simulation, False Alarm Control, Anomaly Backtracking, and Local Regeneration

[0113] Reference Appendix Figure 6 Once the complete machining path is formed, the system enters a 3D machining simulation. The simulation objects include at least the workpiece, the cutting tool, and the tool holder; if the fixture has already been modeled, it also includes the fixture. For each tool center trajectory, the system forms a sweep body based on the tool geometry and checks whether the sweep body enters a workpiece entity that should not be removed in the current operation; for non-cutting connections, the system focuses on checking whether the cutting tool and tool holder interfere with the non-machined structure of the workpiece, avoidance areas, or the fixture.

[0114] Anomalies in 3D machining simulations can be categorized into at least four types. The first type is definite interference, where the tool or tool holder geometrically overlaps with an obstacle entity. The second type is definite overcutting, where the tool's cutting sweep range enters an entity that should not be removed in the current process. The third type is insufficient safety clearance, where although there is no geometric overlap, the distance is less than the set safety requirement. The fourth type is anomalies awaiting confirmation, such as low model discretization accuracy or clearances that are just within the critical range, resulting in unstable coarse and fine inspection results. For the fourth type, it is not recommended to directly treat it as an "absolute collision" alarm. Instead, first improve the local discretization accuracy or increase the sampling posture for re-inspection. If this still cannot be eliminated, a conservative approach should be adopted.

[0115] Each hand-drawn guide curve passes the source segment identifier to the derived trajectory when generating the tool center trajectory; during post-processing, one or more program segments are then associated with the corresponding tool center trajectory. When the 3D machining simulation detects an anomaly, the system first determines which trajectory segment the anomaly is located on, then retrieves the corresponding source segment, and simultaneously displays the adjacent trajectories before and after that source segment. In this way, the user sees not just a spatial red dot, but knows "which hand-drawn line, which compensation result, and which connection caused this anomaly."

[0116] Users can move control points, redraw local sections, change the machining side, change the order of the section with preceding and following sections, or directly change local connections to global safe plane transfers for highlighted source segments. After modification, the system establishes an affected set. The most basic affected set includes the tool center trajectory generated by the current source segment and the connections between this segment and its preceding and following adjacent segments; if the current modification changes the boundary compensation intersection point or changes the start and end points of adjacent segments, then adjacent segments with direct geometric dependencies are added to the set until the outer trajectory is no longer affected.

[0117] During recalculation, only the derived trajectories and 3D processing simulation cache corresponding to the affected set are cleared; the remaining trajectories that have already been traversed remain unchanged. This way, even if a dozen or more paths have been drawn on a framework-type product, modifying a local route near a window does not require recalculating all irrelevant narrow edges. After local regeneration, the 3D processing simulation is executed again. If the anomaly disappears, post-processing begins; if the anomaly persists, iteration continues near the same source segment.

[0118] A clear fallback mechanism is also in place for computational anomalies. If curve fitting fails, the system reverts to a polyline representation of that segment; if self-intersections occur in the bias that cannot be automatically eliminated, the user is prompted to re-segment at that location; if the safety verification process cannot be determined due to missing fixture data in the model, "no collision found" is not allowed to replace "safe," but instead, the global safety plane is used by default, and the user is prompted to supplement the fixture model. This anomaly handling ensures that even when the system encounters incomplete data, it will not mistake an unknown state for an executable state.

[0119] To avoid new motion discrepancies arising after correct simulation at the tool position level and subsequent conversion into actual CNC commands, this implementation method preferably performs a program-level verification after the final program is generated. The program-level verification reads the post-processed commands for lines, arcs, rapid traverses, coordinate systems, and tool compensation, reconstructs the machine tool motion trajectory, and compares it with the tool center trajectory before post-processing. If the two are consistent within the allowable conversion error range, the original 3D machining simulation conclusion is retained; if post-processing introduces additional rapid traverses, changes in arc direction, or coordinate offsets, the anomalies are reassociated to the corresponding program segments and the original hand-drawn segments.

[0120] Appearance anomalies during the initial trial cut can also be included in the same backtracking chain. The user selects the actual area on the 3D model where tool marks or texture discontinuities appear. The system finds the relevant program segment based on the program execution location corresponding to that area, and then backtracks to the tool center trajectory and the hand-drawn source segment. If the anomaly mainly originates from local connections, the connection type is adjusted first, or a global safety plane is used; if the anomaly originates from the cutting segment direction, the source hand-drawn curve is modified. In this way, software simulation anomalies and on-site quality anomalies use the same set of source segment relationships, reducing the need for two sets of modification logic.

[0121] Example 9: Post-processing, program release, data integrity, and version consistency

[0122] Reference Appendix Figure 7 After the 3D machining simulation is completed, the system hands over the tool center trajectory and connection trajectory to the post-processing module. Based on the linear interpolation, circular interpolation, and feed / rapid traverse command formats supported by the target CNC machine tool, a CNC machining program is generated. During post-processing, the association between the trajectory segment and the program segment is preserved, facilitating a return to the corresponding hand-drawn source segment from the program location when problems are discovered during the initial trial cut.

[0123] To avoid the problem of "the path has been changed but the program has not been regenerated" in practice, instead of saving a single independent CNC file, a program release package is created during program release. The release package records at least the product model version, machining area version, tool and process parameter version, hand-drawn path version, post-processor configuration version, and the final CNC machining program. The software can use version numbers, timestamps, or checksums for binding; the specific data integrity technology used does not affect the processing relationships of this invention.

[0124] When any of the following changes occur: product model, tool effective radius, machining side, machining depth, hand-drawn sequence, or post-processing configuration, the system marks the final program status as "requires reconfirmation." If the change only involves a single source segment, it can be partially regenerated according to the aforementioned affected set before performing full-path 3D machining simulation and post-processing. If the change involves tool assembly shape, fixture, or global safety plane, all connection safety checks should be re-executed, as these parameters may affect multiple connections that were originally approved.

[0125] Before the CNC machining program is transferred to the machine tool, the system reads the base data version used by the current task and compares it with the release package. Only if the versions match is the program allowed to enter the "released / executable" state; if they do not match, the old program is not directly overwritten, but the user is prompted to choose to regenerate, roll back the base data, or manually confirm. For the production site, this approach is more reliable than simply relying on filenames and facilitates subsequent investigation into which model, tool, and hand-drawn path version were used for a particular machining operation.

[0126] For scenarios requiring multi-person collaboration, hand-drawn source data and published programs can be set to read-only status, creating a new version instead of directly overwriting the original when modifications are made. The system records the modification time, modification location, and the results of re-executing the 3D machining simulation. The main purpose here is to ensure the consistency and traceability of machining data, without requiring the introduction of a complex network security system; existing file permissions, backups, and access controls within the enterprise can be used directly.

[0127] The scope of version failures can be categorized by dependencies. When modifying only a hand-drawn curve, the first to fail are the derived trajectories of that source segment, its connected segments, and the final program. When modifying the effective radius of the tool, all trajectories using that tool and employing boundary compensation mode need to be regenerated. When modifying the tool holder shape or fixture model, the cutting trajectory itself may remain unchanged, but the safety conclusions of all local connections need to be re-verified. When modifying the post-processing configuration, geometric tool positions can continue to be reused, but the final CNC program and program-level simulation must be regenerated. This dependency rule avoids unnecessary full recalculation due to a small change and prevents the omission of truly affected data due to excessive local reuse.

[0128] The release package can also save the confirmation status of the first piece and batch trials. Even if a program has passed the geometric simulation, it can first be in the "awaiting first piece confirmation" state; after the appearance and cycle time of the first piece meet the requirements, it will enter the "awaiting batch confirmation" state; and after the batch results are stable, it will change to "production release". These states do not change the geometric content of the CNC program itself, but the first piece trial cutting, toolpath modification, batch trial production and program release can be placed in the same data management process, and subsequent traceability can confirm which level of verification a program has completed.

[0129] Example 10: System and Device Implementation

[0130] Reference Appendix Figure 8 The system of this invention can run on a regular CNC programming workstation. The display and input device can be a computer monitor with a mouse, or a touch screen, a graphics tablet, or a stylus input device. For hand-drawn lines, the key is not that the input device must be of a certain type, but that the system can continuously acquire the input position and sequence and map these input positions to the current 3D model view.

[0131] The functions executed by the processor can be completed in a single integrated programming software or by multiple software modules working together. The hand-drawn data acquisition and 3D mapping module is responsible for acquiring screen points and finding 3D intersections; the curve processing and toolpath generation module is responsible for point sequence processing, segmentation, fitting, and tool geometry compensation; the connection decision and safety verification module is responsible for deciding whether to perform low-level connections or global safety plane transfers; the 3D machining simulation module is responsible for interference, overcutting, and clearance checks; the anomaly backtracking module uses source segment association to display and regenerate local paths; and the post-processing and version verification module is responsible for program output, data binding, and release status management.

[0132] The memory should store at least three types of data: the first type is basic data that will not be easily discarded due to a local modification, including product models, region constraints, fixture models, and tool libraries; the second type is editable source data, including original hand-drawn points, refined hand-drawn guide curves, source segment identifiers, and machining sequences; the third type is regenerable derived data, including tool center trajectories, connection trajectories, 3D machining simulation results, and CNC programs. By separating these three types of data, only the necessary derived data needs to be cleared during local modifications.

[0133] To improve the smoothness of interaction, on-screen hand-drawn sampling and preliminary display can be performed in real time during input, while time-consuming curve fitting, motion envelope verification, and 3D machining simulation can be performed after a hand-drawn segment ends. If the workstation has a multi-core processor or graphics processing unit, the security checks of multiple candidate connection intervals can also be performed in parallel, but parallel computing is not a necessary condition for implementing this invention.

[0134] When connecting to a CNC machine tool, the version-verified CNC machining program can be sent to the machine tool using the company's existing program transfer methods, or it can be manually copied by the operator. The system does not rely on any specific transmission protocol. More importantly, before sending, it should be confirmed that the cutting tools and clamping conditions used by the current machine tool are consistent with the release package; if the tool components or fixtures have changed, the connection safety check and 3D machining simulation should be redone at the programming end first.

[0135] Example 11: The actual programming process of framework-based products

[0136] Please refer to the attached document again. Figure 2 Taking the illustrated long frame product as an example, the current process requires finishing the narrow edges, the connecting bridges between multiple windows, and part of the upper surface area. Traditionally, when automatically selecting and generating toolpaths for the entire area, the software might break down each narrow edge into many independent segments, then frequently raise them to a uniform safe height between these segments. Using this invention, the programmer first determines the machining sequence based on the tool diameter and product structure, and then hand-draws each segment along the desired machining path.

[0137] For example, if the first narrow edge and the adjacent connecting bridge are continuous on the solid surface, and there are no holes or fixtures obstructing the area, the programmer can draw two consecutive paths. The system maps the two paths onto the upper surface, processes them to generate the corresponding tool center trajectory, and then checks the candidate local connections between the two segments. If the tool and tool holder motion envelope maintains sufficient clearance with the connecting bridge and surrounding structure, the low-level connection is retained, and this point does not need to be raised to the global safety plane.

[0138] When the next processing area is located on the other side of the rectangular window, even if the hand-drawn sequence immediately follows the previous segment, the candidate local connection will cross the window. After the window is set as an avoidance area, the safety check will prevent this candidate connection from passing, and the system will automatically adopt a safe transfer method of retracting the tool, raising it to the global safety plane, crossing the window, and then lowering the tool again. Therefore, this invention does not simply pursue "connecting all segments", but rather reduces the tool lifting that can be safely reduced, while those that cannot be safely reduced are still handled in the conventional way.

[0139] After the complete 3D machining simulation, if overcutting of the compensation trajectory is detected near a certain hole, the system highlights the original hand-drawn curve based on the source segment identifier of the abnormal trajectory segment. The programmer only needs to adjust a small section of the curve near the hole outward, or change this section into an independent machining segment. The system regenerates the source segment and the connections on both sides, without recalculating the toolpaths already traversed around the other three windows.

[0140] After the 3D machining simulation is successful, a trial cut of the first piece is performed. During this first-piece stage, the actual machining time, non-cutting movements, and global safety plane tool lifting are recorded. Special attention is paid to checking the continuity of the surface texture, the presence of obvious tool marks, or localized differences caused by frequent entry and exit points. If an area is found to have an unsatisfactory appearance, the corresponding actual program segment can be returned to the tool center trajectory, and then the hand-drawn source segment can be used to adjust the path and connection method.

[0141] After the first piece meets the requirements, batch trial production begins, continuously recording machining cycle time and appearance inspection results. Once the batch trial production is stable, the final product model version, tooling and process parameters, hand-drawn paths, connection settings, post-processing configuration, and CNC machining program are solidified as a release version. Subsequent re-production of the same product will directly use this version; if the tooling, fixture, or product version changes, the affected paths will be reconfirmed according to the consistency verification rules of this invention.

[0142] As can be seen from the above process, this invention does not replace the programmer's process judgment with fully automatic path planning, but retains the method of manually determining the machining route, and then converts the route into a stable and reusable CNC program through three-dimensional mapping, tool geometry transformation, safety connection, exception backtracking and version management.

[0143] In practical comparisons, the original program obtained from automatic area programming can be used as a benchmark. Only its total machining time, non-cutting paths, and the number of times the tool is lifted in the global safety plane should be recorded, along with the corresponding data from the manual alignment scheme. If the manual alignment scheme reduces ineffective movements but new tool marks appear on the surface of the first piece, it should not be fixed simply because the time is shorter; the relevant source segments should continue to be adjusted. In other words, efficiency indicators and appearance results must simultaneously meet the company's process requirements; a single path length cannot replace quality judgment.

[0144] During the batch trial phase, the focus is on repeatability. If, when processing the same release version continuously, the program execution path is stable, the processing time fluctuation is within the acceptable range for the enterprise, and the appearance inspection shows no new path differences due to different shifts or repeated program calls, then that release version can be used as the standard document. Subsequent similar products can refer to the already verified hand-drawn route organization method, but it is still necessary to re-import the corresponding product model, reset the processing area, and perform safety verification according to the actual tools. The spatial trajectory of the old product cannot be directly applied to the new product.

[0145] Example 12: Handling Other Anomalies and Boundary Conditions

[0146] In actual programming, some boundary situations may be encountered that are not suitable for direct automatic handling. This embodiment provides corresponding handling principles:

[0147] First, when a hand-drawn line crosses back and forth near the boundary of the processing reference surface, the system can mark points falling outside the allowed area as invalid, while retaining the nearest valid point near the boundary, and not allowing interpolation to automatically connect two valid points separated by a window.

[0148] Second, when a hand-drawn line returns to form a self-intersection, the system does not default to which branch should be retained, but instead uses the self-intersection position as a candidate segmentation point and prompts the operator for confirmation.

[0149] Third, if the offset curves are too close after tool compensation, resulting in local self-intersection, you can first cut off the small loops and then check whether the cut-off trajectory is still within the allowable machining area; if you cannot reliably determine this, return to the original hand-drawn segment and redraw it.

[0150] Fourth, while local connections may be geometrically safe, changes in orientation can lead to noticeable tool marks on the surface. In such cases, programmers can manually set the connection to a globally safe plane transfer or add a transition curve. The system should retain this manual decision and should not automatically override it simply because the path length increases.

[0151] Fifth, when the workpiece or fixture model on which the 3D machining simulation depends is incomplete, the unmodeled area cannot be simply assumed to be "obstacle-free". The system can mark the area with missing model as an unknown area, and use the global safety plane by default when local connections pass through the unknown area, and then re-verify after the fixture or environment model is supplemented.

[0152] Sixth, after the post-processor version is changed, even if the tool center trajectory is exactly the same, the final CNC program should be regenerated and program-level simulation should be performed, because different post-processor configurations may affect the output of arcs, coordinate systems, rapid traverses or safety actions.

[0153] All the above anomaly handling follows the same principle: reuse methods that are safe and correct whenever possible; for uncertain cases, do not treat the "unknown" as "pass," but instead revert to a safer handling method or require operator confirmation. This avoids adding unnecessary automated algorithms and ensures that the system still has clear and actionable behaviors even when on-site data is not entirely ideal.

[0154] The above embodiments are for illustrative purposes only and not for limiting the present invention. Those skilled in the art, without altering the technical concept of the present invention—"constraining hand-drawn routes with 3D models, converting hand-drawn guide curves into tool center trajectories, conditionally and safely connecting adjacent trajectories, completing local backtracking of abnormalities in 3D machining simulation through source segment association, and ultimately forming a verifiable CNC program"—can all make equivalent substitutions in the input device form, curve expression form, specific tool type, connection curve type, collision detection implementation method, and program transmission method as specific embodiments of the present invention.

Claims

1. A CNC machining path programming method based on hand-drawn 3D models, characterized in that, Includes the following steps: S1. Create or import a 3D model of the product to be processed, select the processing reference surface of the current process, and set the allowed processing area, avoidance area, and geometric parameters and processing parameters of the predetermined tool. S2. In the interactive interface displaying the three-dimensional model, the operator receives the trajectory drawn manually according to the predetermined processing order, collects the hand-drawn trajectory points according to the input order, maps the hand-drawn trajectory points to the processing reference surface, invalidates the hand-drawn trajectory points that fall outside the allowed processing area, fall into the avoidance area, or cannot obtain an effective mapping position, and forms a hand-drawn guide curve with source segment identification from the effective mapping points. S3. While retaining the source segment identifier, perform point sequence sorting, segmentation or curve fitting on the hand-drawn guide curve, and generate the tool center trajectory segment based on the hand-drawn guide curve, the geometric parameters of the predetermined tool, the machining side, and the machining depth or machining allowance. S4. For adjacent tool center trajectory segments in the same process and using the same tool, determine whether the local connection geometry conditions are met based on the distance relationship and end direction relationship between the end point of the previous tool center trajectory segment and the starting point of the next tool center trajectory segment. If the local connection geometry conditions are met, generate a candidate local connection trajectory that does not rise to the global safety plane. Based on the motion envelope and avoidance area formed by the movement of the tool and tool holder along the candidate local connection trajectory, the safety clearance between the non-machined structure of the workpiece and the fixture, determine whether to use the candidate local connection trajectory or switch to the global safety plane transfer trajectory. S5. Perform a three-dimensional machining simulation on the complete machining path containing the tool center trajectory segment and its connecting trajectories. When interference, overcutting or insufficient safety clearance is detected, locate the corresponding hand-drawn guide curve segment according to the source segment identifier associated with the abnormal trajectory segment, receive the local modification operation for the hand-drawn guide curve segment, and regenerate the affected tool center trajectory segment and its adjacent connecting trajectories before performing the three-dimensional machining simulation again. S6. After the three-dimensional machining simulation is passed, the complete machining path is post-processed to generate a CNC machining program for controlling the CNC machine tool to perform machining.

2. The CNC machining path programming method based on hand-drawn 3D model as described in claim 1, characterized in that, Mapping the hand-drawn trajectory points to the processing reference surface includes: obtaining the observation position, observation direction, and display transformation relationship of the current 3D model view; back-projecting the screen position of each hand-drawn trajectory point into a spatial picking ray; and calculating the intersection point of the spatial picking ray with the selected processing reference surface. When multiple intersection points exist, the valid intersection points are determined according to the visible order of the current view and in combination with the allowed processing area. When the spatial picking ray has no valid intersection point with the processing reference surface, is approximately parallel to the processing reference surface, or the obtained intersection point is outside the allowed processing area or within the avoidance area, the corresponding hand-drawn trajectory point is marked as an invalid point. When the hand-drawn input span corresponding to consecutive invalid points reaches a preset break threshold, the current hand-drawn trajectory is broken into different source segments at the corresponding position.

3. The CNC machining path programming method based on hand-drawn 3D model according to claim 1, characterized in that, The point sorting, segmentation, or curve fitting of the hand-drawn guide curve includes: saving valid mapping points according to the hand-drawn time sequence; merging mapping points with adjacent spacing less than a preset sampling interval and directional change angle less than a preset corner threshold; determining the position where the directional change angle reaches the preset corner threshold as the candidate segment position; representing each segment as a polyline segment, arc segment, or spline curve segment within a preset geometric deviation tolerance; adding control points or re-segmenting when the fitting deviation exceeds the preset geometric deviation tolerance; the derived curves formed by point merging, segmentation, and fitting all retain the source segment identifier corresponding to the original hand-drawn trajectory.

4. The CNC machining path programming method based on hand-drawn 3D model according to claim 1, characterized in that, When generating the tool center trajectory segment based on the hand-drawn guide curve, at least a centerline mode and a boundary compensation mode are provided. In the centerline mode, the hand-drawn guide curve is used as the projection of the tool center onto the machining reference surface and a machining depth is assigned along the predetermined tool axis. In the boundary compensation mode, the lateral compensation direction and compensation amount are determined based on the local tangent of the hand-drawn guide curve and the normal of the machining reference surface or the predetermined tool axis, combined with the selected machining side and the effective radius of the predetermined tool. At the corners, the discontinuities, overlaps, or self-intersections that appear after compensation are shortened, rounded, or re-segmented, and then a machining depth or machining allowance is assigned to form the tool center trajectory segment.

5. The CNC machining path programming method based on hand-drawn 3D model according to claim 1, characterized in that, When performing safety verification on the candidate local connection trajectory, the first layer of spatial separation judgment is made by using the candidate local connection trajectory and the outer envelope of the tool and tool holder motion envelope, the avoidance area, the non-machined structure of the workpiece and the outer envelope of the fixture. For candidate intervals where safety cannot be confirmed by the first-level spatial separation judgment, safety clearances are calculated according to multiple discrete postures; candidate intervals with safety clearances within the preset critical clearance zone are further subdivided and re-examined; when the re-examination results meet the preset safety clearance requirements, candidate local connection trajectories are used; when the re-examination does not meet the requirements or safety cannot be determined, global safety plane transfer trajectories are used; and the length of non-cutting paths and the number of times the tool is lifted in the global safety plane in the complete machining path are statistically analyzed, so that the operator can compare different hand-drawn sequences or connection settings.

6. The CNC machining path programming method based on hand-drawn 3D model according to claim 1, characterized in that, A traceable relationship is maintained between the hand-drawn guide curve segment, the tool center trajectory segment generated from it, and the CNC program segment formed by post-processing. When the abnormal position is output in the 3D machining simulation, the tool center trajectory segment where the abnormality is located and the abnormality type are first determined. Then, the corresponding source segment identifier is obtained through the traceable relationship and the corresponding hand-drawn guide curve segment is highlighted in the interactive interface. After the local modification is completed, the tool center trajectory segment corresponding to the source segment, its adjacent connecting trajectories before and after it, and the trajectory segments affected by the change of geometric boundary constitute the affected set. Only the affected set is recalculated and simulated. The trajectory segments that do not enter the affected set are directly reused.

7. The CNC machining path programming method based on hand-drawn 3D model according to claim 1, characterized in that, When a CNC machining program is solidified or released, a program release package is created. The program release package is associated with at least the product model version, tool and process parameter version, hand-drawn path version, post-processing configuration version, and CNC machining program. Before the CNC machining program is transmitted to the CNC machine tool, the consistency of the currently used product model, tool and process parameters, hand-drawn path, and post-processing configuration with the corresponding versions in the program release package is checked. If there is an inconsistency, the CNC machining program is prevented from directly entering the transmission or execution state, and a prompt is made to regenerate or reconfirm the CNC machining program.

8. A CNC machining path programming system based on hand-drawn 3D models, characterized in that, Includes display and input devices, memory, and processor; The display and input device is used to display the three-dimensional model of the product to be processed, the processing area and the processing path, and to receive the operator's hand-drawn trajectory and curve editing operations; The memory is used to store the product's 3D model, machining reference surface, allowable machining area, avoidance area, tool and process parameters, hand-drawn guide curve, source segment marker, tool center trajectory, 3D machining simulation results, and CNC machining program; The processor is configured to: establish geometric constraints for the current process based on the product's 3D model and the tool and process parameters; map the hand-drawn trajectory points of the hand-drawn trajectory to the machining reference surface and form a hand-drawn guide curve with source segment identification; organize the hand-drawn guide curve and generate the tool center trajectory according to the tool's geometric relationship; and perform local connection judgment and tool and tool holder motion envelope safety verification on adjacent tool center trajectories. Perform 3D machining simulation on the complete machining path, and backtrack and locally regenerate detected anomalies based on the source segment identifier; and perform post-processing and output CNC machining program after the 3D machining simulation is passed.

9. The CNC machining path programming system based on hand-drawn 3D model as described in claim 8, characterized in that, The processor is also configured to maintain a traceable association between the hand-drawn guide curve segment, the tool center trajectory segment, and the CNC program segment, and to bind the product model version, tool and process parameter version, hand-drawn path version, and post-processing configuration version to the CNC machining program when the program is released; when the hand-drawn guide curve segment or basic data related to the machining path changes, the affected set to be regenerated is determined according to the traceable association and the adjacent dependency relationship between the trajectory segments, only the affected set is regenerated and verified, and the CNC machining program is allowed to enter the transmission or execution state after the version consistency verification is passed.

Citation Information

Patent Citations

  • Drawing processing method and system for die-free turning, medium and product

    CN121685694A

  • Three-axis numerical control milling machine tool path generation method and system based on elevation fitting

    CN121857518A