A method for generating toolpaths
Patent Information
- Application Number
- CN202311310807.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-10
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2043-10-10
AI Technical Summary
[0002]刀具路径是使由主轴旋转的刀具相对于被加工物移动的路径,相关技术中,一般使用计算机辅助制造方法(Computer aided manufacturing,CAM)来求解刀具路径,传统方法,如等参数法和等残高法,在生成均匀有效的刀具路径方面表现不佳
[0024]One embodiment of this specification achieves at least the following beneficial effects: This technical solution uses arbitrary parametric surfaces (i.e., common representations in CAD models) as input. Under the condition of satisfying machining residual height error constraints, it can generate high-quality one-stroke toolpaths for any model with holes or obstacles, solving the problem of difficult path generation caused by non-zero genus models and tool positioning problems caused by multiple breakpoints, thereby improving machining efficiency and accuracy. Simultaneously, our path is unaffected by the representation form, can adapt to boundary shapes, and accurately represent them. Our designed weight allocation based on greedy algorithms can reduce inflection points in the machining path, and one-stroke connections eliminate breakpoints, effectively improving the efficiency and accuracy of the toolpath. The final generated one-stroke toolpath can be input into a CNC system for machining. Furthermore, the toolpath generation method provided by this invention can generate uniform toolpaths with good smoothness, avoiding numerous breakpoints at boundaries. It can generate shorter tool trajectories than the isoparametric method and has better path quality than the equal residual height method, creating uniform and effective curved meshes.
Smart Images

