An automatic nesting method and system based on discrete space search
By using an automatic nesting method based on discrete space search, and by employing contact perimeter evaluation and multi-round adjustment mechanisms, the problem of insufficient space utilization in existing two-dimensional rectangular nesting is solved, achieving efficient material utilization and nesting compactness, and reducing enterprise production costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- FOSHAN UNIVERSITY
- Filing Date
- 2026-02-12
- Publication Date
- 2026-05-29
AI Technical Summary
Existing two-dimensional rectangular nesting algorithms have shortcomings in space utilization and representation of free areas, resulting in material waste and low nesting efficiency.
An automatic nesting method based on discrete space search is adopted. By using the contact perimeter evaluation index and a multi-round nesting adjustment mechanism, candidate placement points are generated and the part layout is optimized. Combined with the candidate point generation strategy and dynamic adjustment of part priority, the maximum contact between the part and the boundary is ensured.
It improves the utilization rate of idle space, reduces isolated gaps, enhances material utilization and layout completion rate, simplifies placement decision-making logic, and reduces computational complexity and production costs.
Smart Images

Figure CN122114272A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of two-dimensional nesting technology, specifically to an automatic nesting method and system based on discrete space search. Background Technology
[0002] In the two-dimensional rectangular nesting problem, how to efficiently and compactly arrange a set of irregular or rectangular parts on a finite material plate is a core optimization problem that has long been a focus of attention in fields such as industrial manufacturing, packaging, and garment cutting. Existing mainstream algorithms, such as the lowest horizontal line algorithm, the contour line algorithm, and the maximum rectangle algorithm, although performing well in specific scenarios, have obvious shortcomings in the generation of candidate positions and the representation of empty regions.
[0003] The lowest horizontal line algorithm prioritizes the bottom left corner, which is simple to implement and computationally efficient, but it underutilizes the space in the upper right area, easily creating numerous irregular gaps and resulting in material waste. The contour line algorithm achieves compact arrangement by maintaining a "skyline," but it only focuses on the upper boundary contour and cannot perceive or represent internal voids, causing a large amount of usable space to be ignored. The maximum rectangle algorithm attempts to improve spatial matching by dividing the space into the largest available rectangles, but the rectangle division strategy is easily affected by the initial arrangement. If the division is unreasonable, even if there is enough space, parts may not be able to be placed due to shape mismatch, leading to a "space available but unable to fit" dilemma. Summary of the Invention
[0004] The purpose of this invention is to provide an automatic nesting method and system based on discrete space search to solve the problems mentioned in the background art.
[0005] To achieve the above objectives, the present invention provides the following technical solution: an automatic nesting method based on discrete space search, the method comprising the following steps:
[0006] S100: Obtain the layout input parameters and automatically assign the initial priority of each part based on the layout input parameters; the layout input parameters include the size of the raw material plate, the length and width of each part to be laid out, and the preset maximum layout round;
[0007] S200: Reset the layout operation status, including marking all parts to be laid out as unattended, resetting the unplaced parts counter to zero, clearing the candidate placement point set, and sorting the parts set in descending order according to the current priority of each part;
[0008] S300: Select the highest priority part to be placed that has not been attempted to be placed, traverse the set of candidate placement points to generate multiple placement candidate schemes, each scheme including the coordinates, number, rotation angle and corresponding contact perimeter of the candidate placement point, and mark the part as having been attempted to be placed.
[0009] S400: If there are candidate placement schemes with a contact perimeter greater than zero, select the scheme with the largest contact perimeter and place the part on the raw material plate accordingly.
[0010] S500: If the maximum contact perimeter is zero, it indicates that there is no effective placement scheme. The priority of the part is increased by one level, the unplaced part counter is incremented by 1, and its placement operation in this round of layout is skipped.
[0011] S600: Based on the current layout, generate a new set of candidate placement points;
[0012] S700: Determine whether there are any parts to be arranged in the parts set that are in an unattended placement state; if so, return to step S300; otherwise, proceed to step S800.
[0013] S800: Determine whether the unplaced parts counter is greater than zero and the current layout round is less than the preset maximum layout round; if so, increment the layout round counter and return to step S200; otherwise, proceed to step S900.
[0014] S900: Output the nesting results.
[0015] Furthermore, the candidate placement point consists of two-dimensional coordinates (x, y) and candidate point number k (k∈{1,2,3,4}), represented in triplet form as (x, y, k), where the candidate point number is used to indicate the corner number that the rectangular part to be arranged should be aligned with when placed.
[0016] Furthermore, the method for identifying the corner numbers of the rectangular part is as follows: the rectangular part has four corners, and its geometric center is defined as the intersection of the diagonals; each of the four corners is assigned a unique corner number, which is determined solely by the relative spatial orientation of the corner relative to the geometric center; in a local coordinate system established with the geometric center as the origin: the corner located to the lower left of the geometric center is numbered 1; the corner located to the lower right of the geometric center is numbered 2; the corner located to the upper right of the geometric center is numbered 3; the corner located to the upper left of the geometric center is numbered 4; when placing the part at a candidate placement point with candidate point number k, the corner with corner number k must be aligned to the coordinates of that candidate placement point.
[0017] Furthermore, in S100, the layout input parameters are obtained, and the initial priority of each part is automatically assigned based on the layout input parameters. The layout input parameters include the size of the raw material plate, the length and width of each part to be laid out, and the preset maximum layout round. The method for obtaining the layout input parameters is as follows: the length L and width W of the raw material plate, the length and width of each part to be laid out, and the total number of parts n; the parts set is sorted in descending order based on the area of each part, and an initial priority is assigned, wherein the part with the largest area has a priority of n, the next largest is n−1, ..., and the part with the smallest area has a priority of 1; the layout round counter is initialized to 0, and the preset maximum layout round is set to 3n.
[0018] Furthermore, in S200, the layout operation state is reset, including marking all parts to be laid out as unattended, resetting the unplaced parts counter to zero, sorting the parts set in descending order according to the current priority of each part, clearing the current layout, and initializing the candidate placement point set as follows: marking all parts to be laid out as unattended, resetting the unplaced parts counter to zero, clearing the layout, and initializing the candidate placement point set to a set containing four candidate placement points: {(0,0,1),(L,0,2),(L,W,3),(0,W,4)}; and sorting the parts set in descending order according to the current priority of each part.
[0019] Furthermore, in S300, the highest priority part to be placed and not yet attempted to be placed is selected. The candidate placement point set is traversed to generate multiple placement candidate schemes. Each scheme includes a candidate placement point, a rotation angle, and a corresponding contact perimeter. The method for marking the part as having been placed is as follows: Select the part to be placed that is currently in an unattended placement state and has the highest priority; for this part, try 0° and 90° rotation directions in turn, and for each rotation direction, align it with each candidate placement point in the candidate placement point set; for each rotation-candidate placement point combination, if the parts overlap or exceed the boundary of the raw material plate after placement, the contact perimeter of the placement scheme is set to 0; otherwise, the contact perimeter of the scheme is calculated, where the contact perimeter is the sum of the lengths of the line segments that contact the boundary of the rectangular part with the already placed parts and the boundary of the raw material plate.
[0020] Furthermore, in S400: if there are placement candidate schemes with a contact perimeter greater than zero, the scheme with the largest contact perimeter is selected, and the part is laid out on the raw material plate accordingly. The method is as follows: in the placement candidate schemes, select the candidate placement point and direction that maximizes the contact perimeter, rotate the rectangle to the corresponding direction, and align the corner of the rectangular part with the corner number corresponding to the candidate placement point with the candidate placement point, and lay out the part on the raw material plate.
[0021] Furthermore, in S500: if the maximum contact perimeter is zero, it indicates that there is no effective placement scheme. The priority of the part is increased by one level, the unplaced part counter is incremented by 1, and its placement operation in this round of nesting is skipped.
[0022] Furthermore, in S600, based on the current layout, a new set of candidate placement points is generated, as follows:
[0023] S601: Clear all candidate placement points and their numbers in the current candidate placement point set, and generate a free area set based on the current layout of rectangular parts. The free area set is used to represent the available area in the current raw material plate that has not yet been occupied by any parts.
[0024] S602: Select a free region that has not yet been vectorized from the set of free regions, mark it as vectorized, and extract its outer boundary to construct a counterclockwise directed boundary vector sequence; wherein, the counterclockwise directed boundary vector sequence is a vector sequence formed by traversing adjacent boundary points in a counterclockwise direction along the outer boundary of the free region, representing the directed line segment between each pair of adjacent boundary points as a vector, and arranging them in the traversal order;
[0025] S603: Combine the vectors in the directed boundary vector sequence in pairs in order to form a set of continuous boundary vector pairs; wherein each vector pair consists of a first vector and a second vector: the first vector is the i-th vector in the sequence, and the second vector is the (i+1)-th vector (i=1,2,…,m−1); for the last vector pair, the first vector is the m-th vector in the sequence, and the second vector is the 1-th vector;
[0026] S604: Traverse the set of continuous boundary vector pairs. If the direction of the first vector of the vector pair is consistent with the negative direction of the Y-axis and the direction of the second vector is consistent with the positive direction of the X-axis, then take the endpoint of the first vector as a candidate placement point, mark the number of the candidate placement point as 1, and store the position and number of the candidate placement point in the candidate placement point set.
[0027] If the direction of the first vector of the vector pair is consistent with the positive direction of the X-axis and the direction of the second vector is consistent with the positive direction of the Y-axis, then the endpoint of the first vector is taken as a candidate placement point, and the candidate placement point is marked with the number 2. The position and number of the candidate placement point are stored in the candidate placement point set.
[0028] If the direction of the first vector of the vector pair is consistent with the positive direction of the Y-axis and the direction of the second vector is consistent with the negative direction of the X-axis, then the endpoint of the first vector is taken as a candidate placement point, and the candidate placement point is marked with the number 3. The position and number of the candidate placement point are stored in the candidate placement point set.
[0029] If the direction of the first vector of the vector pair is consistent with the negative direction of the X-axis and the direction of the second vector is consistent with the negative direction of the Y-axis, then the endpoint of the first vector is taken as a candidate placement point, and the candidate placement point is marked with the number 4. The position and number of the candidate placement point are stored in the candidate placement point set.
[0030] S605: Traverse the boundary vector set and perform bidirectional extension processing on each boundary vector: Traverse each boundary vector in the boundary vector set and perform bidirectional extension processing on it: Starting from the end point of the vector, extend it along its direction to generate a positive extension vector; starting from the beginning point of the boundary vector, extend it in the opposite direction to generate a negative extension vector; store them in the extension vector set, wherein the length of the extension is sufficient to ensure that the extension vector exceeds the boundary of the free area, i.e., the free area selected in step S602, for use in the subsequent generation of candidate placement points;
[0031] S606: Select an unprocessed extended vector from the set of extended vectors and mark it as processed; for this extended vector, perform geometric intersection operations with each boundary vector in the set of boundary vectors in turn; if the result of the intersection operation is an intersection point, rather than a line segment or a coincident edge, then add the intersection point to the intersection point set.
[0032] S607: If the intersection point set contains only points that coincide with the starting point of the extended vector, skip this step; otherwise, select the point from the intersection point set that is closest to the starting point of the extended vector and does not coincide with that starting point, and add the coordinates of that point and its corresponding candidate placement point number to the candidate placement point set. The method for marking the candidate placement point number is as follows:
[0033] If the extended vector is a positive extended vector and its direction is along the negative Y-axis, then the corresponding candidate placement point is marked as 1; if it is an inverse extended vector and its direction is along the negative Y-axis, then the corresponding candidate placement point is marked as 2.
[0034] If the extended vector is a positive extended vector and its direction is along the positive Y-axis, then the corresponding candidate placement point is marked as 3; if it is an inverse extended vector and its direction is along the positive Y-axis, then the corresponding candidate placement point is marked as 4.
[0035] If the extended vector is a positive extended vector and its direction is along the negative X-axis, then the corresponding candidate placement point is marked as 4; if it is an inverse extended vector and its direction is along the negative X-axis, then the corresponding candidate placement point is marked as 1.
[0036] If the extended vector is a positive extended vector and its direction is along the positive X-axis, then the corresponding candidate placement point is marked as 2; if it is an inverse extended vector and its direction is along the positive X-axis, then the corresponding candidate placement point is marked as 3.
[0037] S608: If there are unprocessed extended vectors in the set of extended vectors, jump to S606; otherwise, jump to S609.
[0038] S609: If there are unvectorized free regions in the set of free regions, jump to S602; otherwise, jump to S610.
[0039] S610: Obtain the set of candidate placement points.
[0040] An automatic nesting system based on discrete space search, the system includes a parameter acquisition module, a state reset module, a scheme generation module, a part layout module, a priority adjustment module, a candidate point generation module, a first judgment module, a second judgment module, and a result output module;
[0041] The parameter acquisition module is used to acquire the layout input parameters and automatically allocate the initial priority of each part based on the layout input parameters. The layout input parameters include the size of the raw material plate, the length and width of each part to be laid out, and the preset maximum number of layout rounds.
[0042] The state reset module is used to reset the layout operation state, including marking all parts to be laid out as unattended, resetting the unplaced parts counter to zero, clearing the candidate placement point set, and sorting the parts set in descending order according to the current priority of each part.
[0043] The scheme generation module is used to select the highest priority part to be placed that has not been attempted to be placed, traverse the candidate placement point set to generate multiple placement candidate schemes, each scheme including the candidate placement point coordinates, number, rotation angle and corresponding contact perimeter, and mark the part as the attempted placement state;
[0044] The part layout module is used to select the placement scheme with the largest contact perimeter when there are placement candidate schemes with a contact perimeter greater than zero, and to place the part on the raw material plate accordingly.
[0045] The priority adjustment module is used to raise the priority of the corresponding part by one level when the maximum contact perimeter is zero, increment the counter of the unplaced part by 1, and skip its placement operation in the current round of layout.
[0046] The candidate point generation module is used to generate a new set of candidate placement points based on the current layout.
[0047] The first judgment module is used to determine whether there are any parts to be arranged in the parts set that are in an unattended placement state. If there are, the scheme generation module is triggered to continue working; if there are no, the second judgment module is triggered to work.
[0048] The second judgment module is used to determine whether the unplaced parts counter is greater than zero and the current layout round is less than the preset maximum layout round. If so, the layout round counter is incremented and the state reset module is triggered to work again. Otherwise, the result output module is triggered to work.
[0049] The result output module is used to output the sorting results.
[0050] Compared with the prior art, the beneficial effects of the present invention are:
[0051] This invention improves the utilization of idle space, reduces isolated gaps, increases material utilization and layout completion rate, simplifies placement decision logic, controls computational complexity, and achieves high layout efficiency, thereby reducing enterprise production costs. It is applicable to two-dimensional rectangular layout scenarios in industrial manufacturing, packaging, and other fields. This invention focuses on two-dimensional rectangular layout, where the layout object is a rectangle. By constructing a candidate placement point generation mechanism that can simultaneously conform to two mutually perpendicular boundaries, the invention ensures that candidate positions naturally fit the geometric characteristics of the remaining space. Combined with an optimization strategy using contact perimeter as an evaluation index and a multi-round layout adjustment mechanism, it effectively improves the utilization of idle space. This method avoids space waste caused by incomplete representation or improper division of idle areas, improving material utilization while ensuring layout efficiency.
[0052] By prioritizing the placement scheme with the largest contact perimeter, the newly placed parts can form the maximum edge contact with the already laid-out parts and the boundary of the raw material plate, effectively reducing the generation of isolated gaps, improving the compactness of the layout and the utilization rate of the raw material plate, and reserving a larger and more continuous usable area for the placement of subsequent parts, which is conducive to improving the overall layout completion rate.
[0053] By dynamically increasing the priority of parts when they cannot be placed in the current round, the parts can be attempted to be placed earlier in the next round of layout, thus avoiding them from being stuck for a long time due to their low initial priority. This improves the success rate of placing difficult-to-layout parts and the overall layout completion rate.
[0054] Only candidate placement points are generated that allow a rectangular part to simultaneously align with two mutually perpendicular boundaries. This generation strategy naturally eliminates inefficient locations, ensuring that each candidate point has high contact perimeter potential, effectively improving nesting compactness and computational efficiency.
[0055] By assigning a number corresponding to the corner number of the rectangle to each candidate placement point, the corner number to be used is already determined during the candidate point generation stage. Therefore, when actually placing the part, there is no need to additionally judge or traverse the alignment possibilities of the four corners; simply align the corner number that matches the candidate point number to that point to directly obtain a unique and valid placement posture. This mechanism significantly simplifies the placement decision logic, avoids the computational overhead caused by multi-corner trial and error, and improves the determinism and execution efficiency of the nesting process.
[0056] This invention introduces the contact perimeter as an evaluation criterion for placement quality, generating only candidate placement points that can simultaneously conform to two mutually perpendicular boundaries. Combined with a multi-round nesting mechanism, it dynamically adjusts the part nesting priority and rearranges the layout when the nesting results are unsatisfactory. This method significantly improves nesting compactness and material utilization while effectively controlling computational complexity and maintaining high nesting efficiency, thereby reducing enterprise production costs and saving raw materials and social resources. Attached Figure Description
[0057] Figure 1 This is a flowchart of an automatic nesting method based on discrete space search;
[0058] Figure 2 This is a schematic diagram showing the correspondence between the corner numbers of the rectangular parts and the candidate placement point numbers in an embodiment of the present invention;
[0059] Figure 3 This is a schematic diagram of the candidate placement points generated after placing a rectangular part on the raw material plate in an embodiment of the present invention;
[0060] Figure 4 This is a diagram showing the layout result after all rectangular parts have been laid out in an embodiment of the present invention.
[0061] Figure 5 This is the output of Siemens typesetting software. Detailed Implementation
[0062] Please see Figures 1-4 This invention provides a technical solution: an automatic nesting method based on discrete space search, the method comprising the following steps:
[0063] S100: Obtain the layout input parameters and automatically assign the initial priority of each part based on the layout input parameters; the layout input parameters include the size of the raw material plate, the length and width of each part to be laid out, and the preset maximum layout round;
[0064] In S100, the layout input parameters are obtained, and the initial priority of each part is automatically assigned based on the layout input parameters. The layout input parameters include the size of the raw material plate, the length and width of each part to be laid out, and the preset maximum layout round. The method is as follows: the layout input parameters are obtained, including the length L and width W of the raw material plate, the length and width of each part to be laid out, and the total number of parts n; the parts set is sorted in descending order based on the area of each part, and an initial priority is assigned, where the part with the largest area has a priority of n, the next largest is n−1, ..., and the part with the smallest area has a priority of 1; the layout round counter is initialized to 0, and the preset maximum layout round is set to 3n.
[0065] During implementation, the input layout parameters are first validated to ensure they are positive, including the raw material board dimensions and part length / width. If invalid parameters are found, an error message is immediately displayed to prevent meaningless subsequent calculations. Part area calculation uses a precise geometric area formula. After calculation based on part length and width, all parts are sorted in descending order of area, retaining their unique identifiers during the sorting process to avoid confusion during priority allocation. The maximum number of layout rounds is set to three times the total number of parts, n. During implementation, this parameter, along with the raw material board dimensions and part parameters, is structured and stored to form a layout parameter library, providing data support for subsequent steps.
[0066] The initial priority allocation based on area is to prioritize the placement of large parts, thereby avoiding layout failures caused by the lack of space for large parts due to the remaining fragmented space on the board, thus improving the overall utilization rate of the board from the root. The maximum number of layout rounds is set to 3n, which ensures that there are enough iterations to solve the placement problem of difficult-to-layout parts, while avoiding computational redundancy caused by too many rounds.
[0067] S200: Reset the layout operation status, including marking all parts to be laid out as unattended, resetting the unplaced parts counter to zero, clearing the candidate placement point set, and sorting the parts set in descending order according to the current priority of each part;
[0068] In S200, the nesting operation state is reset, including marking all parts to be nested as unattended, resetting the unplaced parts counter to zero, sorting the parts set in descending order according to the current priority of each part, clearing the current nesting layout, and initializing the candidate placement point set as follows: marking all parts to be nested as unattended, resetting the unplaced parts counter to zero, clearing the nesting layout, and initializing the candidate placement point set to a set containing four candidate placement points: {(0,0,1),(L,0,2),(L,W,3),(0,W,4)}; and sorting the parts set in descending order according to the current priority of each part.
[0069] During implementation, a complete state reset and initialization must be performed, including setting the value of the unplaced part counter to 0, clearing all triplet data in the candidate placement point set, and deleting all information in the placed part set. The initial candidate placement point set is strictly generated according to {(0,0,1),(L,0,2),(L,W,3),(0,W,4)}, where L and W are the length and width of the raw material plate, precisely corresponding to the four physical corner points of the raw material plate. The descending sort of the part set is based on the current priority. During implementation, the priority parameter of each part is read in real time, and the quicksort method is used to complete the sorting to ensure sorting efficiency.
[0070] The full state reset before each round is to ensure that each round of layout has a completely new layout basis and avoid interference from the information of invalid placement in the previous round; the initial candidate points correspond to the four corners of the raw material board, so that the parts can fit the board boundary from the beginning, maximizing the initial contact perimeter and reducing the initial gap.
[0071] S300: Select the highest priority part to be placed that has not been attempted to be placed, traverse the set of candidate placement points to generate multiple placement candidate schemes, each scheme including the coordinates, number, rotation angle and corresponding contact perimeter of the candidate placement point, and mark the part as having been attempted to be placed.
[0072] In S300, the highest priority part to be placed and not yet attempted to be placed is selected. The candidate placement point set is traversed to generate multiple placement candidate schemes. Each scheme includes a candidate placement point, a rotation angle, and a corresponding contact perimeter. The method for marking the part as having been placed is as follows: Select the highest priority part to be placed that is currently not yet attempted to be placed; for this part, try 0° and 90° rotation directions in turn, and for each rotation direction, align it with each candidate placement point in the candidate placement point set; for each rotation-candidate placement point combination, if the parts overlap or exceed the boundary of the raw material plate after placement, the contact perimeter of the placement scheme is set to 0; otherwise, the contact perimeter of the scheme is calculated, where the contact perimeter is the sum of the lengths of the line segments that contact the boundary of the rectangular part with the already placed parts and the boundary of the raw material plate.
[0073] During implementation, a unique selection principle is adopted, selecting only the highest priority single part marked as "not attempted placement" from the part set each time to avoid logical confusion caused by processing multiple parts simultaneously. The parts are rotated sequentially by 0° and 90°, and the length and width parameters of the parts are updated in real time after rotation. Then, alignment is performed with each triple in the candidate placement point set. The validity determination of the placement scheme is divided into two steps: first, it is determined whether the part exceeds the boundary of the raw material plate, and then the bounding box detection method is used to determine whether the part overlaps with the already placed parts. If either condition is not met, the contact perimeter of the scheme is set to 0. When calculating the contact perimeter, the contact line segments between the part boundary and the boundary of the raw material plate and the boundary of the already placed parts are accurately identified. The length of each contact line segment is calculated using Euclidean distance and summed to ensure the accuracy of the calculation results. After the scheme is generated, the part is immediately marked as "attempted placement", and the complete triple, rotation angle, and contact perimeter data are stored for each valid scheme.
[0074] Trying only 0° and 90° rotations strikes a balance between layout flexibility and computational efficiency, avoiding excessive rotation angles that increase geometric calculations while meeting the industrial cutting layout requirements for rectangular parts; the rule of setting the perimeter to 0 quickly eliminates invalid schemes, reducing the computational load for subsequent scheme selection.
[0075] S400: If there are candidate placement schemes with a contact perimeter greater than zero, select the scheme with the largest contact perimeter and place the part on the raw material plate accordingly.
[0076] In S400: If there are placement candidate schemes with a contact perimeter greater than zero, the scheme with the largest contact perimeter is selected, and the part is laid out on the raw material plate accordingly. The method is as follows: In the placement candidate schemes, select the candidate placement point and direction that maximizes the contact perimeter, rotate the rectangle to the corresponding direction, and align the corner of the rectangular part with the corner number corresponding to the candidate placement point with the candidate placement point, and lay out the part on the raw material plate.
[0077] During implementation, all candidate placement schemes are first sorted in descending order of contact perimeter, and the scheme with the largest perimeter value is selected as the optimal scheme. If multiple schemes with the same largest perimeter exist, one can be randomly selected. When placing parts, the corner number matching principle is strictly followed. The corner point with corner number k is precisely aligned to the coordinate position (x, y, k) of the candidate placement point, and the part is rotated to the angle corresponding to the optimal scheme. After placement, the set of placed parts is updated in real time, recording information such as the placement coordinates, rotation angle, and corner number matching relationship of each part, providing data for subsequent contact perimeter calculation and free area extraction. Prioritizing the scheme with the largest contact perimeter is crucial to maximizing edge contact between the newly placed part and the sheet metal and existing parts, reducing isolated gaps, and reserving more continuous usable space for subsequent part placement, thus improving the overall compactness of the layout.
[0078] S500: If the maximum contact perimeter is zero, it indicates that there is no effective placement scheme. The priority of the part is increased by one level, the unplaced part counter is incremented by 1, and its placement operation in this round of layout is skipped.
[0079] In S500: If the maximum contact perimeter is zero, it indicates that there is no effective placement scheme. The priority of the part is increased by one level, the unplaced part counter is incremented by 1, and its placement operation in this round of layout is skipped.
[0080] If the contact perimeter of all candidate placement schemes is 0 during implementation, the priority parameter of the part is immediately increased by one level, and only by one level, to avoid excessive increase that could cause confusion in part priorities. At the same time, the value of the unplaced part counter is incremented by 1. The counter only counts the number of parts without a valid placement scheme in this round, providing a quantitative basis for judgment in subsequent rounds. After the parameter update is completed, all subsequent operations of the part in this round are skipped directly, and the next unplaced part is processed to avoid repeated calculations of invalid parts.
[0081] Dynamically increasing priority allows difficult-to-place parts to have an earlier placement opportunity in subsequent rounds, avoiding long-term stagnation due to low initial priority and improving the overall layout completion rate; the gradient design that only increases priority by one level ensures layout order and prevents large parts from being squeezed out due to a sudden increase in the priority of a single part.
[0082] S600: Based on the current layout, generate a new set of candidate placement points;
[0083] In S600, based on the current layout, a new set of candidate placement points is generated using the following method:
[0084] S601: Clear all candidate placement points and their numbers in the current candidate placement point set, and generate a free area set based on the current layout of rectangular parts. The free area set is used to represent the available area in the current raw material plate that has not yet been occupied by any parts.
[0085] S602: Select a free region that has not yet been vectorized from the set of free regions, mark it as vectorized, extract its outer boundary, and construct a counterclockwise directed boundary vector sequence; wherein, the counterclockwise directed boundary vector sequence is formed by traversing adjacent boundary points in a counterclockwise direction along the outer boundary of the free region, representing the directed line segment between each pair of adjacent boundary points as a vector, and arranging them in the traversal order;
[0086] S603: Combine the vectors in the directed boundary vector sequence in pairs in order to form a set of continuous boundary vector pairs; where each vector pair consists of a first vector and a second vector: the first vector is the i-th vector in the sequence, and the second vector is the (i+1)-th vector (i=1,2,…,m−1); for the last vector pair, the first vector is the m-th vector in the sequence, and the second vector is the 1-th vector;
[0087] S604: Traverse the set of continuous boundary vector pairs. If the direction of the first vector of a vector pair is consistent with the negative direction of the Y-axis and the direction of the second vector is consistent with the positive direction of the X-axis, then take the endpoint of the first vector as a candidate placement point, mark the number of the candidate placement point as 1, and store the position and number of the candidate placement point in the candidate placement point set.
[0088] If the direction of the first vector of a vector pair is consistent with the positive direction of the X-axis, and the direction of the second vector is consistent with the positive direction of the Y-axis, then the endpoint of the first vector is taken as a candidate placement point, and the number of the candidate placement point is marked as 2. The position and number of the candidate placement point are stored in the candidate placement point set.
[0089] If the direction of the first vector of a vector pair is consistent with the positive direction of the Y-axis and the direction of the second vector is consistent with the negative direction of the X-axis, then the endpoint of the first vector is taken as a candidate placement point, and the candidate placement point is marked with the number 3. The position and number of the candidate placement point are stored in the candidate placement point set.
[0090] If the direction of the first vector of a vector pair is consistent with the negative direction of the X-axis, and the direction of the second vector is consistent with the negative direction of the Y-axis, then the endpoint of the first vector is taken as a candidate placement point, and the candidate placement point is marked with the number 4. The position and number of the candidate placement point are stored in the candidate placement point set.
[0091] S605: Traverse the boundary vector set and perform bidirectional extension processing on each boundary vector: Traverse each boundary vector in the boundary vector set and perform bidirectional extension processing on it: Starting from the end point of the vector, extend it along its direction to generate a positive extension vector; starting from the beginning point of the boundary vector, extend it in the opposite direction to generate a negative extension vector; store them in the extension vector set, where the extension length is sufficient to ensure that the extension vector exceeds the boundary of the free area, i.e., the free area selected in step S602, for use in the subsequent generation of candidate placement points;
[0092] S606: Select an unprocessed extended vector from the extended vector set and mark it as processed; for this extended vector, perform geometric intersection operations with each boundary vector in the boundary vector set in turn; if the result of the intersection operation is an intersection point, rather than a line segment or a coincident edge, then add the intersection point to the intersection point set.
[0093] S607: If the intersection point set contains only points that coincide with the starting point of the extended vector, skip this step; otherwise, select the point from the intersection point set that is closest to the starting point of the extended vector and does not coincide with that starting point, and add the coordinates of that point and its corresponding candidate placement point number to the candidate placement point set. The method for marking the candidate placement point number is as follows:
[0094] If the extension vector is a positive extension vector and its direction is along the negative Y-axis, then the corresponding candidate placement point is marked as 1; if it is an inverse extension vector and its direction is along the negative Y-axis, then the corresponding candidate placement point is marked as 2.
[0095] If the extension vector is a positive extension vector and its direction is along the positive Y-axis, then the corresponding candidate placement point is marked as 3; if it is an inverse extension vector and its direction is along the positive Y-axis, then the corresponding candidate placement point is marked as 4.
[0096] If the extension vector is a positive extension vector and its direction is along the negative X-axis, then the corresponding candidate placement point is marked as 4; if it is an inverse extension vector and its direction is along the negative X-axis, then the corresponding candidate placement point is marked as 1.
[0097] If the extended vector is a positive extended vector and its direction is along the positive X-axis, then the corresponding candidate placement point is marked as 2; if it is an inverse extended vector and its direction is along the positive X-axis, then the corresponding candidate placement point is marked as 3.
[0098] S608: If there are unprocessed extended vectors in the set of extended vectors, jump to S606; otherwise, jump to S609.
[0099] S609: If there are unvectorized free regions in the set of free regions, jump to S602; otherwise, jump to S610.
[0100] S610: Obtain the set of candidate placement points.
[0101] During implementation, the accuracy of geometric vector processing, intersection operations, and candidate point selection must be ensured. The implementation of each sub-step is extended as follows:
[0102] When implementing S601, the free area is extracted by Boolean subtraction. The entire space of the raw material plate is the subtracted set, and the space of the placed parts is the subtracted set. The space obtained after subtraction is the free area. All free areas constitute the free area set. During implementation, each free area is assigned a unique identifier to avoid omissions in subsequent processing. When clearing the candidate placement point set, all triplet data must be deleted to ensure that the generation of new candidate points is not interfered with by historical data.
[0103] When implementing S602, the outer boundary of the free area is extracted. The physical outer boundary of the free area is identified by the edge detection algorithm. Then, the adjacent boundary points of the outer boundary are traversed in a counterclockwise direction. Each pair of adjacent points is converted into a planar positioning vector according to the rule of "start point → end point". All vectors are arranged in the traversal order to form a counterclockwise directed boundary vector sequence. The continuity of the boundary points is ensured during the traversal process to avoid the breakage of the vector sequence.
[0104] When implementing S603, a closed-loop pairwise combination of vector sequences is performed. For a sequence containing m vectors, (i, i+1) are combined sequentially (i = 1, 2, ..., m−1). Finally, the m-th vector is combined with the first vector to ensure that the outer boundary of the free area is completely traversed without any vector pairs being missed. The combined vector pairs are labeled with the attributes of the first and second vectors to provide a basis for subsequent direction determination.
[0105] When implementing S604, the direction of vectors is strictly determined according to the positive and negative polarities of the X and Y axes. Only vectors along the positive / negative directions of the coordinate axes are identified, and vectors in directions other than the coordinate axes are skipped directly. After the determination is completed, the endpoint of the first vector that meets the conditions is taken as a candidate placement point, and the candidate point number is accurately marked according to the rules. Then, the (x,y,k) triplet is stored in the candidate placement point set.
[0106] When implementing S605, each boundary vector is extended bidirectionally. A positive extension vector is generated along the original direction starting from the vector's endpoint, and a negative extension vector is generated along the opposite direction starting from the vector's origin. The extension length is just beyond the boundary of the free area, without excessive extension, thus reducing the computational load of subsequent intersection operations. All extended vectors are stored in the extended vector set and marked as unprocessed.
[0107] When implementing S606, the analytical geometry intersection method is used to construct the linear equations for the extended vector and the boundary vector, solve the intersection points of the equations, add only a single intersection point to the intersection point set, and mark the extended vector that has been processed to avoid repeated calculations.
[0108] When implementing S607, the distance between the intersection point and the starting point of the extended vector is calculated using the Euclidean distance formula. The closest non-overlapping intersection points are selected, and the candidate point numbers are accurately marked according to the type and direction of the extended vector. The triplet consisting of the intersection point coordinates and the number is then stored in the candidate placement point set. If the intersection point set only contains overlapping points, it is skipped directly and no candidate points are generated.
[0109] When S608-S610 is implemented, a loop traversal mechanism is used. First, all extended vectors are traversed to complete the intersection and candidate point generation. Then, all free regions are traversed to complete the vectorization and candidate point extraction. This process continues until all extended vectors and free regions are processed. The final set of candidate placement points is a valid set after deduplication, with no duplicate triples.
[0110] S700: Determine whether there are any parts in the parts set that are in an unattended placement state and need to be arranged; if so, return to step S300; otherwise, proceed to step S800.
[0111] During implementation, the status flags of the parts set are read in real time to quickly determine whether there are any parts that have not been attempted to be placed. This determination is a pure logical operation without geometric calculations, ensuring efficiency. If a part exists, the process returns directly to S300 to continue processing the next part, without repeating previous steps, reducing redundant operations. If no part exists, the S800 round of determination is triggered. Status determination is performed immediately after each part is placed to ensure continuous processing of parts in the current round of nesting, improving the execution efficiency of the current round of nesting.
[0112] S800: Determine whether the unplaced parts counter is greater than zero and the current layout round is less than the preset maximum layout round; if so, increment the layout round counter and return to step S200; otherwise, proceed to step S900.
[0113] During implementation, a dual condition check is performed. The layout round counter is incremented by 1 and the process returns to S200 to reset the state for the next round only if both conditions are met simultaneously: the unplaced part counter is greater than 0 and the current layout round is less than the preset maximum layout round. If either condition is not met, the process directly triggers S900 to output the result. The dual condition check avoids invalid round iterations. If all parts have been placed or the maximum round has been reached, the iteration is terminated immediately to reduce computational resource consumption.
[0114] S900: Output the nesting results.
[0115] During implementation, in addition to outputting precise placement information for each part, the system can simultaneously calculate and output core layout indicators to meet the quantitative needs of industrial applications. The output results support multi-format storage and visualization, generating CAD-compatible geometric files, tabular parameter files, and visual layout graphics for easy execution of subsequent industrial cutting. This multi-dimensional output allows the layout results to not only guide actual production but also enable quantitative evaluation of layout effectiveness, adapting to the production and management needs of enterprises.
[0116] The candidate placement point consists of two-dimensional coordinates (x, y) and candidate point number k (k∈{1,2,3,4}), represented as a triple (x, y, k), where the candidate point number is used to indicate the corner number that the rectangular part to be laid out should be aligned with when it is placed.
[0117] A method for identifying the corners of rectangular parts: A rectangular part has four corners, and its geometric center is defined as the intersection of the diagonals; each of the four corners is assigned a unique corner number, which is determined solely by the relative spatial orientation of the corner with respect to the geometric center; in a local coordinate system established with the geometric center as the origin: the corner located to the lower left of the geometric center is numbered 1; the corner located to the lower right of the geometric center is numbered 2; the corner located to the upper right of the geometric center is numbered 3; the corner located to the upper left of the geometric center is numbered 4; when placing a part at a candidate placement point with candidate point number k, the corner with corner number k must be aligned to the coordinates of that candidate placement point.
[0118] An automatic nesting system based on discrete space search includes a parameter acquisition module, a state reset module, a scheme generation module, a part layout module, a priority adjustment module, a candidate point generation module, a first judgment module, a second judgment module, and a result output module.
[0119] The parameter acquisition module is used to acquire the layout input parameters and automatically assign the initial priority of each part based on the layout input parameters. The layout input parameters include the size of the raw material plate, the length and width of each part to be laid out, and the preset maximum number of layout rounds.
[0120] The status reset module is used to reset the layout operation status, including marking all parts to be laid out as unattended, resetting the unplaced parts counter to zero, clearing the candidate placement point set, and sorting the parts set in descending order according to the current priority of each part.
[0121] The scheme generation module is used to select the highest priority parts to be placed that have not been attempted to be placed, traverse the set of candidate placement points to generate multiple placement candidate schemes, each scheme includes the coordinates, number, rotation angle and corresponding contact perimeter of the candidate placement point, and marks the part as having been attempted to be placed.
[0122] The part layout module is used to select the placement scheme with the largest contact perimeter when there are placement candidate schemes with a contact perimeter greater than zero, and to place the part on the raw material plate accordingly.
[0123] The priority adjustment module is used to raise the priority of the corresponding part by one level when the maximum contact perimeter is zero, increment the counter of the unplaced part by 1, and skip its placement operation in the current round of layout.
[0124] The candidate point generation module is used to generate a new set of candidate placement points based on the current layout.
[0125] The first judgment module is used to determine whether there are any parts to be arranged in the parts set that are in an unattended placement state. If they exist, the scheme generation module is triggered to continue working; if they do not exist, the second judgment module is triggered to work.
[0126] The second judgment module is used to determine whether the unplaced part counter is greater than zero and the current layout round is less than the preset maximum layout round. If so, the layout round counter is incremented and the state reset module is triggered to work again. Otherwise, the result output module is triggered to work.
[0127] The results output module is used to output the sorting results.
[0128] This invention was developed based on the following scenario:
[0129] The primary application of this invention is to cut parts from a rectangular sheet of fixed size with the highest possible utilization rate. Specifically, it is used to cut wooden boards, steel sheets, and glass sheets with the highest possible utilization rate.
[0130] For example, arranging 30 irregularly shaped parts on a rectangular sheet of material measuring 11700mm x 1920mm, with a minimum spacing of 15mm between parts, ensures high utilization of the sheet. Referring to Siemens' layout software, the 30 parts should be able to be arranged on the same sheet. When more parts are added, it supports layout on multiple sheets. Generally, a relatively ideal layout can be generated for 30 parts within one minute. Figure 5 This is the output of Siemens typesetting software.
[0131] The above is just a test case to verify the algorithm. In actual use, the size of the board, the specifications of the parts, the number of parts, and the minimum spacing between parts can all be configured.
[0132] Based on this invention, the following algorithm metrics can be provided:
[0133] 1. Material Utilization Rate (U): Sum of part areas / sheet material area; maximize utilization. 2. Scrap Rate: 1-U; minimize scrap rate. 3. Part Spacing: During cutting, to ensure cutting accuracy and avoid damage, a minimum spacing of 15mm needs to be maintained between parts; configurable. 4. Calculation Efficiency: Siemens layout software can generally iterate to an ideal solution in about 10 seconds; this indicator is not critical, and about 1 minute is acceptable. 5. Part Orientation Constraints: None.
Claims
1. An automatic nesting method based on discrete space search, characterized in that: The method includes the following steps: S100: Obtain the layout input parameters and automatically assign the initial priority of each part based on the layout input parameters; the layout input parameters include the size of the raw material plate, the length and width of each part to be laid out, and the preset maximum layout round; S200: Reset the layout operation status, including marking all parts to be laid out as unattended, resetting the unplaced parts counter to zero, clearing the candidate placement point set, and sorting the parts set in descending order according to the current priority of each part; S300: Select the highest priority part to be placed that has not been attempted to be placed, traverse the set of candidate placement points to generate multiple placement candidate schemes, each scheme including the coordinates, number, rotation angle and corresponding contact perimeter of the candidate placement point, and mark the part as having been attempted to be placed. S400: If there are candidate placement schemes with a contact perimeter greater than zero, select the scheme with the largest contact perimeter and place the part on the raw material plate accordingly. S500: If the maximum contact perimeter is zero, it indicates that there is no effective placement scheme. The priority of the part is increased by one level, the unplaced part counter is incremented by 1, and its placement operation in this round of layout is skipped. S600: Based on the current layout, generate a new set of candidate placement points; S700: Determine whether there are any parts to be arranged in the parts set that are in an unattended placement state; if so, return to step S300; otherwise, proceed to step S800. S800: Determine whether the unplaced parts counter is greater than zero and the current layout round is less than the preset maximum layout round; if so, increment the layout round counter and return to step S200; otherwise, proceed to step S900. S900: Output the nesting results.
2. The automatic nesting method based on discrete space search according to claim 1, characterized in that: The candidate placement point consists of two-dimensional coordinates (x, y) and candidate point number k (k∈{1,2,3,4}), represented in triplet form as (x, y, k), where the candidate point number is used to indicate the corner number that the rectangular part to be arranged should be aligned with when it is placed.
3. The automatic nesting method based on discrete space search according to claim 2, characterized in that: The method for identifying the corners of the rectangular part; the rectangular part has four corners, and its geometric center is defined as the intersection of the diagonals; Each of the four corners is assigned a unique corner number, which is determined solely by the relative spatial orientation of the corner relative to the geometric center. In a local coordinate system established with the geometric center as the origin: the corner located to the lower left of the geometric center is numbered 1; the corner located to the lower right of the geometric center is numbered 2; the corner located to the upper right of the geometric center is numbered 3; and the corner located to the upper left of the geometric center is numbered 4. When placing a part at a candidate placement point with candidate point number k, the corner with corner number k must be aligned to the coordinates of that candidate placement point.
4. The automatic nesting method based on discrete space search according to claim 1, characterized in that: In S100, the layout input parameters are obtained, and the initial priority of each part is automatically assigned based on the layout input parameters. The layout input parameters include the size of the raw material plate, the length and width of each part to be laid out, and the preset maximum layout round. The method is as follows: the layout input parameters are obtained, including the length L and width W of the raw material plate, the length and width of each part to be laid out, and the total number of parts n; the set of parts is sorted in descending order based on the area of each part, and an initial priority is assigned, where the part with the largest area has a priority of n, the next is n−1, ..., and the part with the smallest area has a priority of 1; the layout round counter is initialized to 0, and the preset maximum layout round is set to 3n.
5. The automatic nesting method based on discrete space search according to claim 1, characterized in that: In S200, the nesting operation state is reset, including marking all parts to be nested as unattended, resetting the unplaced parts counter to zero, sorting the parts set in descending order according to the current priority of each part, clearing the current nesting layout, and initializing the candidate placement point set as follows: marking all parts to be nested as unattended, resetting the unplaced parts counter to zero, clearing the nesting layout, and initializing the candidate placement point set to a set containing four candidate placement points: {(0,0,1),(L,0,2),(L,W,3),(0,W,4)}; and sorting the parts set in descending order according to the current priority of each part.
6. The automatic nesting method based on discrete space search according to claim 1, characterized in that: In S300, select the highest priority part that has not been placed yet. Traverse the set of candidate placement points to generate multiple placement candidate schemes. Each scheme includes a candidate placement point, rotation angle and corresponding contact perimeter. The method to mark the part as having been placed is: select the highest priority part that is currently in the untried placement state. For this part, try 0° and 90° rotation directions in turn, and for each rotation direction, align it with each candidate placement point in the candidate placement point set; for each rotation-candidate placement point combination, if the part overlaps or exceeds the boundary of the raw material plate after placement, then set the contact perimeter of the placement scheme to 0; otherwise, calculate the contact perimeter of the scheme, where the contact perimeter is the sum of the lengths of the line segments that contact the boundary of the rectangular part with the already placed part and the boundary of the raw material plate.
7. The automatic nesting method based on discrete space search according to claim 1, characterized in that: In S400: If there are placement candidate schemes with a contact perimeter greater than zero, the scheme with the largest contact perimeter is selected, and the part is laid out on the raw material plate accordingly. The method is as follows: In the placement candidate schemes, select the candidate placement point and direction that maximizes the contact perimeter, rotate the rectangle to the corresponding direction, and align the corner of the rectangular part with the corner number corresponding to the candidate placement point with the candidate placement point, and lay out the part on the raw material plate.
8. The automatic nesting method based on discrete space search according to claim 1, characterized in that: In S500: If the maximum contact perimeter is zero, it indicates that there is no effective placement scheme. The priority of the part is increased by one level, the unplaced part counter is incremented by 1, and its placement operation in this round of layout is skipped.
9. The automatic nesting method based on discrete space search according to claim 1, characterized in that: In S600, based on the current layout, a new set of candidate placement points is generated using the following method: S601: Clear all candidate placement points and their numbers in the current candidate placement point set, and generate a free area set based on the current layout of rectangular parts. The free area set is used to represent the available area in the current raw material plate that has not yet been occupied by any parts. S602: Select a free region that has not yet been vectorized from the set of free regions, mark it as vectorized, and extract its outer boundary to construct a counterclockwise directed boundary vector sequence; wherein, the counterclockwise directed boundary vector sequence is a vector sequence formed by traversing adjacent boundary points in a counterclockwise direction along the outer boundary of the free region, representing the directed line segment between each pair of adjacent boundary points as a vector, and arranging them in the traversal order; S603: Combine the vectors in the directed boundary vector sequence in pairs in order to form a set of continuous boundary vector pairs; wherein each vector pair consists of a first vector and a second vector: the first vector is the i-th vector in the sequence, and the second vector is the (i+1)-th vector (i=1,2,…,m−1); for the last vector pair, the first vector is the m-th vector in the sequence, and the second vector is the 1-th vector; S604: Traverse the set of continuous boundary vector pairs. If the direction of the first vector of the vector pair is consistent with the negative direction of the Y-axis and the direction of the second vector is consistent with the positive direction of the X-axis, then take the endpoint of the first vector as a candidate placement point, mark the number of the candidate placement point as 1, and store the position and number of the candidate placement point in the candidate placement point set. If the direction of the first vector of the vector pair is consistent with the positive direction of the X-axis and the direction of the second vector is consistent with the positive direction of the Y-axis, then the endpoint of the first vector is taken as a candidate placement point, and the candidate placement point is marked with the number 2. The position and number of the candidate placement point are stored in the candidate placement point set. If the direction of the first vector of the vector pair is consistent with the positive direction of the Y-axis and the direction of the second vector is consistent with the negative direction of the X-axis, then the endpoint of the first vector is taken as a candidate placement point, and the candidate placement point is marked with the number 3. The position and number of the candidate placement point are stored in the candidate placement point set. If the direction of the first vector of the vector pair is consistent with the negative direction of the X-axis and the direction of the second vector is consistent with the negative direction of the Y-axis, then the endpoint of the first vector is taken as a candidate placement point, and the candidate placement point is marked with the number 4. The position and number of the candidate placement point are stored in the candidate placement point set. S605: Traverse the boundary vector set and perform bidirectional extension processing on each boundary vector: Traverse each boundary vector in the boundary vector set and perform bidirectional extension processing on it: Starting from the end point of the vector, extend it along its direction to generate a positive extension vector; starting from the beginning point of the boundary vector, extend it in the opposite direction to generate a negative extension vector; store them in the extension vector set, wherein the length of the extension is sufficient to ensure that the extension vector exceeds the boundary of the free area, i.e., the free area selected in step S602, for use in the subsequent generation of candidate placement points; S606: Select an unprocessed extended vector from the set of extended vectors and mark it as processed; for this extended vector, perform geometric intersection operations with each boundary vector in the set of boundary vectors in turn; if the result of the intersection operation is an intersection point, rather than a line segment or a coincident edge, then add the intersection point to the intersection point set. S607: If the intersection point set contains only points that coincide with the starting point of the extended vector, skip this step; otherwise, select the point from the intersection point set that is closest to the starting point of the extended vector and does not coincide with that starting point, and add the coordinates of that point and its corresponding candidate placement point number to the candidate placement point set. The method for marking the candidate placement point number is as follows: If the extended vector is a positive extended vector and its direction is along the negative Y-axis, then the corresponding candidate placement point is marked as 1; if it is an inverse extended vector and its direction is along the negative Y-axis, then the corresponding candidate placement point is marked as 2. If the extended vector is a positive extended vector and its direction is along the positive Y-axis, then the corresponding candidate placement point is marked as 3; if it is an inverse extended vector and its direction is along the positive Y-axis, then the corresponding candidate placement point is marked as 4. If the extended vector is a positive extended vector and its direction is along the negative X-axis, then the corresponding candidate placement point is marked as 4; if it is an inverse extended vector and its direction is along the negative X-axis, then the corresponding candidate placement point is marked as 1. If the extended vector is a positive extended vector and its direction is along the positive X-axis, then the corresponding candidate placement point is marked as 2; if it is an inverse extended vector and its direction is along the positive X-axis, then the corresponding candidate placement point is marked as 3. S608: If there are unprocessed extended vectors in the set of extended vectors, jump to S606; otherwise, jump to S609. S609: If there are unvectorized free regions in the set of free regions, jump to S602; otherwise, jump to S610. S610: Obtain the set of candidate placement points.
10. An automatic nesting system based on discrete space search, employing the automatic nesting method based on discrete space search as described in claim 1, characterized in that, The system includes a parameter acquisition module, a state reset module, a scheme generation module, a part layout module, a priority adjustment module, a candidate point generation module, a first judgment module, a second judgment module, and a result output module. The parameter acquisition module is used to acquire the layout input parameters and automatically allocate the initial priority of each part based on the layout input parameters. The layout input parameters include the size of the raw material plate, the length and width of each part to be laid out, and the preset maximum number of layout rounds. The state reset module is used to reset the layout operation state, including marking all parts to be laid out as unattended, resetting the unplaced parts counter to zero, clearing the candidate placement point set, and sorting the parts set in descending order according to the current priority of each part. The scheme generation module is used to select the highest priority part to be placed that has not been attempted to be placed, traverse the candidate placement point set to generate multiple placement candidate schemes, each scheme including the candidate placement point coordinates, number, rotation angle and corresponding contact perimeter, and mark the part as having been attempted to be placed. The part layout module is used to select the placement scheme with the largest contact perimeter when there are placement candidate schemes with a contact perimeter greater than zero, and to place the part on the raw material plate accordingly. The priority adjustment module is used to raise the priority of the corresponding part by one level when the maximum contact perimeter is zero, increment the counter of the unplaced part by 1, and skip its placement operation in the current round of layout. The candidate point generation module is used to generate a new set of candidate placement points based on the current layout. The first judgment module is used to determine whether there are any parts to be arranged in the parts set that are in an unattended placement state. If there are, the scheme generation module is triggered to continue working; if there are no, the second judgment module is triggered to work. The second judgment module is used to determine whether the unplaced parts counter is greater than zero and the current layout round is less than the preset maximum layout round. If so, the layout round counter is incremented and the state reset module is triggered to work again. Otherwise, the result output module is triggered to work. The result output module is used to output the sorting results.