CAD drawing batch typesetting processing method
Through the batch layout processing method of CAD drawings, the historical layout library and similarity matching technology are used to solve the material waste and time consumption caused by irregular sheet cutting, and efficient sheet cutting printing is achieved.
Patent Information
- Application Number
- CN202411160496.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-12-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the garment and textile industry, due to irregular cutting of sheets, manual printing materials are wasteful and time-consuming, which reduces the efficiency of cutting and printing.
Using CAD drawing batch layout processing method, by obtaining the required layout methods and piece cutting information of users, find the selected historical layout with high similarity from the preset historical layout library, correct it to match the number of pieces required, and map the piece cutting to blanks In the template, determine the appropriate edit template to reduce material waste and save time.
It effectively reduces the waste of printing materials, improves the efficiency of cutting and printing, saves time and improves production efficiency compared to manual layout.
Smart Images

Figure CN119150387A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of drawing making, and in particular to a method for batch typesetting of CAD drawings. Background Art
[0002] With the development of mapping software and the informatization of the textile industry, the use of CAD-related products for drawing drawings in the clothing and textile industry is becoming more and more common. The representative one is clothing CAD, which draws the pieces of clothing on clothing CAD to improve production efficiency. At present, after drawing the pieces in clothing CAD, the pieces need to be typeset and printed out, but due to the irregularity of the pieces, a lot of printed materials are wasted. At present, the pieces are typeset manually, but manual typesetting leads to serious waste of printing materials and is time-consuming, thereby reducing the efficiency of piece printing. Summary of the invention
[0003] In order to improve typesetting efficiency, shorten typesetting time and reduce waste of printed materials after typesetting, the present application provides a method for batch typesetting processing of CAD drawings.
[0004] In the first aspect, the present application provides a method for batch typesetting of CAD drawings, which adopts the following technical solution: A method for batch typesetting of CAD drawings, comprising: Obtain the layout mode, number of pieces and first contour information of multiple current pieces required by the user, and search for a historical layout to be selected that is consistent with the layout mode from a preset historical layout library; Extracting second contour information of each historical piece from the plurality of historical layouts to be selected, and calculating a first similarity between each current piece and each historical piece based on the first contour information and the second contour information; Modifying each of the historical layouts to be selected based on the number of items to obtain a modified historical layout to be selected; Determine a first number of historical pieces whose similarity of the plurality of current pieces reaches a preset similarity threshold in each revised historical layout to be selected, and determine the revised historical layout to be selected whose number reaches the preset threshold as the target historical layout; Determine a target current piece whose first similarity with the historical pieces in each target historical layout reaches a preset similarity threshold from the multiple current pieces, and map the target current piece onto a blank template according to the position of the corresponding historical piece in the target historical layout to obtain an edit template, wherein the blank template is obtained by deleting the historical pieces in the target historical layout; Determine the blank area except the target current cutout in each edit template and the overlapping area between the target current cutouts; Determine a target editing template based on the first number, the blank area, and the overlapping area of the target current pieces; The remaining pieces of the plurality of pieces except the target current piece are added to the target editing template to obtain a final layout.
[0005] By adopting the above technical scheme, the historical layout to be selected is first determined according to the required layout method, and then the historical layout to be selected is corrected according to the required number of pieces to obtain the corrected historical layout to be selected. The historical layout to be selected is the layout that uses the least printing material, has the least blank area and the smallest area. Therefore, determining the appropriate layout from the historical layout to be selected and adding the current piece to the corresponding template can reduce material waste. Then, according to the similarity and the preset quantity threshold, the target historical layout with the largest number and the similarity to the current piece reaching the preset similarity threshold is determined, and then the corresponding current piece is mapped to the blank template corresponding to each target historical layout to obtain an editing template, and the overlapping area and the blank area in the editing template are determined. The quality and suitability of each editing template are comprehensively judged according to the first quantity, the blank area and the overlapping area, so as to obtain the target editing template, and finally the remaining pieces are added to the target editing template, which saves more time than manual typesetting.
[0006] In another possible implementation, determining the target editing template based on the first number of the target current pieces, the blank area, and the overlapping area includes: determining a second number of overlapping regions in each edit template and an overlapping area of each overlapping region; determining an overlap area average based on the overlap area and the second quantity; determining a ratio of the first amount to a second amount; determining a third number of blank areas in each edit template and a blank area of each blank area; determining a blank area average value based on the blank area and a third number, and correcting the blank area average value based on the first number to obtain a corrected blank area average value; determining the aspect ratio of each blank area and determining the average aspect ratio; Determine a first score for each edited template based on the overlap area average value and the ratio, and determine a second score for each edited template based on the corrected blank area average value and the average aspect ratio; The total score of each editing template is determined based on the first score, the second score and the corresponding coefficients, and the target editing template is determined based on the total score.
[0007] In another possible implementation, the adding the remaining pieces of the plurality of pieces except the target current piece to the target editing template to obtain a final layout includes: Determine at least one target overlapping region of the target current cutout that is overlapped in the target editing template and an overlapping area of each target overlapping region, and an associated blank region of an edge of the target current cutout that is overlapped; Determine the outline of each target overlap region and the total overlap area of all target overlap regions; Determine a second similarity between the contour of each target overlapping region and each associated blank region, and determine an average value of the second similarities of each associated blank region; Determine the target-associated blank region whose blank region area reaches the total overlapping area and whose average value of the second similarity is the highest; Determine the displacement strategy and rotation strategy of the target current cut piece with overlap based on the outline of the target associated blank area, the first outline information of the target current cut piece, and the outline of the target overlapping area; The target current piece that is overlapped is moved according to the displacement strategy and the rotation strategy to obtain a moved target editing template; The remaining pieces of the plurality of pieces except the target current piece are added to the moved target editing template.
[0008] In another possible implementation, adding the remaining pieces of the plurality of pieces except the target current piece to the moved target editing template includes: Determine the current blank area in the target edit template after the move; Calculate the third similarity between each remaining piece and each current blank area; Each remaining piece is added to the current blank area with the third highest similarity.
[0009] In another possible implementation, adding the remaining pieces of the plurality of pieces except the target current piece to the moved target editing template includes: Determine a plurality of piece combinations from the remaining pieces based on the area of any current blank area, wherein the total area of each piece combination is not greater than the area of any current blank area; Each piece combination is mapped to any of the current blank areas to determine a target piece combination, and the target piece combination is added to any of the current blank areas, wherein the target piece combination does not overlap with an edge of any of the current blank areas after being mapped to the any of the current blank areas, and an area of any of the current blank areas is minimum to a total area of the target piece combination.
[0010] In another possible implementation, the method further includes: If there are remaining current pieces that cannot be added to the target editing template, determining remaining blank areas in the final layout; Determining a target remaining blank area from the remaining blank areas based on the contour and area of the remaining current cut piece; The target remaining blank areas are spliced to obtain a spliced blank area, and the outline of the remaining current cut pieces is printed in the spliced blank area.
[0011] In another possible implementation, the method further includes: The glue sticking device is controlled to add adhesive material on the remaining blank area of the target.
[0012] In a second aspect, the present application provides a CAD drawing batch typesetting processing device, which adopts the following technical solution: A CAD drawing batch typesetting processing device, comprising: A first acquisition module is used to acquire the typesetting method and number of pieces required by the user and first contour information of multiple current cut pieces to be typeset, and search for a candidate historical typesetting that is consistent with the typesetting method from a preset historical typesetting library; A calculation module, configured to extract the second contour information of each historical piece from the plurality of historical typeset to be selected, and calculate a first similarity between each current piece and each historical piece based on the first contour information and the second contour information; A correction module, used for correcting each history typesetting to be selected based on the number of items, to obtain a corrected history typesetting to be selected; A first determination module is used to determine a first number of historical pieces whose similarity of the plurality of current pieces reaches a preset similarity threshold in each revised historical layout to be selected, and determine the revised historical layout to be selected whose number reaches the preset threshold as the target historical layout; A mapping module is used to determine a target current piece whose first similarity with the historical pieces in each target historical layout reaches a preset similarity threshold from the multiple current pieces, and map the target current piece on a blank template according to the position of the corresponding historical piece in the target historical layout to obtain an edit template, wherein the blank template is obtained by deleting the historical pieces in the target historical layout; The second determination module is used to determine the blank area except the target current cut piece in each editing template and the overlapping area between the target current cut pieces; A third determination module, configured to determine a target editing template based on the first number, the blank area, and the overlapping area of the target current cutout; The adding module is used to add the remaining pieces of the multiple pieces except the target current piece to the target editing template to obtain a final layout.
[0013] By adopting the above technical solution, the first acquisition module obtains the required typesetting method, number of pieces and first contour information of multiple current cut pieces, searches for the selected historical typesetting that is consistent with the typesetting method from the preset historical typesetting library, the calculation module extracts the second contour information of each historical cut piece from the multiple selected historical typesettings, and calculates the first similarity between each current cut piece and each historical cut piece based on the first contour information and the second contour information, the correction module then corrects the selected historical typesetting according to the required number of pieces to obtain the corrected selected historical typesetting, and the selected historical typesetting is the typesetting with the least printing material, the least blank area and the smallest area, so the appropriate typesetting is determined from the selected historical typesetting and printed on the corresponding template Adding the current piece can reduce material waste. The first determination module then determines the target historical layout with the largest number of pieces having a similarity to the current piece that reaches the preset similarity threshold based on the similarity and the preset quantity threshold. Then the mapping module maps the corresponding current piece to the blank template corresponding to each target historical layout to obtain an editing template, and the second determination module determines the overlapping area and blank area in the editing template. The third determination module comprehensively determines the quality and suitability of each editing template based on the first quantity, blank area and overlapping area, thereby obtaining the target editing template. Finally, the adding module adds the remaining pieces to the target editing template, which saves more time than manual layout.
[0014] In another possible implementation, when determining the target editing template based on the first number of the target current pieces, the blank area, and the overlapping area, the third determining module is specifically configured to: determining a second number of overlapping regions in each edit template and an overlapping area of each overlapping region; determining an overlap area average based on the overlap area and the second quantity; determining a ratio of the first amount to a second amount; determining a third number of blank areas in each edit template and a blank area of each blank area; determining a blank area average value based on the blank area and a third number, and correcting the blank area average value based on the first number to obtain a corrected blank area average value; determining the aspect ratio of each blank area and determining the average aspect ratio; Determine a first score for each edited template based on the overlap area average value and the ratio, and determine a second score for each edited template based on the corrected blank area average value and the average aspect ratio; The total score of each editing template is determined based on the first score, the second score and the corresponding coefficients, and the target editing template is determined based on the total score.
[0015] In another possible implementation, when the adding module adds the remaining pieces of the multiple pieces except the target current piece to the target editing template to obtain the final layout, it is specifically used to: Determine at least one target overlapping region of the target current cutout that is overlapped in the target editing template and an overlapping area of each target overlapping region, and an associated blank region of an edge of the target current cutout that is overlapped; Determine the outline of each target overlap region and the total overlap area of all target overlap regions; Determine a second similarity between the contour of each target overlapping region and each associated blank region, and determine an average value of the second similarities of each associated blank region; Determine the target-associated blank region whose blank region area reaches the total overlapping area and whose average value of the second similarity is the highest; Determine the displacement strategy and rotation strategy of the target current cut piece with overlap based on the outline of the target associated blank area, the first outline information of the target current cut piece, and the outline of the target overlapping area; The target current piece that is overlapped is moved according to the displacement strategy and the rotation strategy to obtain a moved target editing template; The remaining pieces of the plurality of pieces except the target current piece are added to the moved target editing template.
[0016] In another possible implementation, when the adding module adds the remaining pieces of the multiple pieces except the target current piece to the moved target editing template, it is specifically used to: Determine the current blank area in the target edit template after the move; Calculate the third similarity between each remaining piece and each current blank area; Each remaining piece is added to the current blank area with the third highest similarity.
[0017] In another possible implementation, when the adding module adds the remaining pieces of the multiple pieces except the target current piece to the moved target editing template, it is specifically used to: Determine a plurality of piece combinations from the remaining pieces based on the area of any current blank area, wherein the total area of each piece combination is not greater than the area of any current blank area; Each piece combination is mapped to any of the current blank areas to determine a target piece combination, and the target piece combination is added to any of the current blank areas, wherein the target piece combination does not overlap with an edge of any of the current blank areas after being mapped to the any of the current blank areas, and an area of any of the current blank areas is minimum to a total area of the target piece combination.
[0018] In another possible implementation, the device further includes: A fourth determination module, configured to determine a remaining blank area in the final layout when there are remaining current pieces that cannot be added to the target editing template; a fifth determining module, configured to determine a target remaining blank area from the remaining blank areas based on the contour and area of the remaining current cut piece; The printing module is used for splicing the target remaining blank areas to obtain spliced blank areas, and printing the outline of the remaining current cut pieces into the spliced blank areas.
[0019] In another possible implementation, the device further includes: The control module allows the user to control the glue sticking device to add adhesive material to the remaining blank area of the target.
[0020] In a third aspect, the present application provides an electronic device, which adopts the following technical solution: An electronic device, comprising: at least one processor; Memory; At least one application, wherein at least one application is stored in a memory and configured to be executed by at least one processor, and at least one is configured to: execute a CAD drawing batch typesetting processing method shown in any possible implementation of the first aspect.
[0021] In a fourth aspect, the present application provides a computer-readable storage medium, which adopts the following technical solution: A computer-readable storage medium, when the computer program is executed in a computer, enables the computer to execute a CAD drawing batch typesetting processing method as described in any one of the first aspects.
[0022] In summary, the present application includes at least one of the following beneficial technical effects: First, determine the historical layout to be selected according to the required layout method, and then modify the historical layout to be selected according to the required number of pieces to obtain the modified historical layout to be selected. The historical layout to be selected is the layout that uses the least printing material, has the least blank area and the smallest area. Therefore, determining the appropriate layout from the historical layout to be selected and adding the current piece to the corresponding template can reduce material waste. Then, according to the similarity and the preset quantity threshold, determine the target historical layout that has the largest number and the similarity with the current piece to reach the preset similarity threshold, and then map the corresponding current piece to the blank template corresponding to each target historical layout to obtain an editing template, and determine the overlapping area and blank area in the editing template. According to the first number, blank area and overlapping area, the quality and suitability of each editing template are comprehensively judged to obtain the target editing template, and finally add the remaining pieces to the target editing template, which saves more time than manual typesetting. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a flow chart of a method for batch typesetting of CAD drawings according to an embodiment of the present application.
[0024] Figure 2 It is a structural schematic diagram of a CAD drawing batch typesetting processing device according to an embodiment of the present application.
[0025] Figure 3 It is a structural schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0026] The present application is further described in detail below in conjunction with the accompanying drawings.
[0027] After reading this specification, those skilled in the art may make non-creative modifications to this embodiment as needed, but such modifications are protected by patent law as long as they are within the scope of the claims of this application.
[0028] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0029] In addition, the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article, unless otherwise specified, generally means that the associated objects before and after are in an "or" relationship.
[0030] The embodiments of the present application are further described in detail below in conjunction with the drawings in the specification.
[0031] The embodiment of the present application provides a method for batch typesetting of CAD drawings, which is executed by an electronic device, which can be a server or a terminal device, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal device can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc., but is not limited thereto. The terminal device and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiment of the present application. Figure 1 As shown, the method includes step S101, step S102, step S103, step S104, step S105, step S106, step S107 and step S108, wherein: S101, obtaining the layout method and number of pieces required by the user and first contour information of multiple current cut pieces to be laid out, and searching for a candidate historical layout that is consistent with the layout method from a preset historical layout library.
[0032] For the embodiments of the present application, typesetting methods include ordinary mixed typesetting, single-piece segmented typesetting, etc., and users can select typesetting methods on the visual operation interface according to their needs. Similarly, it is set on the visual operation interface according to the required number of pieces. After the user draws each cut piece on the electronic device, the electronic device stores the cut piece. The electronic device performs edge detection on the cut piece to obtain the first contour information of the cut piece, and stores multiple historical typesettings corresponding to each mixed method in the local storage medium of the server or the electronic device, that is, a preset historical typesetting library, and each historical typesetting is the typesetting with the least remaining blank area and the most saved printing materials.
[0033] S102 , extracting second contour information of each historical piece from a plurality of historical layouts to be selected, and calculating a first similarity between each current piece and each historical piece based on the first contour information and the second contour information.
[0034] For the embodiment of the present application, similarly, the electronic device performs edge detection on the image of each historical layout to be selected to obtain the second contour information of each historical piece, or each historical layout to be selected corresponds to the second contour information of each historical piece, thereby extracting the second contour information of each historical piece. In order to determine the historical piece closest to each current piece, the electronic device calculates the first similarity between the first contour information of each current piece and the second contour information of each historical piece. Specifically, the calculation of the first similarity can be calculated by the structural similarity metric (SSIM). It can also be calculated by cosine similarity, that is, the image is represented as a vector, and the similarity of the two images is characterized by calculating the cosine distance between the vectors.
[0035] S103, modifying each of the historical layouts to be selected based on the number of items to obtain a modified historical layout to be selected.
[0036] For the embodiments of the present application, the number of items in each historical layout to be selected may be different from the number of items required by the user. Therefore, the electronic device corrects and supplements each historical layout to be selected according to the number of items set by the user. Specifically, the correction can be made through an algorithm or by finding the layout rules in the historical layout to be selected, thereby obtaining a corrected historical layout to be selected. The corrected historical layout to be selected is also the template that saves the most printing materials.
[0037] S104, determining a first number of historical pieces whose similarity of the multiple current pieces reaches a preset similarity threshold in each revised historical layout to be selected, and determining the revised historical layout to be selected whose number reaches the preset threshold as the target historical layout.
[0038] For the embodiment of the present application, assuming that there are 10 current pieces and there are 5 corrected historical layouts to be selected, assuming that the preset similarity is 90%, the electronic device determines the first number of 10 pieces whose similarity reaches 90% in each of the corrected historical layouts to be selected, assuming that 6 of the 10 current pieces reach 90% in the corrected historical layout a to be selected, that is, the first number in the corrected historical layout a to be selected is 6; assuming that 3 of the 10 current pieces reach 90% in the corrected historical layout b to be selected, that is, the first number in the corrected historical layout a to be selected is 6. The first quantity in the candidate historical layout b is 3; assuming that 5 of the 10 current pieces reach 90% in the revised candidate historical layout c, the first quantity in the revised candidate historical layout c is 5; assuming that 7 of the 10 current pieces reach 90% in the revised candidate historical layout d, the first quantity in the revised candidate historical layout d is 7; assuming that 4 of the 10 current pieces reach 90% in the revised candidate historical layout e, the first quantity in the revised candidate historical layout a is 4.
[0039] The more the first quantity of a certain revised historical layout to be selected is, the closer the pieces in the revised historical layout to be selected are to the current pieces, and the more suitable it is to layout the current pieces according to the revised historical layout to be selected. Therefore, a preset quantity threshold is set for the first quantity. Assuming that the preset quantity threshold is 5, the electronic device compares the first quantity of each revised historical layout to be selected with the preset quantity threshold of 5. The preset quantity threshold is used as a dividing point for whether the first quantity is large. Therefore, the revised historical layout to be selected is screened according to the preset quantity threshold, and a revised historical layout to be selected whose first quantity reaches the preset quantity threshold is obtained, that is, the target historical layout.
[0040] S105, determining a target current piece from multiple current pieces whose first similarity with the historical pieces in each target historical layout reaches a preset similarity threshold, and mapping the target current piece on the blank template according to the position of the corresponding historical piece in the target historical layout to obtain an editing template.
[0041] Among them, the blank template is obtained by deleting the historical clips in the target historical typesetting.
[0042] For the embodiment of the present application, in order to better typeset the current clip, the electronic device deletes all historical clips in the target historical typesetting to obtain a blank template. The electronic device retains the position of each clip in the target historical typesetting, and after determining the target historical typesetting, the current clip that reaches the similarity threshold is most suitable for typeset in the target historical typesetting first, so the electronic device maps the target current clip that reaches the similarity threshold in the blank template according to the position of the corresponding historical clip, thereby obtaining an edit template.
[0043] S106, determining the blank area except the target current cutout in each editing template and the overlapping area between the target current cutouts.
[0044] For the embodiment of the present application, after the electronic device maps the target current pieces to the blank template, there may be overlapping areas between the target current pieces, so the electronic device determines the overlapping areas. Similarly, there are blank areas in the edit template, and the blank areas are used to add the remaining pieces in the current piece, so the electronic device determines the blank areas in the edit template.
[0045] S107 , determining a target editing template based on the first number of target current pieces, blank areas, and overlapping areas.
[0046] For the embodiment of the present application, in order to determine the most suitable target editing template from the editing template, the more the first number of selected historical layouts corresponding to the editing template reaches the similarity threshold, the more suitable the editing template is as the target editing template, and the more computing power is saved and faster when mapping and adding the current cut piece. The larger the blank area and the more blank areas, the more suitable it is as the target editing template, and the smaller the overlapping area and the fewer the number of overlapping areas, the more suitable it is as the target editing template. Therefore, the electronic device comprehensively determines the most suitable target editing template based on the first number of the target current cut piece, the blank area, and the overlapping area.
[0047] S108, adding the remaining pieces of the multiple pieces except the target current piece to the target editing template to obtain a final layout.
[0048] For the embodiment of the present application, after the electronic device determines the target editing template, the remaining pieces except the target current pieces are added to the target editing template, thereby obtaining the final layout. By determining a suitable historical layout to be selected from the historical layout, and comprehensively determining a suitable target editing template from the historical layout to be selected in combination with the first number of target current pieces, blank areas, and overlapping areas, and adding the remaining pieces to the target editing template, it is more labor-saving and efficient than manual layout, and reduces the consumption of printing materials.
[0049] In a possible implementation of the embodiment of the present application, in step S107, the target editing template is determined based on the first number of the target current pieces, the blank area, and the overlapping area, specifically including step S1071 (not shown in the figure), step S1072 (not shown in the figure), step S1073 (not shown in the figure), step S1074 (not shown in the figure), step S1075 (not shown in the figure), step S1076 (not shown in the figure), step S1077 (not shown in the figure), and step S1078 (not shown in the figure), wherein, S1071, determining the second number of overlapping regions in each editing template and the overlapping area of each overlapping region.
[0050] For the embodiment of the present application, the electronic device can determine the closed figure formed by the intersection of the first contour information of the cut pieces to obtain the overlapping area, and then count the overlapping areas to obtain the second number of overlapping areas in each editing template. The electronic device counts the number of pixels in each overlapping area to obtain the overlapping area of each overlapping area.
[0051] S1072: Determine an average overlapping area value based on the overlapping area and the second number.
[0052] For the embodiment of the present application, after the electronic device determines the overlapping area of each overlapping region in each editing template, it determines the average value of the overlapping area in each editing template according to the average value calculation formula. The average value of the overlapping area represents the overall overlapping situation in each editing template, that is, the average value of the overlapping area of each overlapping region is used to represent the overall overlapping area.
[0053] S1073, determine the ratio of the first quantity to the second quantity.
[0054] For the embodiment of the present application, after the electronic device determines the first number and the second number, it calculates the ratio of the first number to the second number. The larger the first number, the more suitable it is as a target editing template, and the larger the second number, the less suitable it is as a target editing template. The first number is the numerator and the second number is the denominator. Therefore, the larger the ratio, the more suitable it is as a target editing template, and the smaller the ratio, the less suitable it is as a target editing template.
[0055] S1074, determining the third number of blank areas in each editing template and the blank area of each blank area.
[0056] For the embodiments of the present application, the electronic device determines the closed area formed by the first contour information of each cut piece and the first contour information of other cut pieces as a blank area, the electronic device counts each blank area to obtain the third number of blank areas in each editing template, and the electronic device counts the number of pixels in each blank area to characterize the blank area of each blank area with the number of pixels.
[0057] S1075, determining an average value of the blank areas based on the blank areas and the third number, and correcting the average value of the blank areas based on the first number to obtain a corrected average value of the blank areas.
[0058] For the embodiment of the present application, the electronic device determines the average blank area value based on the blank area of each blank area and the third number of all blank areas, that is, the average area size of each blank area, and uses the average blank area value of each blank area to characterize the overall blank area. Since the number of target current pieces in each editing template is different, the number and area of blank areas in each editing template are different. Therefore, in order to make the subsequent analysis more accurate, the first number of target current pieces in each editing template is used to correct the average blank area value in the editing template to obtain a more reasonable average blank area value, that is, the corrected average blank area value. Specifically, the electronic device may store correction coefficients corresponding to different first numbers, determine the corresponding correction coefficient based on the first number, and use the correction coefficient to multiply the average blank area value or other calculation methods to obtain the corrected average blank area value.
[0059] S1076, determine the aspect ratio of each blank area, and determine the average aspect ratio.
[0060] For the embodiment of the present application, the length in the aspect ratio of the blank area is the line segment with the largest number of pixels in the blank area, and the width is the line segment with the largest number of pixels in the direction perpendicular to the line segment. The ratio of the above two line segments is calculated as the aspect ratio. The aspect ratio represents the degree of applicability of the blank area. The closer the aspect ratio is to one, the closer the blank area is to shapes such as circles and rectangles, and the more types of pieces can be adapted to be added to the blank area. The further the aspect ratio is from one, the narrower and longer the blank area is, and the fewer types of pieces can be adapted to be added. The electronic device calculates the average aspect ratio based on the aspect ratio of each blank area. The average aspect ratio can overall represent the degree of adaptation of the blank areas in the editing template to add pieces.
[0061] S1077, determining a first score for each edit template based on the average overlap area value and the ratio, and determining a second score for each edit template based on the corrected average blank area value and the average aspect ratio.
[0062] For the embodiment of the present application, the average value and ratio of the overlapping area are both key factors affecting whether the editing template is suitable as the target editing template in terms of the overlapping area, and the degree of influence is different. Different coefficients can be set for the average value and ratio of the overlapping area, and then the electronic device performs weighted calculation based on the coefficient and the average value and ratio of the overlapping area to obtain a first score. Similarly, the corrected average value of the blank area and the average aspect ratio are both key factors affecting whether the editing template is suitable as the target editing template in terms of the blank area, and the degree of influence is different. Different coefficients can be set for the corrected average value of the blank area and the average aspect ratio, and then the electronic device performs weighted calculation based on the coefficient and the corrected average value of the blank area and the average aspect ratio to obtain a second score.
[0063] S1078, determining a total score for each editing template based on the first score, the second score, and their corresponding coefficients, and determining a target editing template based on the total score.
[0064] For the embodiment of the present application, the first score is the degree to which the overlapping area in the editing template affects whether the editing template is suitable as the target editing template, and the second score is the degree to which the blank area in the editing template affects whether the editing template is suitable as the target editing template. The degree of influence is different, and different coefficients can be set for the first score and the second score. The electronic device then performs a weighted calculation to obtain a total score. The electronic device sorts the total score of each editing template and determines the editing template with the highest total score as the target editing template. The target editing template can be more accurately determined by combining the influence of the overlapping area and the blank area.
[0065] It should be understood that the coefficients mentioned in the embodiments of the present application can be adaptively adjusted according to actual conditions and needs.
[0066] In a possible implementation of the embodiment of the present application, in step S108, the remaining pieces of the multiple pieces except the target current piece are added to the target editing template to obtain the final layout, which specifically includes step S1081 (not shown in the figure), step S1082 (not shown in the figure), step S1083 (not shown in the figure), step S1084 (not shown in the figure), step S1085 (not shown in the figure), step S1086 (not shown in the figure) and step S1087 (not shown in the figure), wherein, S1081, determining at least one target overlapping region of the target current cutout that is overlapped in the target editing template and the overlapping area of each target overlapping region, and an associated blank region of the edge of the target current cutout that is overlapped.
[0067] For the embodiment of the present application, the electronic device determines the target overlapping area on each cut piece and determines the overlapping area of each target overlapping area. In order to eliminate the overlapping area, the electronic device determines the associated blank area of the edge of each cut piece, that is, the blank area formed by the edge with the first contour information of the cut piece.
[0068] S1082, determining the outline of each target overlapping region and the total overlapping area of all target overlapping regions.
[0069] For the embodiment of the present application, the electronic device determines the intersecting contours based on the intersection of the first contour information between the cut pieces and thereby obtains the contours of the target overlapping areas. The electronic device determines the number of pixels in each target overlapping area and thereby obtains the area of each overlapping area. The areas of all target overlapping areas on a cut piece are summed to obtain the total overlapping area.
[0070] S1083, determining the second similarity between the outline of each target overlapping area and each associated blank area, and determining an average value of the second similarity of each associated blank area.
[0071] For the embodiment of the present application, the electronic device calculates the second similarity between the outline of each target overlapping area and each associated blank area. The calculation of the second similarity can refer to the method disclosed in step S102. After obtaining the second similarity, the electronic device takes each associated blank area as the main area and determines the average value of the second similarity of each associated blank area. The larger the average value of the second similarity of a certain associated blank area, the more similar each target overlapping area on the cut piece is to the associated blank area, and it is more suitable for displacing the cut piece into the associated blank area.
[0072] S1084: Determine the target-associated blank region whose blank region area reaches the total overlapping area and whose average value of the second similarity is the highest.
[0073] According to the embodiment of the present application, the electronic device determines a target-associated blank area, and moving into the target-associated blank area can more easily eliminate the target overlapping area.
[0074] S1085 , determining a displacement strategy and a rotation strategy of the target current piece with overlap based on the outline of the target associated blank area, the first outline information of the target current piece, and the outline of the target overlapping area.
[0075] For the embodiment of the present application, the electronic device can input the outline of the target-associated blank area and the outline of each target overlapping area into the trained network model for strategy calculation, and obtain the displacement strategy and rotation strategy of the target current cut piece. Specifically, the network model can be a convolutional neural network model or a recurrent neural network model, or other types of network models. The staff can build a network model based on the outline of the blank area, the first outline information of the cut piece, the outline of the overlapping area, the displacement strategy and the rotation rate. The staff first collects the outline of the blank area, the first outline information of the cut piece, the outline of the overlapping area, and the displacement strategy and rotation strategy corresponding to the above three to obtain a training sample set. The electronic device performs supervised in-depth training and optimization of the network model based on the training sample set. The trained network model can determine the displacement strategy and rotation strategy of the target current cut piece based on the outline of the target-associated blank area, the first outline information of the target current cut piece and the outline of the target overlapping area.
[0076] S1086, moving the target current piece that is overlapped with the target current piece according to the displacement strategy and the rotation strategy to obtain a moved target editing template.
[0077] For the embodiment of the present application, the electronic device moves the corresponding target current piece according to the displacement strategy and the rotation strategy, thereby eliminating overlap and obtaining the moved target editing template.
[0078] S1087, adding the remaining pieces of the multiple pieces except the target current piece to the moved target editing template.
[0079] In the embodiment of the present application, after obtaining the moved target editing template, the electronic device can add the remaining pieces to the current blank area of the moved target editing template, thereby reducing the possibility of overlap after adding the remaining pieces.
[0080] In a possible implementation of the embodiment of the present application, in step S1087, the remaining pieces of the plurality of pieces except the target current piece are added to the target editing template after the move, which specifically includes step S1 (not shown in the figure), step S2 (not shown in the figure) and step S3 (not shown in the figure), wherein: S1, determining the current blank area in the target editing template after the move.
[0081] In the embodiment of the present application, the electronic device extracts the blank area between the pieces in the moved target editing template to obtain the current blank area, and the current blank area is the blank area where the remaining pieces need to be added.
[0082] S2, calculating a third similarity between each remaining piece and each current blank area.
[0083] For the embodiment of the present application, the electronic device can calculate the third similarity in the manner disclosed in step S102. The higher the third similarity between a remaining piece and a current blank area, the more suitable the remaining piece is to be added to the current blank area. After being added to the current blank area, the smaller the gap in the current blank area.
[0084] S3, adding each remaining piece to the current blank region with the third highest similarity.
[0085] For the embodiment of the present application, after the electronic device determines the third similarity of each remaining piece with respect to each blank area, it determines the current blank area with the highest third similarity corresponding to each remaining piece. If there are two or more remaining pieces whose current blank areas with the highest similarity are the same, the third similarities of the two or more remaining pieces are sorted, and the remaining piece with the highest third similarity is determined and added to the current blank area. By determining the current blank area of each remaining piece in the above manner, there are fewer gaps in the final layout.
[0086] In a possible implementation of the embodiment of the present application, in step S1087, the remaining pieces of the plurality of pieces except the target current piece are added to the target editing template after the move, specifically including step Sa (not shown in the figure) and step Sb (not shown in the figure), wherein: Sa, a plurality of piece combinations are determined from the remaining pieces based on the area of any current blank region.
[0087] The total area of each cut piece combination is not greater than the area of any current blank area.
[0088] In the embodiment of the present application, the electronic device determines the area of a current blank area, and determines multiple piece combinations based on the area, and the area of each piece combination is not greater than the area of the current blank area.
[0089] Sb, mapping each piece combination to any current blank area to determine a target piece combination, and adding the target piece combination to any current blank area.
[0090] The target piece combination does not overlap with the edge of any current blank area after being mapped into any current blank area, and the difference between the area of any current blank area and the total area of the target piece combination is the smallest.
[0091] For the embodiment of the present application, the electronic device maps all the cut piece combinations to the current blank area in sequence, filters out the cut piece combinations that overlap with the edge of the current blank area, and determines the cut piece combination with the largest area from the remaining cut piece combinations as the target cut piece combination, that is, the difference between the area of the current blank area and the total area of the target cut piece combination is the smallest. After determining the target cut piece combination, the electronic device adds the target cut piece combination to the current blank area. The electronic device determines and adds the cut piece combination in each current blank area in the above manner.
[0092] In other embodiments, after filtering out the piece combinations that overlap with the edge of the current blank area, the electronic device may further calculate the similarity between each remaining piece combination and the current blank area, and determine the target piece combination for each current blank area based on the similarity and the area of the remaining piece combinations.
[0093] In a possible implementation of the embodiment of the present application, step S108 further includes step 1, step 2, and step 3, wherein: Step 1: If there are remaining current pieces that cannot be added to the target editing template, then determine the remaining blank areas in the final layout.
[0094] For the embodiment of the present application, there may be some remaining current pieces in the current pieces that cannot be added to the target editing template. If they are added to the target editing template, more printing materials will be required. Therefore, the remaining blank areas in the final layout can be used to layout the remaining current pieces.
[0095] Step 2: Based on the outline and area of the remaining current piece, determine the target remaining blank area from the remaining blank areas.
[0096] In the embodiment of the present application, the electronic device determines the outline and area of the remaining current piece, and determines the target remaining blank area that can be used to layout the remaining current piece from the remaining blank area according to the outline. Specifically, the electronic device can divide the outline into multiple sub-outlines, and determine the target remaining blank area that can cover the sub-outlines from the remaining blank area.
[0097] Step three, splicing the remaining blank areas of the target to obtain a spliced blank area, and printing the outline of the remaining current pieces into the spliced blank area.
[0098] For the embodiment of the present application, after the electronic device determines the target remaining blank area corresponding to each sub-contour, it simulates splicing of the target remaining blank area to form a seamless and integrated splicing blank area, and prints the outline of the remaining current cut piece on the splicing blank area. Further, the sub-contours on each remaining blank area can be numbered. After printing out the final layout, the staff can cut the target remaining blank area and splice the target remaining blank area to obtain the remaining current cut piece.
[0099] In a possible implementation of the embodiment of the present application, step 3 further includes step 4, wherein: Step 4: Control the glue sticking equipment to add adhesive material on the remaining blank area of the target.
[0100] For the embodiment of the present application, the electronic device can control the gluing equipment to add glue or double-sided tape or other adhesive materials to the edge of each target remaining blank area, so that the staff can splice and glue the target remaining blank area after cutting to obtain the remaining current piece.
[0101] The above embodiment introduces a method for batch typesetting of CAD drawings from the perspective of method flow, and the following embodiment introduces a device for batch typesetting of CAD drawings from the perspective of virtual modules or virtual units. For details, please refer to the following embodiment.
[0102] The present application embodiment provides a CAD drawing batch typesetting processing device 20, such as Figure 2 As shown, the CAD drawing batch typesetting processing device 20 may specifically include: The first acquisition module 201 is used to obtain the layout method and number of pieces required by the user and the first contour information of multiple current pieces to be laid out, and search for a candidate historical layout that is consistent with the layout method from a preset historical layout library; A calculation module 202 is used to extract the second contour information of each historical piece from the plurality of historical layouts to be selected, and calculate the first similarity between each current piece and each historical piece based on the first contour information and the second contour information; A correction module 203, used to correct each history typesetting to be selected based on the number of items, to obtain a corrected history typesetting to be selected; The first determination module 204 is used to determine a first number of historical pieces whose similarity in each revised candidate historical layout reaches a preset similarity threshold, and determine the revised candidate historical layout whose number reaches the preset threshold as the target historical layout; A mapping module 205 is used to determine a target current piece whose first similarity with the historical pieces in each target historical layout reaches a preset similarity threshold from multiple current pieces, and map the target current piece on a blank template according to the position of the corresponding historical piece in the target historical layout to obtain an edit template, where the blank template is obtained by deleting the historical pieces in the target historical layout; The second determining module 206 is used to determine the blank area except the target current cut piece in each editing template and the overlapping area between the target current cut pieces; A third determination module 207, configured to determine a target editing template based on the first number of target current pieces, blank areas, and overlapping areas; The adding module 208 is used to add the remaining pieces of the multiple pieces except the target current piece to the target editing template to obtain the final layout.
[0103] The embodiment of the present application discloses a CAD drawing batch typesetting processing device 20, wherein a first acquisition module 201 acquires the required typesetting method, number of pieces and first contour information of multiple current cut pieces, searches for a candidate historical typesetting that is consistent with the typesetting method from a preset historical typesetting library, a calculation module 202 extracts the second contour information of each historical cut piece from multiple candidate historical typesettings, and calculates the first similarity between each current cut piece and each historical cut piece based on the first contour information and the second contour information, and a correction module 203 corrects the candidate historical typesetting according to the required number of pieces to obtain a corrected candidate historical typesetting, wherein the candidate historical typesetting is the typesetting that uses the least printing material, has the least blank area and the smallest area, so a suitable typesetting is determined from the candidate historical typesetting and is used in the batch typesetting. Adding the current piece to the corresponding template can reduce material waste. The first determination module 204 then determines the target historical layout that has the largest number of pieces with a similarity to the current piece that reaches the preset similarity threshold based on the similarity and the preset quantity threshold. Then the mapping module 205 maps the corresponding current piece to the blank template corresponding to each target historical layout to obtain an editing template, and the second determination module 206 determines the overlapping area and the blank area in the editing template. The third determination module 207 comprehensively determines the quality and suitability of each editing template based on the first quantity, blank area and overlapping area, thereby obtaining the target editing template. Finally, the adding module 208 adds the remaining pieces to the target editing template, which saves more time than manual layout.
[0104] In a possible implementation of the embodiment of the present application, when the third determination module 207 determines the target editing template based on the first number of target current pieces, the blank area, and the overlapping area, it is specifically used to: determining a second number of overlapping regions in each edit template and an overlapping area of each overlapping region; determining an overlap area average based on the overlap area and the second quantity; determining a ratio of the first amount to the second amount; determining a third number of blank areas in each edit template and a blank area of each blank area; determining a blank area average value based on the blank area and the third number, and correcting the blank area average value based on the first number to obtain a corrected blank area average value; determining the aspect ratio of each blank area and determining the average aspect ratio; Determine a first score for each edited template based on the average overlap area value and the ratio, and determine a second score for each edited template based on the corrected average blank area value and the average aspect ratio; The total score of each editing template is determined based on the first score, the second score and the corresponding coefficients, and the target editing template is determined based on the total score.
[0105] In a possible implementation of the embodiment of the present application, when the adding module 208 adds the remaining pieces of the multiple pieces except the target current piece to the target editing template to obtain the final layout, it is specifically used to: Determine at least one target overlapping region of the target current piece that is overlapped in the target editing template and an overlapping area of each target overlapping region, and an associated blank region of an edge of the target current piece that is overlapped; Determine the outline of each target overlap region and the total overlap area of all target overlap regions; Determine a second similarity between the contour of each target overlapping region and each associated blank region, and determine an average value of the second similarities of each associated blank region; Determine the target-associated blank area whose blank area reaches the total overlapping area and whose average value of the second similarity is the highest; Determine the displacement strategy and rotation strategy of the target current piece that overlaps based on the outline of the target associated blank area, the first outline information of the target current piece, and the outline of the target overlapping area; The current target piece that overlaps with the target is moved according to the displacement strategy and the rotation strategy to obtain the edit template of the moved target; Add the remaining pieces of the multiple pieces except the current piece of the target to the edit template of the moved target.
[0106] In a possible implementation of the embodiment of the present application, when the adding module 208 adds the remaining pieces of the multiple pieces except the target current piece to the moved target editing template, it is specifically used to: Determine the current blank area in the target editing template after the move; Calculate the third similarity between each remaining piece and each current blank area; Add each remaining piece to the third most similar current empty region.
[0107] In a possible implementation of the embodiment of the present application, when the adding module 208 adds the remaining pieces of the multiple pieces except the target current piece to the moved target editing template, it is specifically used to: Determine a plurality of piece combinations from the remaining pieces based on the area of any current blank area, wherein the total area of each piece combination is not greater than the area of any current blank area; Each piece combination is mapped to any current blank area to determine a target piece combination, and the target piece combination is added to any current blank area. After the target piece combination is mapped to any current blank area, it does not overlap with the edge of any current blank area, and the area of any current blank area is the smallest compared to the total area of the target piece combination.
[0108] In a possible implementation of the embodiment of the present application, the device 20 further includes: A fourth determination module, for determining remaining blank areas in the final layout when there are remaining current pieces that cannot be added to the target editing template; A fifth determination module, configured to determine a target remaining blank area from the remaining blank areas based on the contour and area of the remaining current cut piece; The printing module is used to splice the remaining blank areas of the target to obtain a spliced blank area, and print the outline of the remaining current cut pieces into the spliced blank area.
[0109] In a possible implementation of the embodiment of the present application, the device 20 further includes: The control module allows the user to control the gluing device to add adhesive material to the remaining blank area of the target.
[0110] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the CAD drawing batch typesetting processing device 20 described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0111] An electronic device is provided in an embodiment of the present application, such as Figure 3 As shown, Figure 3 The electronic device 30 shown includes: a processor 301 and a memory 303. The processor 301 and the memory 303 are connected, such as through a bus 302. Optionally, the electronic device 30 may also include a transceiver 304. It should be noted that in actual applications, the transceiver 304 is not limited to one, and the structure of the electronic device 30 does not constitute a limitation on the embodiments of the present application.
[0112] The processor 301 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor 301 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0113] The bus 302 may include a path to transmit information between the above components. The bus 302 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 302 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but it does not mean that there is only one bus or only one type of bus.
[0114] The memory 303 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0115] The memory 303 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 301. The processor 301 is used to execute the application code stored in the memory 303 to implement the contents shown in the above method embodiment.
[0116] The electronic devices include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital TVs, desktop computers, etc. It can also be a server, etc. Figure 3 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0117] The embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding content in the above method embodiment. Compared with the related art, in the embodiment of the present application, the selected historical typesetting is first determined according to the required typesetting method, and then the selected historical typesetting is corrected according to the required number of pieces to obtain the corrected selected historical typesetting. The selected historical typesettings are all typesets that use the least printing materials, the least blank area and the smallest area. Therefore, determining the appropriate typesetting from the selected historical typesetting and adding the current piece to the corresponding template can reduce the waste of materials, and then determining the target historical typesetting that reaches the preset similarity threshold and has the largest number of similarities with the current piece according to the similarity and the preset number threshold, and then mapping the corresponding current piece to the blank template corresponding to each target historical typesetting to obtain an editing template, and determining the overlapping area and blank area in the editing template, and comprehensively judging the quality and suitability of each editing template according to the first number, blank area and overlapping area, so as to obtain the target editing template, and finally adding the remaining pieces to the target editing template, which saves more time than manual typesetting.
[0118] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0119] The above description is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for batch typesetting of CAD drawings, characterized in that: include: Obtain the layout mode, number of pieces and first contour information of multiple current pieces required by the user, and search for a historical layout to be selected that is consistent with the layout mode from a preset historical layout library; Extracting second contour information of each historical piece from the plurality of historical layouts to be selected, and calculating a first similarity between each current piece and each historical piece based on the first contour information and the second contour information; Modifying each of the historical layouts to be selected based on the number of items to obtain a modified historical layout to be selected; Determine a first number of historical pieces whose similarity of the plurality of current pieces reaches a preset similarity threshold in each revised historical layout to be selected, and determine the revised historical layout to be selected whose number reaches the preset threshold as the target historical layout; Determine a target current piece whose first similarity with the historical pieces in each target historical layout reaches a preset similarity threshold from the multiple current pieces, and map the target current piece onto a blank template according to the position of the corresponding historical piece in the target historical layout to obtain an edit template, wherein the blank template is obtained by deleting the historical pieces in the target historical layout; Determine the blank area except the target current cutout in each edit template and the overlapping area between the target current cutouts; Determine a target editing template based on the first number, the blank area, and the overlapping area of the target current pieces; The remaining pieces of the plurality of pieces except the target current piece are added to the target editing template to obtain a final layout.
2. A method for batch typesetting of CAD drawings according to claim 1, characterized in that: The determining of the target editing template based on the first number of the target current pieces, the blank area, and the overlapping area includes: determining a second number of overlapping regions in each edit template and an overlapping area of each overlapping region; determining an overlap area average based on the overlap area and the second quantity; determining a ratio of the first amount to a second amount; determining a third number of blank areas in each edit template and a blank area of each blank area; determining a blank area average value based on the blank area and a third number, and correcting the blank area average value based on the first number to obtain a corrected blank area average value; determining the aspect ratio of each blank area and determining the average aspect ratio; Determine a first score for each edited template based on the overlap area average value and the ratio, and determine a second score for each edited template based on the corrected blank area average value and the average aspect ratio; The total score of each editing template is determined based on the first score, the second score and the corresponding coefficients, and the target editing template is determined based on the total score.
3. A method for batch typesetting of CAD drawings according to claim 1, characterized in that: The step of adding the remaining pieces of the plurality of pieces except the target current piece to the target editing template to obtain a final layout includes: Determine at least one target overlapping region of the target current cutout that is overlapped in the target editing template and an overlapping area of each target overlapping region, and an associated blank region of an edge of the target current cutout that is overlapped; Determine the outline of each target overlap region and the total overlap area of all target overlap regions; Determine a second similarity between the contour of each target overlapping region and each associated blank region, and determine an average value of the second similarities of each associated blank region; Determine the target-associated blank region whose blank region area reaches the total overlapping area and whose average value of the second similarity is the highest; Determine the displacement strategy and rotation strategy of the target current cut piece with overlap based on the outline of the target associated blank area, the first outline information of the target current cut piece, and the outline of the target overlapping area; The target current piece that is overlapped is moved according to the displacement strategy and the rotation strategy to obtain a moved target editing template; The remaining pieces of the plurality of pieces except the target current piece are added to the moved target editing template.
4. A method for batch typesetting of CAD drawings according to claim 3, characterized in that: The step of adding the remaining pieces of the plurality of pieces except the target current piece to the moved target editing template comprises: Determine the current blank area in the target edit template after the move; Calculate the third similarity between each remaining piece and each current blank area; Each remaining piece is added to the current blank area with the third highest similarity.
5. A method for batch typesetting of CAD drawings according to claim 3, characterized in that: The step of adding the remaining pieces of the plurality of pieces except the target current piece to the moved target editing template comprises: Determine a plurality of piece combinations from the remaining pieces based on the area of any current blank area, wherein the total area of each piece combination is not greater than the area of any current blank area; Each piece combination is mapped to any of the current blank areas to determine a target piece combination, and the target piece combination is added to any of the current blank areas, wherein the target piece combination does not overlap with an edge of any of the current blank areas after being mapped to the any of the current blank areas, and an area of any of the current blank areas is minimum to a total area of the target piece combination.
6. A method for batch typesetting of CAD drawings according to claim 1, characterized in that: The method further comprises: If there are remaining current pieces that cannot be added to the target editing template, determining remaining blank areas in the final layout; Determining a target remaining blank area from the remaining blank areas based on the contour and area of the remaining current cut piece; The target remaining blank areas are spliced to obtain a spliced blank area, and the outline of the remaining current cut pieces is printed in the spliced blank area.
7. A method for batch typesetting of CAD drawings according to claim 1, characterized in that: The method further comprises: The glue sticking device is controlled to add adhesive material on the remaining blank area of the target.
8. A CAD drawing batch typesetting processing device, characterized in that: include: A first acquisition module is used to acquire the typesetting method and number of pieces required by the user and first contour information of multiple current cut pieces to be typeset, and search for a candidate historical typesetting that is consistent with the typesetting method from a preset historical typesetting library; A calculation module, configured to extract the second contour information of each historical piece from the plurality of historical typeset to be selected, and calculate a first similarity between each current piece and each historical piece based on the first contour information and the second contour information; A correction module, used for correcting each history typesetting to be selected based on the number of items, to obtain a corrected history typesetting to be selected; A first determination module is used to determine a first number of historical pieces whose similarity of the plurality of current pieces reaches a preset similarity threshold in each revised historical layout to be selected, and determine the revised historical layout to be selected whose number reaches the preset threshold as the target historical layout; A mapping module is used to determine a target current piece whose first similarity with the historical pieces in each target historical layout reaches a preset similarity threshold from the multiple current pieces, and map the target current piece on a blank template according to the position of the corresponding historical piece in the target historical layout to obtain an edit template, wherein the blank template is obtained by deleting the historical pieces in the target historical layout; The second determination module is used to determine the blank area except the target current cut piece in each editing template and the overlapping area between the target current cut pieces; A third determination module, configured to determine a target editing template based on the first number, the blank area, and the overlapping area of the target current cutout; The adding module is used to add the remaining pieces of the multiple pieces except the target current piece to the target editing template to obtain a final layout.
9. An electronic device, characterized in that: It includes: at least one processor; Memory; At least one application, wherein the at least one application is stored in the memory and is configured to be executed by the at least one processor, and the at least one application is used to execute a CAD drawing batch typesetting processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed in a computer, the computer is caused to execute the method for batch typesetting of CAD drawings as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Data processing method, cutting system, control system and equipment
CN113297638A
Automatic photographing and discharging method and device and photographing equipment
CN117025856A
Cutting piece template and marker frame image matching method, device and equipment and storage medium
CN117953243A
Typesetting method and device
CN118468808A
Cited By
Underwear registration and typesetting method based on machine vision
CN119722874A
Packing box stock layout method and equipment
CN121010618A
Packaging box layout method and device
CN121010618B