Figure CN117311260B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer-aided design technology, and in particular to a method for generating toolpaths. Background Technology
[0002] Toolpaths are the paths that allow a tool rotating on a spindle to move relative to the workpiece. In related technologies, computer-aided manufacturing (CAM) methods are generally used to solve toolpaths. Traditional methods, such as the isoparametric method and the equal residual height method, perform poorly in generating uniform and efficient toolpaths. The isoparametric method generates dense toolpaths containing unnecessary points, resulting in relatively long paths. The equal residual height method typically produces non-uniform toolpaths with poor smoothness and numerous breakpoints at boundaries. Therefore, it is necessary to provide a more effective method for generating toolpaths. Summary of the Invention
[0003] This specification provides a method for generating toolpaths, which offers a method for generating toolpaths that is more effective than existing technologies.
[0004] To solve the above-mentioned technical problems, the embodiments in this specification are implemented as follows:
[0005] Given a surface S(u,v) with parameters, where u,v∈[0,1], firstly, calculate the constant residual height tool path L for the surface S(u,v). v Sample K points P in curve S(u,0) 0,i Calculate the i-th point P within the given upper limit of residual height h. 0,i Maximum step size Δv along the parameter domain v direction 0,i And the i-th point P 0,i Move forward Δv 0,i The new point obtained is defined as P. 1,i Repeat the above steps until all K points reach the boundary S(u,1), and all points P in the k-th step... k,i Constructing the k-th toolpath Generate toolpath L in another direction u Since u i point Points If the number of toolpath curves is less than the total number of curves n, n points need to be resampled while keeping the residual height of the sampled points unchanged.
[0006] Any path L u and L v Select a pair of curves, i.e., curves and curve The curve and the curve point(u i,j ,v i,j The above curves intersect, and are all represented by discrete points. Using bicubic interpolation, they are transformed into a continuous form, so that the points (u...)... i,j ,v i,j () is a solution to a cubic polynomial, and all the intersection points obtained form a parametric grid;
[0007] Before constructing the cell cavity, a bias operation is first performed on the obstacle boundary: an extension d is made outward from the obstacle boundary o.
[0008]
[0009] Where r is the tool radius, R is the surface curvature radius, and h is the upper limit of the residual height;
[0010] Points within the processing area are uniformly marked as 0, while points outside the processing area are assigned non-zero values. In the specific implementation, each obstacle is assigned a unique number starting from the natural number 1, and this index is used as the assignment value for its internal points.
[0011] let This represents the value assignment over the generated parameter domain, where M and N represent the number of grid cells in each parameter direction, respectively. Furthermore, let... Let D represent the nth element, where It is a multi-indexed system. For each point, a value is assigned. If grid n is a first-type parameter point, i.e., located inside the surface of the processed area, then d... n =0, if the mesh n is a parameter point of type second and third, i.e., located outside the surface of the processing area, then d n >0, therefore, as long as a change in the zero value is detected, the boundaries of obstacles and surfaces can be found. The MarchingCubes method will traverse all grid points and perform the following steps:
[0012] Let d n0 ,d n1 ,d n2 ,d n3 ∈D represents the values of four grid points, where n0=(2i,2j), n1=(2i,2j+1), n2=(2i+1,2j+1), n3=(2i+1,2j), i=0,1,…,M-1, j=0,1,…,N-1, then the cell cavity c l It can be constructed from these 4 grid points, where l = (i,j), i = 0, 1, ..., M, j = 0, 1, ..., N, and in this way, M × N cavities can be obtained;
[0013] The MarchingCubes method is used to generate cavities with the correct shape in each cavity, and the topology T of the cavity is based on the values d of its four corner points. n To determine this, T can be represented as a binary array T∈{0,1} 4 Each element represents a corner point, if d n =0, then T i =0, if d n >0, then T i =1;
[0014] Let the symbol e represent the edge of the cell cavity, and the newly generated vertex along the edge e. It and obstacles Intersection is defined as
[0015] After following the above steps, only a network of unconnected cellular spaces was obtained. Therefore, it is still necessary to establish weighted connections between vertices. With these generated connections, the cell cavity and its connections can be viewed as a graph, allowing the application of the Minimum Spanning Tree (MST) method to construct toolpaths with a single start and end point, specifically including:
[0016] First, the connection relationships between vertices are defined. Due to the regularity of the design representation, connections can be generated in two directions: horizontal and vertical. Consider any two horizontally adjacent cavities, each with an edge directly adjacent to the other. Two cavities are defined as adjacent if and only if their adjacent edges have at least one grid point. Then, using these two methods, a cavity graph with connection relationships is constructed.
[0017] In the definition diagram Before determining the weight of edge e, introduce the maximum horizontal connection count. and vertical maximum connection count The concept of , where M and N represent the number of cavities in each dimension, respectively. It is a multi-index; specifically, if cavity A is connected to cavity B through a series of horizontally connected cavities, it indicates the existence of a horizontal path. The length of the path between A and B Equal to the number of horizontally connected cavities from A to B, Defined as the length of the longest horizontal path through cell cavity n.
[0018]
[0019] in, Let n represent the set of horizontal paths through cell cavity n. It is easy to deduce that if two cells n1 and n2 are connected, then... Similarly, we can obtain Then, the diagram The weight of an edge is defined as:
[0020]
[0021] For an edge e with endpoints n1 and n2, since n1 and n2 are connected together, we have or Starting with the cellular diagram To construct the MST, this work employs Kruskal's greedy method, allowing... Indicates in The set of edges that form the minimum spanning tree. Representation diagram Sort the queue of all possible edges according to their weights, and repeat the following process until... Empty: From Delete the first element if it is not in the graph. If it forms a cycle with other edges, add it to the cycle. middle;
[0022] Finally, based on the generated minimum spanning tree To construct a toolpath with a single starting point, in MST, if two cavities are connected, the adjacent cavity edges a and b will be deleted, and then new edges c and d will be added to connect them. Finally, return to the parametric point mesh G, connect the vertices according to the cavity links, and construct a path with a single starting point on the parametric domain.
[0023] Before using the MarchingCubes method to generate the cavity, the boundary of the obstacle is biased, and the toolpath generated by the extended obstacle boundary is defined as P. off Then, P off Boundary with the original obstacle Combining these elements, an adaptive boundary toolpath is obtained. To simplify the connection port selection calculation as much as possible while satisfying the residual height constraint, selection is only made among the newly generated mesh points. When merging the toolpath and obstacle boundary, adjacent generated points with the maximum spacing along the path are selected as the entry and exit points.
[0024] One embodiment of this specification achieves at least the following beneficial effects: This technical solution uses arbitrary parametric surfaces (i.e., common representations in CAD models) as input. Under the condition of satisfying machining residual height error constraints, it can generate high-quality one-stroke toolpaths for any model with holes or obstacles, solving the problem of difficult path generation caused by non-zero genus models and tool positioning problems caused by multiple breakpoints, thereby improving machining efficiency and accuracy. Simultaneously, our path is unaffected by the representation form, can adapt to boundary shapes, and accurately represent them. Our designed weight allocation based on greedy algorithms can reduce inflection points in the machining path, and one-stroke connections eliminate breakpoints, effectively improving the efficiency and accuracy of the toolpath. The final generated one-stroke toolpath can be input into a CNC system for machining. Furthermore, the toolpath generation method provided by this invention can generate uniform toolpaths with good smoothness, avoiding numerous breakpoints at boundaries. It can generate shorter tool trajectories than the isoparametric method and has better path quality than the equal residual height method, creating uniform and effective curved meshes. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 This is a schematic diagram of toolpath generation in a toolpath generation method provided in the embodiments of this specification;
[0027] Figure 2 This is a schematic diagram of a general-purpose cavity in a toolpath generation method provided in the embodiments of this specification;
[0028] Figure 3 This is a schematic diagram of three different types of points in a toolpath generation method provided in the embodiments of this specification;
[0029] Figure 4 This is a schematic diagram of different types of cavities in a toolpath generation method provided in the embodiments of this specification;
[0030] Figure 5 This is a schematic diagram of two special cases of cavity correction in a toolpath generation method provided in the embodiments of this specification;
[0031] Figure 6 This is a schematic diagram of cell generation in a toolpath generation method provided in the embodiments of this specification;
[0032] Figure 7 This is a schematic diagram of adjacent cases in a toolpath generation method provided in the embodiments of this specification;
[0033] Figure 8 This is a schematic diagram of the cavity connection in a toolpath generation method provided in the embodiments of this specification;
[0034] Figure 9 This is a schematic diagram of boundary offset in a toolpath generation method provided in the embodiments of this specification;
[0035] Figure 10 This is a schematic diagram illustrating the cell cavity in a toolpath generation method provided in the embodiments of this specification;
[0036] Figure 11 This is a schematic diagram of a three-dimensional path display (side view) in a toolpath generation method provided in the embodiments of this specification;
[0037] Figure 12 This is a schematic diagram of a three-dimensional path display (top view) in a toolpath generation method provided in the embodiments of this specification;
[0038] Figure 13 This is a schematic diagram of the parameter mesh in a toolpath generation method provided in the embodiments of this specification;
[0039] Figure 14 This is a schematic diagram illustrating the cell cavity in a toolpath generation method provided in the embodiments of this specification;
[0040] Figure 15 This is a schematic diagram of a three-dimensional path display (side view) in a toolpath generation method provided in the embodiments of this specification;
[0041] Figure 16 This is a schematic diagram of a three-dimensional path display (top view) in a toolpath generation method provided in the embodiments of this specification. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of one or more embodiments of this specification clearer, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of one or more embodiments of this specification.
[0043] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another.
[0044] A CAD (Computer-Aided Design) model is a digital 3D representation used to describe the geometry and structure of a product. It is typically created by CAD software and includes the product's geometry and dimensions; surface modeling is usually defined by parametric surfaces. A machining path refers to the path a tool (such as a milling machine, lathe, laser cutter, etc.) moves across the workpiece surface during the manufacturing process of transforming raw materials into the final product. These paths determine how the tool cuts or processes the raw material to obtain the desired geometry and surface properties. During the product design phase, engineers use CAD software to create a 3D model, defining the product's appearance. In the manufacturing preparation phase, CAM (Computer-Aided Design) converts the CAD model into a machining path based on factors such as tool models and cutting errors. The generated machining path is transmitted to a CNC machine tool or other manufacturing equipment. The machine tool moves the tool according to the path generated by CAM, gradually cutting the raw material into the shape of the final product. For models with non-zero genus (with holes or obstacles), machining paths often face multiple breakpoints, which reduces machining efficiency and introduces new errors due to tool repositioning. Our algorithm is designed for this type of model, generating high-quality one-stroke machining paths to improve subsequent machining efficiency and accuracy.
[0045] The design concept of this application's technical solution is briefly explained below: First, a parameterized point grid G is created in the parameter domain based on the residual height error constraint. Then, in the connected graph part used to avoid obstacles, a cellular grid is generated from the parameterized grid G using the improved MarchingCubes method. This method can avoid obstacles. Finally, in the section on "Toolpath Generation with a Single Starting Point," a cell graph is constructed using the designed edge weights. This induces a minimum spanning tree (MST), which removes old edges and adds new connecting edges based on the link relationships between cavities, and then constructs a toolpath with a single start and end point on the parameter domain.
[0046] The technical solution of this application will be described in detail below in three parts: parametric mesh generation, connected graph for obstacle avoidance, and toolpath generation with a single starting point. The connected graph for obstacle avoidance part includes three parts: boundary offset, cell generation based on MarchingCubes, and cell correction. The toolpath generation with a single starting point part includes two parts: minimum spanning tree of the graph and the reason for boundary offset.
[0047] Parametric Mesh Generation: Parametric meshes are needed to construct toolpaths. Traditional methods, such as isoparametric and constant residual height methods, perform poorly in generating uniform and efficient toolpaths. Isoparametric methods generate dense toolpaths containing unnecessary points, resulting in relatively long paths. Constant residual height methods typically produce non-uniform toolpaths with poor smoothness and numerous breakpoints at boundaries. Therefore, this section uses an adaptive constant residual height method, which can generate shorter toolpaths and better path quality than isoparametric methods, to create uniform and efficient curve meshes.
[0048] Given a parametric surface S(u,v), where u,v∈[0,1], this parametric surface can be a common representation of a surface in a CAD model. In specific scenarios, the specific representation of the parametric surface can be set according to the specific requirements of toolpath generation. First, calculate the equal residual height toolpath L of surface S(u,v). v K points P were sampled in the curve S(u,0). 0,i The calculation of the i-th point P within the given upper limit of residual height h. 0,i Maximum step size Δv along the parameter domain v direction 0,i and point P 0,i Move forward Δv 0,i The new point is defined as P. 1,i ,like Figure 1 As shown in (a). Repeat the above steps until all K points reach the boundary S(u,1). All points P in the k-th step. k,i Constructing the k-th toolpath Similarly, toolpath L can be generated in another direction. u Since u i point Points The number of points may be less than the total number of toolpath curves, n, requiring resampling of n points while maintaining the residual height of the sampled points. Specifically, for example... Figure 1 As shown in (b), the interpolation point is obtained using the PchipInterpolator method. As h(x), and resample n points as When considering each parameter line u i When each cluster of sampling points performs the same operation, a uniformly distributed and symmetrical toolpath can be obtained, such as... Figure 1 As shown in (c).
[0049] Any path L u and L v Select a pair of curves, i.e., curves and They will be at a point (u i,j ,vi,j The curves mentioned above are all represented by discrete points. Using bicubic interpolation, they are transformed into a continuous form, so that the points (u) intersect. i,j ,v i,j ) is a solution to a cubic polynomial. All the intersection points obtained in this way form a parametric grid.
[0050] Without loss of generality, the cell of a parametric mesh is defined as a combination of four adjacent points and four edges, such as... Figure 2 As shown, each grid point can only belong to one cell. Since subsequent processing is based on the connection relationships between points and edges, there is no need to consider the influence of the specific shape of a cell. Benefiting from this definition, we can avoid distinguishing the specific shape of each cell during processing and treat them as regular shapes. Specifically, in... Figure 2 In the diagram, the top row indicates that the shape is not important. The parametric point mesh generated in the parametric mesh generation section always guarantees an even number of rows and columns, allowing them to be considered as groups of four. Therefore, the specific shape can be ignored, focusing only on other more important attributes. The bottom row shows the relationship between the mesh point index and the cell cavity index.
[0051] Connected graph used to avoid obstacles
[0052] Boundary offset: The parameter point mesh G generated in the parameter mesh generation section includes three types of parameter points: a) points on the surface of the machining area, b) points within obstacles on the machining surface, and c) points outside the boundary of the machining area surface. Figure 3 In the diagram, (a) there are three different types of points: points representing the area to be processed, points representing the area outside the processed surface, and points representing obstacle areas. (b) There are two different types of boundaries. The outer boundary is used to separate the processed area from the non-processed area, while the inner boundary represents the obstacle boundary within the processed area. (c) Boundary offset. We only apply boundary offsets to the inner boundary; obstacle boundaries are usually approximated by discrete points. Figure 3 As shown in (a). In practice, only paths need to be generated for the first type of points, while minimizing the impact on the latter two types. Since there's no need to specifically distinguish between the latter two types of points, the description can be simplified, treating them as a single category of points in subsequent processing, i.e., non-processing area points. Two types of boundaries are also defined: one is the outer boundary separating the processing area from the non-processing area, and the other is the inner boundary separating the processing area from obstacles within the processing area, as shown in (a). Figure 3 (b). For the purpose of accurate boundary processing operations later, the boundary information is preserved through a discrete set of points.
[0053] To achieve more accurate shape representation and better error constraints, a bias operation is first performed on the obstacle boundaries before constructing the cell cavity, such as... Figure 3 (c). Specifically, a certain distance d is extended outward from the boundary o of the obstacle, denoted as...
[0054]
[0055] Where r represents the tool radius, R represents the surface curvature radius, and h represents the upper limit of the residual height. Unless otherwise specified, these extended obstacle boundaries... The MarchingCubes cell generation method and other subsequent operations are then executed. Finally, the expanded boundary will be... The generated toolpath and the original obstacle boundary Combine them to create the final high-quality toolpath.
[0056] MarchingCubes-Based Cavity Generation: This section introduces the entire cavity generation process, which is the core of the method. Furthermore, some cavity correction techniques are employed to improve the quality of the generated cavities; the specific methods will be discussed further in the cavity correction section.
[0057] Points within the processing area are uniformly marked as 0, while points outside the processing area are assigned non-zero values. Specifically, each obstacle is assigned a unique number (starting from 1), and this index is used as the assignment value for points within it. This value assignment makes generating cavities using the MarchingCubes method straightforward and simple.
[0058] The MarchingCubes (MC) method was originally used to extract isosurfaces, and the designed method is based on this method with some modifications. Specifically, it allows... This represents the value assignment over the parameter domain generated in the parametric mesh generation section, where M and N represent the number of meshes in each parameter direction, respectively. Furthermore, let... Let D represent the nth element, where It is a multi-index (i, j correspond to two dimensions of D). For the value assignment of each point, if the grid n is a first-type parameter point, i.e., located inside the surface of the processing area, then d n =0, if the mesh n is a parameter point of type second and third, i.e., located outside the surface of the processing area, then d n >0. Therefore, as long as a change in the zero value is detected, the boundaries of obstacles and surfaces can be found. The MC method will traverse all grid points and perform the following steps:
[0059] Let d n0 ,d n1 ,d n2 ,d n3∈D represents the values of four grid points, where n0=(2i,2j), n1=(2i,2j+1), n2=(2i+1,2j+1), n3=(2i+1,2j), i=0,1,…,M-1, j=0,1,…,N-1, then the cell cavity c l It can be constructed from these 4 grid points, where l = (i,j), i = 0, 1, ..., M, j = 0, 1, ..., N. In this way, M × N cavities can be obtained, such as... Figure 1 As shown.
[0060] Next, the MarchingCubes method is used to generate cavities with the correct shape for each cavity. The topology T of the cavity is based on the values d of its four corner points. n To determine this, T can be represented as a binary array T∈{0,1}. 4 Each element represents a corner point, if d n =0, then T i =0, if d n If T > 0, then T i =1. There are a total of 2. 4 =16 configurations. Figure 4 The shapes of the cavities under different conditions are shown. Note that this description only indicates shape; for clarity, the newly generated points are represented by the midpoints of the intersection edges. On the other hand, the boundaries of obstacles are used as the intersections of obstacles and cavities to generate new curved cavity edges, allowing for more precise obstacle boundaries during processing (the curved parts are shown in the figure). Figure 4 The image shows shapes with no points, one point, two points, three points, and all points located within an obstacle area. Note that only a subset of cases is presented for comprehension purposes. In reality, there are 16 different cases due to the alternating positions of the points.
[0061] Once the topological shape of the cell cavity is determined, the precise location of each intersection point between the cavity edge and the obstacle boundary needs to be calculated. Formally, let e represent the edge of the cell cavity, and along edge e, newly generated vertices... It and obstacles Intersection can be defined as By using this definition method, it can be ensured that the position of the intersection point is controllable and will not exceed the boundary of the square.
[0062] Cellular Correction: Due to the nature of MarchingCubes, ambiguities may arise that result in incorrect cell shapes. The topological structure T of the cell is defined above, T∈{0,1}. 4A value of 1 simply indicates whether a grid point is inside an obstacle, without distinguishing which specific obstacle it belongs to. This simple judgment is effective in most cases. However, when grid points are not dense enough and obstacles are close together, it can lead to ambiguous situations, such as... Figure 5 As shown.
[0063] To address this issue, the original MarchingCubes method was extended to handle two specific cases. In the first case, the four points of the cell lumen are located at two different obstacles. and (d) n0 ,d n1 ) and (d n2 ,d n3 ) belong to different obstacles, or (d n0 ,d n3 ) and (d n1 ,d n2 (If the obstacles are different), the original MC method would generate a single empty cell. Now, using two obstacles... and A new cell cavity is formed by the four intersections between the corresponding cell cavity edges e. In the second case, two adjacent points of the cell cavity are located at obstacles. In the middle, another point of the cell cavity is located in the obstacle. The original method would generate a completely incorrect shape. We will now correct it by using an original grid point and three newly generated intersections.
[0064] A high-quality cell cavity mesh was constructed based on the mesh graph G, including cell cavity correction. Although the cavity correction does not cover all possible ambiguous cases, it has shown sufficiently good performance in experiments. Figure 6 The diagram shows three different stages of cavity generation: (a) the initial cavity grid without any processing; (b) cavity generation using the MC algorithm; and (c) the cavity graph after adding edges (a pentagram represents a cavity).
[0065] Toolpath generation with a single starting point
[0066] (1) Minimum spanning tree of the graph: After following the above steps, only cell grids without connections are obtained. Therefore, it is still necessary to establish weighted connections between vertices. With these generated connections, the cell cavity and its connections can be viewed as a graph, allowing the application of the Minimum Spanning Tree (MST) method to construct toolpaths with a single start and end point.
[0067] First, define the connections between vertices. Due to the regularity of the design representation, connections can be generated in two directions: horizontal and vertical. One type of connection will be explained in detail; the other type can be obtained in a similarly symmetrical manner. For horizontal connections, consider any two horizontally adjacent cavities. Each cavity will have an edge directly adjacent to the other cavity. Two cavities are defined as adjacent if and only if their adjacent edges have at least one mesh point. All horizontal connection cases are as follows: Figure 7 As shown. Then, using these two methods, a cell diagram with connectivity relationships was constructed.
[0068] Once connections are established, weights can be defined on them. But in defining a graph... Before determining the weight of edge e, the maximum horizontal connection count is introduced. and vertical maximum connection count The concept of , where M and N represent the number of cavities in each dimension, respectively. It is a multi-index. Specifically, if cell cavity A is connected to cell cavity B through a series of horizontally connected cavities, it indicates the existence of a horizontal path. Between A and B. Path length. This equals the number of horizontally connected cavities from A to B. Defined as the length of the longest horizontal path through cell cavity n.
[0069]
[0070] in Let n represent the set of horizontal paths through cell cavity n. It is easy to deduce that if two cells n1 and n2 are connected, then... Similarly, we can obtain Then, the diagram The weight of an edge is defined as:
[0071]
[0072] For an edge e with endpoints n1 and n2, since n1 and n2 are connected together, we have or This ensures consistency in weights. With these definitions in place, we can begin working on the cellular diagram. The MST is constructed on top of this. In this work, Kruskal's greedy method is employed. In short, let... Indicates in The set of edges that form the minimum spanning tree. Representation diagram Sort the queue of all possible edges according to their weights. Repeat the following process until... Empty: From Delete the first element. If it is not in the graph... If it forms a cycle with other edges, add it to the cycle. middle.
[0073] Finally, based on the generated minimum spanning tree Construct a toolpath with a single starting point. In MST, if two cavities are connected, adjacent cavity edges a and b are deleted, and new edges c and d are added to connect them, as shown below. Figure 8 As shown in (a). Finally, returning to the parametric point mesh G, the vertices are connected according to the cell links to construct a path with a single starting point on the parametric domain. Figure 8 In the image, (a) shows the operation performed when two cavities are connected, (b) shows the result of MST, and (c) shows the final toolpath guided by MST.
[0074] The reason for boundary offset: When directly using the MarchingCubes method to generate cavities, if the mesh points are not dense enough, the boundary of an obstacle may pass through the gap between two cavities, resulting in inaccurate estimation of the boundary shape, such as... Figure 9 As shown. On the other hand, although simply increasing the density of grid points can effectively solve boundary problems, it introduces redundancy in many unnecessary areas, significantly increasing computation time and cost. Figure 9 In the diagram, the left column shows the cell cavity generation without bias and the final generated toolpath, while the right column shows the results with bias, one representing the original barrier region and the other representing the barrier region with bias.
[0075] To address this issue while ensuring smoother boundaries and meeting error constraints, the obstacle boundaries are biased before generating the cells using the MarchingCubes method (see the Boundary Bias section for details). This toolpath generated from the extended obstacle boundaries is defined as P. off Then, P off Boundary with the original obstacle Combining these elements yields an adaptive boundary toolpath. To simplify the connection port selection calculation as much as possible while satisfying the residual height constraint, selection is only performed on newly generated mesh points. When merging the toolpath and obstacle boundary, adjacent generated points with the maximum spacing along the path are selected as the entry and exit points.
[0076] This technical solution uses arbitrary parametric surfaces (i.e., common representations in CAD models) as input. Under the condition of satisfying machining residual height error constraints, it can generate high-quality one-stroke toolpaths for any model with holes or obstacles. This solves the problem of difficult path generation caused by non-zero genus models and tool positioning problems caused by multiple breakpoints, thereby improving machining efficiency and accuracy. Furthermore, our path is unaffected by the representation form, can adapt to boundary shapes, and accurately represent them. Our greedy weight allocation design reduces inflection points in the machining path, and the one-stroke connection eliminates breakpoints, effectively improving the efficiency and accuracy of the toolpath. The final generated one-stroke toolpath can be input into a CNC system for machining. In addition, the toolpath generation method provided by this invention can generate uniform toolpaths with good smoothness, avoiding numerous breakpoints at boundaries. It can generate shorter tool trajectories than the isoparametric method and has better path quality than the equal residual height method, creating uniform and effective curved meshes.
[0077] Figures 10 to 16 This is a schematic diagram of test results based on real data provided in the embodiments of this specification, wherein, Figure 10 This is a schematic diagram illustrating the cell cavity in a toolpath generation method provided in the embodiments of this specification. Figure 11 This is a schematic diagram of a three-dimensional path display (side view) in a toolpath generation method provided in the embodiments of this specification. Figure 12 This is a schematic diagram of a three-dimensional path display (top view) in a toolpath generation method provided in the embodiments of this specification. Figure 13 This is a schematic diagram of the parameter mesh in a toolpath generation method provided in the embodiments of this specification. Figure 14 This is a schematic diagram illustrating the cell cavity in a toolpath generation method provided in the embodiments of this specification. Figure 15 This is a schematic diagram of a three-dimensional path display (side view) in a toolpath generation method provided in the embodiments of this specification. Figure 16 This is a schematic diagram of a three-dimensional path display (top view) in a toolpath generation method provided in the embodiments of this specification.
[0078] Those skilled in the art will understand that the modules in the apparatus of the embodiments can be distributed in the apparatus of the embodiments as described in the embodiments, or they can be located in one or more devices different from this embodiment with corresponding changes. The modules of the above embodiments can be combined into one module, or they can be further divided into multiple sub-modules.
[0079] Finally, it should be noted that the above embodiments 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.
Claims
1. A method for generating toolpaths, characterized in that, The method includes: Given parameter surface ,in First, calculate the surface. Equal residual height toolpath , in the curve Medium sampling Points Calculate the upper limit of the given residual height. Inner Points Along the parameter domain Maximum step size in direction and the first Points Move forward The new point obtained is defined as follows Repeat the following operations: For all sampling points in the current step, calculate the parameters along the parameter domain for each point. The direction meets the upper limit of residual height The maximum step size is constrained, and each point is along... Moving forward in the direction corresponds to the maximum step size, obtaining the next sampling point, until the... All points have reached the boundary. , No. All points in the step Constituting the first toolpath ; in another parameter direction The above adopts and generates Generates toolpaths with the same direction and residual height. Equal residual height toolpath in direction , due to the given point Points Less than the total number of toolpath curves Resampling is required. Each sampling point is used, and the residual height of the sampling point remains unchanged; Arbitrary from path and Select a pair of curves, i.e., curves The curve point The above curves, which intersect, are all represented by discrete points. Using bicubic interpolation, they are transformed into a continuous form, thus making the points... It is a solution to a cubic polynomial, and all the intersection points obtained form a parametric grid; Before constructing the cell cavity, a bias operation is first performed on the obstacle boundary: from the obstacle boundary Expand outward distance , thus obtaining the extended boundary The distance Determined by the following formula: in, R is the tool radius, R is the surface curvature radius, and h is the upper limit of the residual height; The points within the processing area will be uniformly marked as The points located outside the processing area are assigned non-zero values. In the specific implementation, each obstacle is assigned a unique number starting from the natural number 1, and this index is used as the assignment value for its internal points. let This represents the value assignment over the generated parameter domain, where M and N represent the number of grid cells in each parameter direction, respectively. Furthermore, let... express The There are elements, among which It is a multi-indexed system that assigns a value to each point if the grid... If it is a parameter point of type I, that is, located inside the surface of the machining area, then If the grid If the parameter points are of the second or third type, that is, located outside the surface of the processing area, then... Therefore, as soon as a change in zero value is detected, the boundaries of obstacles and surfaces are determined; the MarchingCubes method will traverse all grid points and perform the following steps: set up The values are for 4 grid points, where , cell cavity It consists of these 4 grid points, among which, In this way, we can obtain Each cell cavity; The MarchingCubes method is used to generate cavities of corresponding shapes for each cavity, and the topology of the cavities is shown. Based on the values of its four corner points To determine, will Represented as a binary array Each element corresponds to a corner point, if ,but ,if ,but ; Let symbol Indicates the edge of the cell lumen, along the edge Newly generated vertices The vertex Obstacles after offset Intersection is defined as ; After completing the steps of constructing the parametric mesh, setting obstacle boundaries, assigning mesh point values, dividing cavities, and generating cavities based on the MarchingCubes method, a non-connected cavity mesh is obtained. Weighted connections are established between the vertices of the cavities to form a cavity graph, which consists of the cavities and their connections. Based on this cavity diagram The Minimum Spanning Tree (MST) method is used to construct toolpaths with a single start and end point, specifically including: The connection relationships between vertices are defined. Due to the regularity of the design representation, connection relationships are generated in both horizontal and vertical directions. For any two horizontally adjacent cavities, each cavity has an edge directly adjacent to the other cavity. Two cavities are defined as adjacent if and only if their adjacent edges have at least one grid point. Then, a cavity graph with connection relationships is constructed using these two connection relationship generation methods in the horizontal and vertical directions. ; In the definition diagram edge Before assigning weights, introduce the maximum horizontal connection count. and vertical maximum connection count The concept, in which and These represent the number of cavities in each dimension. For multiple indexes; if cavity A is connected to cavity B through a series of horizontally connected cavities, then there exists a horizontal path. The length of the path between A and B Equal to the number of horizontally connected cavities from A to B, Defined as through the cell cavity The length of the longest horizontal path, i.e.: in, Indicates through the cell cavity A set of horizontal paths; two interconnected cavities and satisfy Obtained in the same way ; the diagram The weight of an edge is defined as: For those with endpoints and edge ,because and They are connected together. or Kruskal's greedy method was used in the cell cavity diagram. Construct the minimum spanning tree: Let The set of edges for the final spanning tree. Representation diagram A queue of all possible edges sorted in ascending order of weight; repeat the following operation until... Empty: From If the first element is taken from the set, then the edge is added to the set. Not in the picture If it forms a cycle with other edges, add it to the cycle. middle; Based on the generated minimum spanning tree Constructing toolpaths with a single starting point: In the minimum spanning tree, if two cavities are connected, delete the edges of adjacent cavities. and Add new edges and A path connecting two cavities; then return the parameter point grid. By connecting the corresponding vertices according to the cell cavity links, a complete path with a single starting point is constructed in the parameter domain; Before using the MarchingCubes method to generate cavities, the boundaries of the obstacles are biased, and the toolpath generated by the expanded obstacle boundaries is defined as... Then, Boundary with the original obstacle By combining these, a toolpath with adaptive boundaries is obtained. To simplify the calculation of connection port selection while satisfying the residual height constraint, connection ports are selected only in the newly generated mesh points. When merging the toolpath and obstacle boundary, adjacent generated points with the maximum spacing along the path are selected as the inlet and outlet.
Citation Information
Patent Citations
Method for using mechanical arm to complete unrepeatable coverage tasks with least number of times of uplifting
CN111823231A
Construction method of non-uniform irregular spline primary function retaining sharp features
CN113591356A