A method and system for generating a blank drawing with dimension markings for sheet metal parts

CN121580458BActive Publication Date: 2026-09-04TIANYU SOFTWARE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511650939.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-12
Publication Date
2026-09-04
Estimated Expiration
2045-11-12

AI Technical Summary

Technical Problem

[0006]针对现有技术的以上缺陷或改进需求,本发明提供了一种为钣金件生成带尺寸标注的下料图纸的方法,其目的在于,通过获取钣金展开件三维模型,利用投影算法计算主平面上的外围轮廓线和内部轮廓线,利用尺寸标注算法对轮廓线自动创建尺寸标注,获取轮廓线和尺寸标注的包围盒,依据包围盒大小和图幅大小自动缩放轮廓线和尺寸标注,最终生成带尺寸标注的下料图纸,从而解决现有通过人工计算折弯补偿并绘制下料图的方法需要大量的人工交互操作,设计人员需要手动完成视图创建、布局调整和尺寸标注等工作,导致耗时耗力的技术问题,以及现有通过CAD软件半自动生成下料图的方法利用CAD软件生成的二维轮廓线通常只能够生成外围轮廓线,无法生成孔洞的内轮廓线,因此无法满足部分企业的实际需求的技术问题,以及上述两种方法不具备尺寸自动标注的功能,采用人工标注容易出现尺寸标注混乱、标注错误、布局不合理、以及尺寸检测效率低的技术问题

Benefits of technology

(1)本发明由于采用了步骤(4),支持自动获取钣金展开件三维模型上的内、外环边,生成内、外轮廓线;并采用了步骤(6),支持自动创建尺寸标注;并采用了步骤(7),支持自动对尺寸标注和轮廓线进行缩放,因此极大程度的提高了本发明的自动化程度,进而解决现有通过人工计算折弯补偿并绘制下料图的方法需要大量的人工交互操作,设计人员需要手动完成视图创建、布局调整和尺寸标注等工作,导致耗时耗力的技术问题;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121580458B_ABST
    Figure CN121580458B_ABST
Patent Text Reader

Abstract

The application discloses a method for automatically generating blanking drawing paper with size marking for sheet metal parts, which acquires a three-dimensional model of a sheet metal unfolded part, calculates peripheral contour lines and internal contour lines on a main plane by using a projection algorithm, automatically creates size markings for the contour lines by using a size marking algorithm, acquires a bounding box of the contour lines and the size markings, automatically scales the contour lines and the size markings according to the size of the bounding box and the size of a drawing sheet, and finally generates blanking drawing paper with size markings, so as to solve the technical problems that the existing method of manually calculating bending compensation and drawing blanking drawing paper needs a large amount of manual interactive operation, designers need to manually complete view creation, layout adjustment and size marking and other work, resulting in time-consuming and labor-consuming technical problems, and the existing method of semi-automatically generating blanking drawing paper by using CAD software can only generate peripheral contour lines by using two-dimensional contour lines generated by the CAD software, and cannot generate internal contour lines of holes, so that the actual needs of some enterprises cannot be met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of three-dimensional digital process design, and more specifically, relates to a method and system for generating blanking drawings with dimension annotations for sheet metal parts. Background Technology

[0002] Sheet metal blanking drawings represent the unfolded planar state of sheet metal parts before bending. They typically include the outer contour lines, internal hole lines, and dimensional annotations of the unfolded part. The industry commonly uses DWG or DXF formats. As a crucial bridge connecting sheet metal design and manufacturing, the generation and optimization quality of sheet metal blanking drawings directly impacts the efficiency and accuracy of subsequent sheet metal part manufacturing.

[0003] There are two main methods for generating sheet metal blanking drawings. One method involves manually calculating bending compensation and drawing the blanking drawing, which generates two-dimensional projection lines and manually draws dimensions and other data. The other method involves semi-automatically generating blanking drawings using 3D CAD software. Engineers can use the existing functions of CAD software to automatically generate two-dimensional projection lines of the 3D model of the sheet metal unfolded part, and then manually fill in the dimensions and other data.

[0004] However, both of the above methods for generating sheet metal blanking drawings have some drawbacks that cannot be ignored.

[0005] First, the method of manually calculating bending compensation and drawing cutting diagrams requires a lot of manual interaction. Designers need to manually complete tasks such as view creation, layout adjustment and dimensioning, which is time-consuming and labor-intensive, especially in large-scale drawing of cutting diagrams. Second, the method of semi-automatically generating cutting drawings using CAD software is not highly automated. The two-dimensional outlines generated by CAD software can usually only generate the outer outlines and cannot generate the inner outlines of holes, thus failing to meet the actual needs of some enterprises. Third. Neither of the two methods for generating sheet metal blanking drawings mentioned above has the function of automatic dimension annotation. Manual annotation is prone to problems such as chaotic dimension annotation, annotation errors, unreasonable layout, and low dimension inspection efficiency. Summary of the Invention

[0006] To address the aforementioned deficiencies or improvement needs of existing technologies, this invention provides a method for generating blanking drawings with dimension annotations for sheet metal parts. The method involves acquiring a 3D model of the sheet metal part, calculating the outer and inner contour lines on the main plane using a projection algorithm, automatically creating dimension annotations on the contour lines using a dimensioning algorithm, obtaining the bounding box of the contour lines and dimension annotations, and automatically scaling the contour lines and dimension annotations according to the size of the bounding box and the drawing size. This ultimately generates blanking drawings with dimension annotations. This solves the problems of existing methods that require extensive manual interaction to calculate bending compensation and draw blanking drawings, necessitating designers to manually complete view creation, layout adjustment, and dimensioning, resulting in time-consuming and labor-intensive tasks. It also addresses the issues of existing semi-automatic methods using CAD software to generate blanking drawings, where the 2D contour lines generated by CAD software typically only generate outer contour lines and cannot generate inner contour lines for holes, thus failing to meet the actual needs of some enterprises. Furthermore, it addresses the lack of automatic dimension annotation functionality in the aforementioned two methods, where manual annotation easily leads to chaotic dimension annotations, errors, unreasonable layouts, and low efficiency in dimension inspection.

[0007] To achieve the above objectives, according to one aspect of the present invention, a method for automatically generating blanking drawings with dimension annotations for sheet metal parts is provided, comprising the following steps: (1) Obtain the three-dimensional model of the sheet metal unfolded part, read all the faces on the three-dimensional model of the sheet metal unfolded part, and add all the faces to the pre-set face manager AllFaces; (2) Obtain the area of ​​each face in the face manager AllFaces, and take the face with the largest area as the main face; (3) Obtain the outer and inner ring edges on the main plane, and obtain the position matrix M based on the outer and inner ring edges, the center point of the main plane, and the normal vector; (4) Using the position matrix M obtained in step (3), project all the outer and inner ring edges on the main plane mainFace obtained in step (3) onto the XOY plane to obtain multiple outer contour lines and inner contour lines, and add all the outer contour lines and inner contour lines to the pre-set managers outProjs and inProjs respectively. (5) Obtain the grids occupied by each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4) on the XOY plane, and add the grids occupied by all outer contour lines and the grids occupied by each inner contour line to the pre-set manager cells. (6) Create corresponding dimension labels for each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4), and add the created dimension labels to the corresponding grid on the XOY plane in the manager cells; (7) Obtain the drawing sheet selected by the user, and scale each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4) according to the drawing sheet and the manager cells, as well as the dimension annotations of each outer contour line and each inner contour line, to obtain a blanking drawing with dimension annotations.

[0008] Preferably, step (2) includes the following sub-steps: (2-1) Initialize the main plane (mainFace) to be empty; (2-2) Initialize the maximum area (maxArea) to 0.0; (2-3) Set the counter i=0; (2-4) Determine if the counter i is less than the total number of faces in the face manager AllFaces. If yes, proceed to step (2-5); otherwise, the process ends. (2-5) Calculate the area of ​​the i-th face AllFaces[i] in the face manager AllFaces using the open-source modeling tool opencascade, and determine whether the area is greater than the maximum area maxArea. If it is, proceed to step (2-6); otherwise, proceed to step (2-7). (2-6) Set the maximum area maxArea=area, and set the main plane mainFace=the i-th face AllFaces[i] in the face manager AllFaces; (2-7) Set the counter i = i + 1 and return to step (2-4).

[0009] Preferably, step (3) includes the following sub-steps: (3-1) Use the open-source modeling tool Opencascade to obtain all outer and inner ring edges on the main plane; (3-2) Obtain the center point P and normal vector N of the main plane, the three-dimensional coordinates (px, py, pz) of the center point P, and the three-dimensional coordinates (nx, ny, nz) of the normal vector N; (3-3) Obtain the longest outer ring edge, its direction E, and its three-dimensional coordinates (ex, ey, ez) among all the outer ring edges obtained in step (3-1); (3-4) Construct a matrix using the center point P and normal vector N obtained in step (3-2) and the direction E obtained in step (3-2), and use the inverse matrix of this matrix as the position matrix M.

[0010] Preferably, the process of obtaining the longest outer ring edge among all outer ring edges in step (3-3) includes the following sub-steps: (3-3-1) Initialize the maximum side length maxlen to 0, and initialize the counter cnt1 to 0; (3-3-2) Determine if the calculator cnt1 is less than the total number of all outer loop edges obtained in step (3-1). If it is, proceed to step (3-3-3); otherwise, the process ends. (3-3-3) Calculate the length of the cnt1th outer ring edge among all the outer ring edges obtained in step (3-1), and determine whether the length of the cnt1th outer ring edge is greater than the maximum edge length maxlen. If it is, set the maximum edge length maxlen = the length of the cnt1th outer ring edge, and set the cnt1th outer ring edge as the longest outer ring edge among all outer ring edges. Then the process ends. Otherwise, proceed to step (3-3-4). (3-3-4) Set the counter cnt1=cnt1+1 and return to step (3-3-2). Steps (3-4) are as follows: First, the normal vector N and direction E are cross-multiplied to obtain direction F. Then, direction F is normalized to obtain three-dimensional coordinates (fx, fy, fz). Next, based on the three-dimensional coordinates (fx, fy, fz), the three-dimensional coordinates of direction E, the three-dimensional coordinates of center point P (px, py, pz), and the three-dimensional coordinates of normal vector N (nx, ny, nz), a matrix T = {fx, fy, fz, 0, ex, ey, ez, 0, nx, ny, nz, 0, px, py, pz, 1} is constructed. Finally, the inverse of matrix T is calculated as the position matrix M, i.e., M = T. -1 .

[0011] Preferably, in step (4), the position matrix M obtained in step (3) is used to project all the outer ring edges on the main plane mainFace obtained in step (3) onto the XOY plane to obtain multiple outer contour lines, and all the outer contour lines are added to the pre-set manager outProjs. This process includes the following sub-steps: (4-1) Set the counter t=0 and initialize the manager outProjs to empty; (4-2) Determine whether the counter t is less than the total number of all outer ring edges on the main plane mainFace obtained in step (3). If it is, proceed to step (4-3); otherwise, the process ends. (4-3) Obtain the type of the t-th outer ring edge on the main plane mainFace obtained in step (3); (4-4) Determine whether the type of the t-th outer ring edge obtained in step (4-3) is a straight line. If it is, proceed to step (4-5); otherwise, proceed to step (4-7). (4-5) Obtain the three-dimensional coordinates of the starting point and the ending point of the t-th outer ring edge, and multiply them with the position matrix M respectively to obtain the three-dimensional coordinates of the projection point of the starting point and the projection point of the ending point respectively. (4-6) Use the three-dimensional coordinates of the starting point and the three-dimensional coordinates of the ending point obtained in step (4-5) to generate a projection line, add the projection line to the manager outProjs, and then proceed to step (4-13). (4-7) Determine whether the type of the t-th outer ring edge obtained in step (4-3) is an arc. If it is, proceed to step (4-8); otherwise, proceed to step (4-10). (4-8) Obtain the three-dimensional coordinates of the starting point, midpoint and ending point of the arc, and multiply them with the position matrix M respectively to obtain the three-dimensional coordinates of the projection point of the starting point, the projection point of the midpoint and the projection point of the ending point. (4-9) Use the three-dimensional coordinates of the starting point, the three-dimensional coordinates of the midpoint, and the three-dimensional coordinates of the ending point obtained in step (4-8) to generate a projected arc, add it to the manager outProjs, and proceed to step (4-13). (4-10) Determine whether the type of the t-th outer ring edge obtained in step (4-3) is a circle. If it is, proceed to step (4-11); otherwise, proceed to step (4-13). (4-11) Obtain the three-dimensional coordinates of the center of the circle, and multiply them with the position matrix M to obtain the three-dimensional coordinates of the projection point of the center of the circle; (4-12) Based on the three-dimensional coordinates and radius of the projection point of the center obtained in step (11), generate the projection circle and add it to the manager outProjs; (4-13) Set the counter t=t+1 and return to step (4-2).

[0012] Preferably, step (5) involves obtaining the grid cells occupied by each inner contour line in the manager inProjs obtained in step (4) on the XOY plane and adding all the grid cells occupied by the inner contour lines to the pre-set manager cells. This process specifically includes the following sub-steps: (5-1) Set the counter cnt2=0; (5-2) Determine whether the counter cnt2 is less than the total number of inner contour lines in the manager inProjs obtained in step (4). If it is, proceed to step (5-3); otherwise, the process ends. (5-3) Determine whether the type of the inner contour line of the second line in the manager inProjs obtained in step (4) is a straight line, an arc, a circle, or another type. If it is a straight line, proceed to step (5-4); if it is an arc, proceed to step (5-5); if it is a circle, proceed to step (5-6); if it is another type, proceed to step (5-7). (5-4) Obtain the starting point and ending point of the inner contour line of the cnt2th line in the manager inProjs obtained in step (4), as well as the grid corresponding to the starting point and ending point on the XOY plane, and add these grids to the manager cells, and then proceed to step (5-7). (5-5) Obtain the starting point, midpoint and ending point of the inner contour line of the cnt2th line obtained in the manager inProjs in step (4), as well as the grid corresponding to the starting point, midpoint and ending point on the XOY plane, and add these grids to the manager cells for management, and then proceed to step (5-7). (5-6) Obtain the center and radius of the inner contour line of the cnt2th inner contour line obtained in step (4), obtain the four quadrant points of the inner contour line of the cnt2th inner contour line according to the center and radius, obtain the grid corresponding to the quadrant point and the center on the XOY plane, and add these grids to the manager cells; (5-7) Set the counter cnt2 = cnt2 + 1 and return to step (5-2).

[0013] Preferably, step (6) involves creating corresponding dimension annotations for each inner contour line in the manager inProjs obtained in step (4), and adding the corresponding grid of the created dimension annotations to the manager cells on the XOY plane. This process includes the following sub-steps: (6-1) Set the counter cnt3=0; (6-2) Determine whether the counter cnt3 is less than the total number of inner contour lines in the inner contour line manager inProjs obtained in step (4). If yes, proceed to step (6-3); otherwise, the process ends. (6-3) Determine whether the cnt3 inner contour line in the manager inProjs obtained in step (4) is a straight line. If it is, proceed to step (6-4); otherwise, proceed to step (6-7). (6-4) Determine whether the inner contour line of the cnt3th line is a vertical straight line. If it is, proceed to step (6-5); otherwise, proceed to step (6-6). (6-5) Create a dimension to the left or right of the inner contour line of the cnt3 line, and then proceed to step (6-11). The method for creating dimension annotations to the left or right of the cnt3 inner contour line is as follows: First, initialize the direction symbol fl=0, obtain the start point, end point, and coordinates spt(sx, sy) of the cnt3 inner contour line. If the start point coordinates sx>0, set the direction symbol fl=1; otherwise, set the direction symbol fl=-1. Then, use the method in step (5-4) to obtain the grid scell={c0, c1} corresponding to the start point on the XOY plane and the grid ecell={d0, d1} corresponding to the end point on the XOY plane. After that, determine whether the grids scell and ecell are located in the management area. If a grid cell is not in the manager cells, dimension labels are created in the grid cells scell and ecell. If it is in the manager, the grid is incremented, i.e., c0 = c0 + h * fl and d0 = d0 + h * fl, where h is the grid height. After each increment, the grid cells scell and ecell are checked to see if they are in the manager cells. If they are not in the manager cells, dimension labels are created in the grid cells scell and ecell and the increment process ends. Otherwise, the increment process continues until the grid cells scell and ecell are in the manager cells. (6-6) Create a dimension above or below the inner contour line of the cnt3 line, and then proceed to step (6-11). The method for creating dimension annotations above or below the inner contour line is as follows: First, initialize the direction symbol fl=0, obtain the start point, end point, and coordinates spt(xs, sy) of the cnt3 inner contour line. If the start point coordinates sy>0, set the direction symbol fl=1; otherwise, set the direction symbol fl=-1. Then, use the method in step (5-4) to obtain the grid scell={c0, c1} corresponding to the start point on the XOY plane and the grid ecell={d0, d1} occupied by the end point on the XOY plane. After that, determine whether the grids scell and ecell are located in the tube. If a cell is not in the manager cells, dimension labels are created in the grid cells s and e. If it is in the manager, the grid is incremented, i.e., c1 = c1 + h * fl and d1 = d1 + h * fl. After each increment, the grid cells s and e are checked to see if they are in the manager cells. If they are not in the manager cells, dimension labels are created in the grid cells s and e and the increment process ends. Otherwise, the increment process continues until the grid cells s and e are in the manager cells. (6-7) Determine whether the cnt3 inner contour line is a circle. If it is, proceed to step (6-8); otherwise, proceed to step (6-9). (6-8) Create dimensioning around the inner contour line of the cnt3 line, and then proceed to step (6-11). The method for creating dimension annotations around the circle is as follows: using the method in steps (5-6), obtain the grids corresponding to the four quadrant points of the circle on the XOY plane: top={tx, ty}, bot={bx, by}, left={lx, ly}, and rig={rx, ry}. Then, check whether the four grids top, bot, left, and rig are in the manager cells. If a grid is not in the manager, create a dimension annotation at that grid. If all four grids are in the manager cells, increment the four grids sequentially, i.e., ty=ty+h, by=by-h, lx=lx-h, and rx=rx+h. After the increment is completed, check whether the four grids are in the manager cells. If they are not, create a dimension annotation and end the increment process. Otherwise, continue to execute this increment process until all four grids are in the manager cells. (6-9) Determine whether the cnt3 inner contour line is an arc. If it is, proceed to step (6-10); otherwise, proceed to step (6-12). (6-10) Create dimensioning around the inner contour line of the third cnt; The specific method for creating dimension annotations around the arc is as follows: First, obtain the quadrant points of the arc in the four directions of up, down, left, and right. Then, obtain the four grids corresponding to the quadrant points on the XOY plane and determine whether the four grids are in the manager cells. If not, create dimension annotations at the grids. Otherwise, increment the grids. After the increment is completed, check whether the four grids are in the manager cells. If not, create dimension annotations and end the increment process. Otherwise, continue to execute this increment process until all four grids are in the manager cells. (6-11) Add the grid where the dimension annotation was created to the cells manager; (6-12) Set the counter cnt3=cnt3+1 and return to step (6-2).

[0014] Preferably, step (7) includes the following sub-steps: (7-1) Obtain the map sheet selected by the user; (7-2) Initialize the bounding box of the cells manager with the minimum x-direction value minx=10000, the maximum x-direction value maxx=-10000, the minimum y-direction value miny=10000, and the maximum y-direction value maxy=-10000. (7-3) Set the counter cnt4=0; (7-4) Determine whether the counter cnt4 is less than the total number of grids in the manager cells, if yes, go to step (7-5), otherwise go to step (7-7); (7-5) Obtain the coordinates {cx, cy} of the cnt4-th grid in the manager cells, and update the minimum value in x direction minx, the maximum value in x direction maxx, the minimum value in y direction miny, and the maximum value in y direction maxy of the bounding box by using the coordinates of the grid; (7-6) Set the counter cnt4=cnt4+1, and return to step (7-4); (7-7) Update the minimum value in x direction minx, the maximum value in x direction maxx, the minimum value in y direction miny, and the maximum value in y direction maxy of the bounding box by using the height of the grid; (7-8) Calculate a scaling factor by using the updated minimum value in x direction minx, maximum value in x direction maxx, minimum value in y direction miny, and maximum value in y direction maxy of the bounding box obtained in step (7-7) and the size of the image frame obtained in step (1), and perform scaling processing on each outer contour line in the manager outProjs, each inner contour line in the manager inProjs obtained in step (4), as well as the dimension annotations of each outer contour line and each inner contour line by using the scaling factor, so as to obtain a blanking drawing with dimension annotations.

[0015] Preferably, in step (7-5), if cx>the maximum value in x direction maxx, set the maximum value in x direction maxx=cx; if cx<the minimum value in x direction minx, set the minimum value in x direction minx=cx; if cy>the maximum value in y direction maxy, set the maximum value in y direction maxy=cy; if cy<the minimum value in y direction miny, set the minimum value in y direction miny=cy; Step (7-7) is specifically: set maxx=maxx+h, minx=minx-h, maxy=maxy+h, miny=miny-h; Steps (7-8) are as follows: First, calculate the length of the bounding box len = maxx - minx and the width of the bounding box wid = maxy - miny; then, calculate the scaling factor in the x-direction = AX / len and the scaling factor in the y-direction = AY / wid respectively, and take the larger of the two as the final scaling factor; finally, based on the final scaling factor, and using different development tools (such as the open-source modeling tools Opencascade and objectarx), scale the dimensions of each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4), as well as the dimensions of each outer contour line and each inner contour line.

[0016] According to another aspect of the present invention, a system for automatically generating blanking drawings with dimension annotations for sheet metal parts is provided, comprising: The first module is used to acquire the 3D model of the sheet metal unfolded part, read all the faces on the 3D model of the sheet metal unfolded part, and add all the faces to the pre-set face manager AllFaces; The second module is used to obtain the area of ​​each face in the face manager AllFaces, and to take the face with the largest area as the main face. The third module is used to obtain the outer and inner ring edges on the main plane, and to obtain the position matrix M based on the outer and inner ring edges, the center point of the main plane, and the normal vector. The fourth module is used to project all the outer and inner ring edges on the main plane mainFace obtained by the third module onto the XOY plane using the position matrix M obtained by the third module, so as to obtain multiple outer and inner contour lines, and add all the outer and inner contour lines to the pre-set managers outProjs and inProjs respectively. The fifth module is used to obtain the grid occupied by each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained from the fourth module on the XOY plane, and add the grid occupied by all outer contour lines and the grid occupied by each inner contour line to the pre-set manager cells. The sixth module is used to create corresponding dimension annotations for each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained from the fourth module, and add the created dimension annotations to the corresponding grid on the XOY plane into the manager cells. The seventh module is used to obtain the drawing sheet selected by the user, and to scale each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained by the fourth module, as well as the dimension annotations of each outer contour line and each inner contour line, according to the drawing sheet and the manager cells, so as to obtain a blanking drawing with dimension annotations.

[0017] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects: (1) This invention adopts step (4) to support the automatic acquisition of the inner and outer ring edges on the three-dimensional model of the sheet metal unfolded part and generate the inner and outer contour lines; and adopts step (6) to support the automatic creation of dimension annotations; and adopts step (7) to support the automatic scaling of dimension annotations and contour lines. Therefore, the automation level of this invention is greatly improved, thereby solving the technical problem that the existing method of manually calculating bending compensation and drawing blanking drawings requires a lot of manual interaction operations, and designers need to manually complete the work of view creation, layout adjustment and dimension annotation, which leads to time-consuming and labor-intensive technical problems. (2) Since the present invention adopts step (4), it supports the generation of inner and outer contour lines. It can also generate blanking drawings for common structures such as holes and slots in sheet metal parts, which can better meet the needs of enterprises. It adopts steps (6) and (7), which support the automatic generation of dimension annotations and automatically scales the dimension annotations and contour lines. Therefore, it can solve the technical problem that the existing method of semi-automatically generating blanking drawings through CAD software can usually only generate the outer contour lines of the two-dimensional contour lines generated by CAD software, and cannot generate the inner contour lines of holes, thus failing to meet the actual needs of some enterprises. (3) Because the present invention employs steps (5) and (6), it rasterizes the XOY plane, records the grid occupied by the projection lines, and adds dimensions to the inner and outer contour lines. This ensures that the dimensions are evenly distributed around the contour lines from the inside out. Placing the dimensions within the grid makes the layout of the dimensions more compact and organized, and prevents overlap and intersection between dimensions, thus improving the quality of the generated drawings. Therefore, it can solve the technical problems of the two existing methods not having automatic dimensioning function and the manual dimensioning method being prone to chaotic dimensioning, errors, unreasonable layout, and low dimension detection efficiency. (4) Since the present invention adopts steps (2) and (3), it finds the main plane by the maximum area and calculates the position matrix by the center, normal vector and longest side of the main plane. It makes full use of the geometric characteristics of the three-dimensional model of the sheet metal unfolding part, ensuring that the final generated projection outline is located in the center of the drawing and the longest side of the outline is aligned with the horizontal direction of the drawing, thereby improving the quality of the blanking drawing and making it more in line with industry standards. (5) The algorithm logic provided by the present invention is simple and easy to expand and modify to match different business scenarios. For example, for some scenarios, the inner contour line is not required, and it is sufficient to not process the inner ring edge; for some scenarios, the technical requirements for generating the blanking diagram are required, and it is sufficient to find a suitable area in the unoccupied grid. (6) The present invention has a high degree of automation, which can greatly improve the efficiency of drawing generation compared with existing methods. Attached Figure Description

[0018] Figure 1 This is an overall flowchart of the method for automatically generating blanking drawings with dimension annotations for sheet metal parts according to the present invention; Figure 2 This is a schematic diagram of the three-dimensional model of the sheet metal unfolded part of the present invention; Figure 3 This is a flowchart of projecting the inner and outer ring edges onto the XOY plane; Figure 4 This is a schematic diagram of grid size annotation; Figure 5 This is a flowchart for creating corresponding dimension annotations for the outline; Figure 6 This is a detailed flowchart of step (7) in the method of the present invention. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.

[0020] The basic idea of ​​this invention is to provide a method for automatically generating blanking drawings with dimension annotations for sheet metal parts. First, the geometric data of the sheet metal unfolded part is used to generate the inner and outer contour lines of the blanking drawing, and the dimensions of the inner and outer contour lines are annotated. A grid is used to ensure that the dimension annotations are evenly distributed and do not overlap. Finally, the inner contour lines, outer contour lines, and dimension annotations are scaled according to the bounding box of the grid and the size of the drawing.

[0021] like Figure 1 As shown, the present invention provides a method for automatically generating blanking drawings with dimension annotations for sheet metal parts, comprising the following steps: (1) Obtain the three-dimensional model of the sheet metal unfolded part, read all the faces on the three-dimensional model of the sheet metal unfolded part, and add all the faces to the pre-set face manager AllFaces; Specifically, this step uses the 3D model of the sheet metal unfolded part as the system input, and uses the open-source modeling tool Opencascade to obtain the surfaces in the 3D model of the sheet metal unfolded part, including planes, cylindrical surfaces, conical surfaces, toroidal surfaces, spherical surfaces, etc.

[0022] In this step, the 3D model of the sheet metal unfolded part is first designed by a mechanical structure designer, and then flattened using specific tools (such as CAD software) to obtain the 3D model of the sheet metal unfolded part, as shown in the diagram. Figure 2 As shown.

[0023] (2) Obtain the area of ​​each face in the face manager AllFaces, and take the face with the largest area as the main face; Specifically, this step includes the following sub-steps: (2-1) Initialize the main plane (mainFace) to be empty; (2-2) Initialize the maximum area (maxArea) to 0.0; (2-3) Set the counter i=0; (2-4) Determine if the counter i is less than the total number of faces in the face manager AllFaces. If yes, proceed to step (2-5); otherwise, the process ends. (2-5) Calculate the area of ​​the i-th face AllFaces[i] in the face manager AllFaces using the open-source modeling tool opencascade, and determine whether the area is greater than the maximum area maxArea. If it is, proceed to step (2-6); otherwise, proceed to step (2-7). (2-6) Set the maximum area maxArea=area, and set the main plane mainFace=the i-th face AllFaces[i] in the face manager AllFaces; (2-7) Set the counter i = i + 1 and return to step (2-4); The advantage of this step (2) is that it uses the maximum area to find the main plane, which makes full use of the characteristics of the sheet metal unfolded part 3D model. That is, the sheet metal unfolded part 3D model is a planar 3D model. By using the area to find the main plane, it can achieve automatic surface finding and also ensure accuracy.

[0024] (3) Obtain the outer and inner ring edges on the main plane, and obtain the position matrix M based on the outer and inner ring edges, the center point of the main plane, and the normal vector; Specifically, the edges on the main plane can be divided into inner loop edges or outer loop edges. Both inner loop edges and outer loop edges are sets composed of multiple edges. The type of a single edge in the set is a straight line, an arc, or a circle. The position matrix M can be calculated using the center position and normal vector of the main plane. This step includes the following sub-steps: (3-1) Use the open-source modeling tool Opencascade to obtain all outer and inner ring edges on the main plane; (3-2) Obtain the center point P and normal vector N of the main plane, the three-dimensional coordinates (px, py, pz) of the center point P, and the three-dimensional coordinates (nx, ny, nz) of the normal vector N; (3-3) Obtain the longest outer ring edge, its direction E, and its three-dimensional coordinates (ex, ey, ez) among all the outer ring edges obtained in step (3-1); The process of obtaining the longest outer loop edge among all outer loop edges in this step includes the following sub-steps: (3-3-1) Initialize the maximum side length maxlen to 0, and initialize the counter cnt1 to 0; (3-3-2) Determine if the calculator cnt1 is less than the total number of all outer loop edges obtained in step (3-1). If it is, proceed to step (3-3-3); otherwise, the process ends. (3-3-3) Calculate the length of the cnt1th outer ring edge among all the outer ring edges obtained in step (3-1), and determine whether the length of the cnt1th outer ring edge is greater than the maximum edge length maxlen. If it is, set the maximum edge length maxlen = the length of the cnt1th outer ring edge, and set the cnt1th outer ring edge as the longest outer ring edge among all outer ring edges. Then the process ends. Otherwise, proceed to step (3-3-4). (3-3-4) Set the counter cnt1=cnt1+1 and return to step (3-3-2).

[0025] Find the starting point PS and ending point PE of the longest side, then the direction E = PE - PS. Normalize the direction E to obtain its three-dimensional coordinates ex, ey, and ez. (3-4) Construct a matrix using the center point P and normal vector N obtained in step (3-2) and the direction E obtained in step (3-2), and use the inverse of the matrix as the position matrix M; Specifically, this step involves: first, cross-productting the normal vector N and direction E to obtain direction F; then, normalizing direction F to obtain three-dimensional coordinates (fx, fy, fz); next, constructing matrix T = {fx, fy, fz, 0, ex, ey, ez, 0, nx, ny, nz, 0, px, py, pz, 1} based on the three-dimensional coordinates (fx, fy, fz), the three-dimensional coordinates of direction E, the three-dimensional coordinates of center point P (px, py, pz), and the three-dimensional coordinates of normal vector N (nx, ny, nz); finally, calculating the inverse of matrix T as the position matrix M, i.e., M = T. -1 .

[0026] The advantage of step (3) is that by setting the data of the center point P of the main plane into the position matrix, it can be ensured that the center of the projected outline is exactly located at the origin of the XOY plane, thus ensuring that the projected outline is located at the center of the drawing. Setting the data of the direction E of the longest outer ring edge among all outer ring edges into the position matrix can ensure that the longest outline is located in the horizontal position of the drawing after projection, which can ensure that the projected outline is straight and more in line with the design standards of the cutting drawing.

[0027] (4) Using the position matrix M obtained in step (3), project all the outer and inner ring edges on the main plane mainFace obtained in step (3) onto the XOY plane to obtain multiple outer contour lines and inner contour lines, and add all the outer contour lines and inner contour lines to the pre-set managers outProjs and inProjs respectively. Specifically, the managers outProjs and inProjs are linked lists used to manage data objects. For each edge in the outer and inner loops, its type (straight line, arc, circle) is determined, and the corresponding method is used to project the edge onto the XOY plane to obtain the projection line. The projection line is then added to the managers outProjs or inProjs for management. like Figure 3 As shown, in this step, the position matrix M obtained in step (3) is used to project all the outer ring edges on the main plane mainFace obtained in step (3) onto the XOY plane to obtain multiple outer contour lines, and all the outer contour lines are added to the pre-set manager outProjs. This process includes the following sub-steps: (4-1) Set the counter t=0 and initialize the manager outProjs to empty; (4-2) Determine whether the counter t is less than the total number of all outer ring edges on the main plane mainFace obtained in step (3). If it is, proceed to step (4-3); otherwise, the process ends. (4-3) Obtain the type of the t-th outer ring edge on the main plane mainFace obtained in step (3); Specifically, the t-th data can be directly obtained using the open-source modeling tool Opencascade. Types of outer ring edges.

[0028] (4-4) Determine whether the type of the t-th outer ring edge obtained in step (4-3) is a straight line. If it is, proceed to step (4-5); otherwise, proceed to step (4-7). (4-5) Obtain the three-dimensional coordinates of the starting point and the ending point of the t-th outer ring edge, and multiply them with the position matrix M respectively to obtain the three-dimensional coordinates of the projection point of the starting point and the projection point of the ending point respectively. Specifically, the method for calculating the projection point is to use the matrix multiplication formula to directly obtain the multiplication result based on the three-dimensional coordinates of the starting point and the ending point and the data of the position matrix M in step (3-4), which is the three-dimensional coordinates of the projection point.

[0029] (4-6) Use the three-dimensional coordinates of the starting point and the three-dimensional coordinates of the ending point obtained in step (4-5) to generate a projection line, add the projection line to the manager outProjs, and then proceed to step (4-13). (4-7) Determine whether the type of the t-th outer ring edge obtained in step (4-3) is an arc. If it is, proceed to step (4-8); otherwise, proceed to step (4-10). (4-8) Obtain the three-dimensional coordinates of the starting point, midpoint and ending point of the arc, and multiply them with the position matrix M respectively to obtain the three-dimensional coordinates of the projection point of the starting point, the projection point of the midpoint and the projection point of the ending point. (4-9) Use the three-dimensional coordinates of the starting point, the three-dimensional coordinates of the midpoint, and the three-dimensional coordinates of the ending point obtained in step (4-8) to generate a projected arc, add it to the manager outProjs, and proceed to step (4-13). (4-10) Determine whether the type of the t-th outer ring edge obtained in step (4-3) is a circle. If it is, proceed to step (4-11); otherwise, proceed to step (4-13). (4-11) Obtain the three-dimensional coordinates of the center of the circle, and multiply them with the position matrix M to obtain the three-dimensional coordinates of the projection point of the center of the circle; (4-12) Based on the three-dimensional coordinates and radius of the projection point of the center obtained in step (11), generate the projection circle and add it to the manager outProjs; (4-13) Set the counter t=t+1 and return to step (4-2); The method for generating projection lines for the inner ring edge is the same as the steps described above, and will not be repeated here.

[0030] The advantage of this step (4) is that the method of creating contour lines by using projection is extremely efficient. It transforms the projection calculation of lines into point and matrix operations, which can achieve extremely high computational efficiency while ensuring accuracy.

[0031] (5) Obtain the grids occupied by each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4) on the XOY plane, and add the grids occupied by all outer contour lines and the grids occupied by each inner contour line to the pre-set manager cells. Specifically, in this invention, a grid refers to a series of small squares on the XOY plane, each square having the same height and exceeding the height specified in the dimension. Figure 4 As shown, let the grid height be h. Each grid cell can be represented by the lower left vertex of a square. For example, {0, 0} represents a small square enclosed by the four points (0, 0), (h, 0), (h, h), and (0, h), and {3h, 4h} represents a small square enclosed by the four points (3h, 4h), (4h, 4h), (4h, 5h), and (3h, 5h). Calculate the number of grid cells occupied by each inner and outer contour line in the InProjs manager and add them to the Cells manager. This step involves obtaining the grid cells occupied by each inner contour line in the XOY plane in the manager inProjs obtained in step (4), and adding all the grid cells occupied by the inner contour lines to the pre-set manager cells. This process specifically includes the following sub-steps: (5-1) Set the counter cnt2=0; (5-2) Determine whether the counter cnt2 is less than the total number of inner contour lines in the manager inProjs obtained in step (4). If it is, proceed to step (5-3); otherwise, the process ends. (5-3) Determine whether the type of the inner contour line of the second line in the manager inProjs obtained in step (4) is a straight line, an arc, a circle, or another type. If it is a straight line, proceed to step (5-4); if it is an arc, proceed to step (5-5); if it is a circle, proceed to step (5-6); if it is another type, proceed to step (5-7). (5-4) Obtain the starting point and ending point of the inner contour line of the cnt2th line in the manager inProjs obtained in step (4), as well as the grid corresponding to the starting point and ending point on the XOY plane, and add these grids to the manager cells, and then proceed to step (5-7). Specifically, the process of obtaining the grid corresponding to the starting point is as follows: First, divide the x-coordinate of the starting point by the height h of the grid corresponding to the starting point in the XOY plane to obtain the remainder m. Then, divide the y-coordinate of the starting point by the height h of the grid corresponding to the starting point in the XOY plane to obtain the remainder n. The grid corresponding to the starting point is {m*h, n*h}. Add the grid to the cells manager for management.

[0032] The process of obtaining the grid corresponding to the endpoint is exactly the same as that of the starting point, and will not be repeated here.

[0033] (5-5) Obtain the starting point, midpoint and ending point of the inner contour line of the cnt2th line obtained in the manager inProjs in step (4), as well as the grid corresponding to the starting point, midpoint and ending point on the XOY plane, and add these grids to the manager cells for management, and then proceed to step (5-7). The process of obtaining the grid corresponding to the start point, midpoint, and end point on the XOY plane in this step is exactly the same as that in (5-4) above, and will not be repeated here.

[0034] (5-6) Obtain the center and radius of the inner contour line of the cnt2th inner contour line obtained in step (4), obtain the four quadrant points of the inner contour line of the cnt2th inner contour line according to the center and radius, obtain the grid corresponding to the quadrant point and the center on the XOY plane, and add these grids to the manager cells; Specifically, the method for obtaining the four quadrant points of the cnt2th inner contour line in this step is as follows: let the center coordinates of the cnt2th inner contour line be O(x0, y0) and the radius be r. Then the upper quadrant point is (x0, y0+r), the lower quadrant point is (x0, y0-r), the left quadrant point is (x0-r, y0), and the right quadrant point is (x0+r, y0). By adopting the method in step (5-4), the grid corresponding to the center, upper quadrant point, lower quadrant point, left quadrant point, and right quadrant point on the XOY plane can be calculated respectively.

[0035] (5-7) Set the counter cnt2 = cnt2 + 1, and return to step (5-2); In this step, the process of obtaining the grid cells occupied by each outer contour line in the XOY plane in the manager outProjs obtained in step (4) and adding all the grid cells occupied by the outer contour lines to the pre-set manager cells is exactly the same as the inner contour line above, and will not be described again here. The advantage of this step (5) is that by rasterizing the XOY plane, the position calculation on the XOY plane becomes simpler, and the position of the dimension annotation can be determined more easily, thus improving the calculation efficiency. At the same time, the use of horizontal and vertical grids can ensure that the subsequent dimension annotations are located in the horizontal or vertical direction, making the generated blanking drawing more beautiful and of higher quality. Adding the grid occupied by the inner and outer contour lines to the cells manager in advance can ensure that the generated dimension annotations will not overlap with the inner and outer contour lines, thus improving the clarity and generation quality of the blanking drawing.

[0036] (6) Create corresponding dimension labels for each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4), and add the created dimension labels to the corresponding grid on the XOY plane in the manager cells; like Figure 5 As shown, this step involves creating corresponding dimension annotations for each inner contour line in the manager inProjs obtained in step (4), and adding the created dimension annotations to the corresponding grid on the XOY plane into the manager cells. This process includes the following sub-steps: (6-1) Set the counter cnt3=0; (6-2) Determine whether the counter cnt3 is less than the total number of inner contour lines in the inner contour line manager inProjs obtained in step (4). If yes, proceed to step (6-3); otherwise, the process ends. (6-3) Determine whether the cnt3 inner contour line in the manager inProjs obtained in step (4) is a straight line. If it is, proceed to step (6-4); otherwise, proceed to step (6-7). (6-4) Determine whether the inner contour line of the cnt3th line is a vertical straight line. If it is, proceed to step (6-5); otherwise, proceed to step (6-6). (6-5) Create a dimension to the left or right of the inner contour line of the cnt3 line, and then proceed to step (6-11). Specifically, the method for creating a dimension to the left or right of the cnt3 inner contour line is as follows: First, initialize the direction symbol fl=0, obtain the start point, end point, and coordinates spt(sx, sy) of the cnt3 inner contour line. If the start point coordinates sx>0, set the direction symbol fl=1; otherwise, set the direction symbol fl=-1. Then, use the method in step (5-4) to obtain the grid scell={c0, c1} corresponding to the start point on the XOY plane and the grid ecell={d0, d1} corresponding to the end point on the XOY plane. After that, determine whether the grids scell and ecell are located on the XOY plane. If a cell is not in the manager's cells, dimension labels are created in the grid cells s and e. If it is in the manager's cells, the grid is incremented, i.e., c0 = c0 + h * fl and d0 = d0 + h * fl, where h is the grid height. After each increment, the grid cells s and e are checked to see if they are in the manager's cells. If they are not in the manager's cells, dimension labels are created in the grid cells s and e and the increment process ends. Otherwise, the increment process continues until the grid cells s and e are in the manager's cells.

[0037] Specifically, straight line annotations can be created using the open-source modeling tool Opencascade. The method is to use the Opencascade interface AIS_LengthDimension, input parameters such as the cnt3 inner contour line, dimension height, and grid position to create dimension annotations.

[0038] (6-6) Create a dimension above or below the inner contour line of the cnt3 line, and then proceed to step (6-11). Specifically, the method for creating dimensioning above or below the inner contour line is as follows: First, initialize the direction symbol fl=0, obtain the start point, end point, and coordinates spt(xs, sy) of the cnt3 inner contour line. If the start point coordinates sy>0, set the direction symbol fl=1; otherwise, set the direction symbol fl=-1. Then, use the method in step (5-4) to obtain the grid scell={c0, c1} corresponding to the start point on the XOY plane and the grid ecell={d0, d1} occupied by the end point on the XOY plane. After that, determine whether the grids scell and ecell are located in the XOY plane. If a cell is not in the manager's cells, dimension labels are created in the grid cells s and e. If it is in the manager's cells, the grid is incremented, i.e., c1 = c1 + h * fl and d1 = d1 + h * fl. After each increment, the grid cells s and e are checked to see if they are in the manager's cells. If they are not in the manager's cells, dimension labels are created in the grid cells s and e and the increment process ends. Otherwise, the increment process continues until the grid cells s and e are in the manager's cells.

[0039] (6-7) Determine whether the cnt3 inner contour line is a circle. If it is, proceed to step (6-8); otherwise, proceed to step (6-9). (6-8) Create dimensions around the inner contour line of the cnt3 line, and then proceed to step (6-11). Specifically, the circumference of a circle can be understood as having four directions: up, down, left, and right, or as eight directions: up, down, left, right, upper left, lower left, upper right, and lower right. In this invention, the four directions of up, down, left, and right are used for simplification.

[0040] The method for creating dimension annotations around the circle in this step is to obtain the grids corresponding to the four quadrant points of the circle on the XOY plane, namely top={tx, ty}, bot={bx, by}, left={lx, ly}, and rig={rx, ry}, respectively, using the method in steps (5-6). Then, check whether the four grids top, bot, left, and rig are in the manager cells. If a grid is not in the manager, create a dimension annotation at that grid. If all four grids are in the manager cells, increment the four grids sequentially, i.e., ty=ty+h, by=by-h, lx=lx-h, and rx=rx+h. After the increment is completed, check whether the four grids are in the manager cells. If they are not, create a dimension annotation and end the increment process; otherwise, continue to execute this increment process until all four grids are in the manager cells.

[0041] (6-9) Determine whether the inner contour line of the cnt3th line is an arc. If it is, proceed to step (6-10); otherwise, proceed to step (6-12). (6-10) Create dimensioning around the inner contour line of the third cnt; Specifically, the method for creating dimensioning around the arc is similar to steps (6-8). First, obtain the quadrant points of the arc in the four directions of up, down, left, and right. Then, obtain the four grids corresponding to the quadrant points on the XOY plane and determine whether the four grids are in the manager cells. If not, create dimensioning at the grid. Otherwise, increment the grid. After incrementing, check whether the four grids are in the manager cells. If not, create dimensioning and end the incrementing process. Otherwise, continue executing this incrementing process until all four grids are in the manager cells.

[0042] (6-11) Add the grid where the dimension annotations are created to the cells manager; (6-12) Set the counter cnt3 = cnt3 + 1, and return to step (6-2); The process of creating dimension labels for each outer contour line in the outer contour line manager outProjs obtained in step (4) and adding the corresponding grid on the XOY plane to the manager cells is the same as the process described above, and will not be repeated here.

[0043] The advantages of this step (6) are as follows: First, the inner contour line dimensions are drawn, and then the outer contour line dimensions are drawn. This ensures that the dimensions are arranged from the inside out, making the drawing more organized overall. It also allows the dimensions to be compactly distributed, avoiding large blank areas and making the drawing more aesthetically pleasing. Secondly, for each contour line, multiple directions such as up, down, left, and right are calculated, ensuring that the dimensions are evenly distributed around the drawing and avoiding the problem of dimensions crowding in one direction, resulting in higher quality drawing generation. Finally, the grid position occupied by each dimension on the XOY plane is calculated, ensuring that the dimensions do not overlap with other dimensions and improving the clarity of the drawing.

[0044] (7) Obtain the drawing sheet selected by the user, and scale each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4), as well as the dimension annotations of each outer contour line and each inner contour line, according to the drawing sheet and the manager cells, so as to obtain the blanking drawing with dimension annotations. like Figure 6 As shown, this step includes the following sub-steps: (7-1) Obtain the map sheet selected by the user; Specifically, after the user selects a drawing size, the length and width data of the drawing can be obtained. For example, the length of an A4 drawing is 210 mm and the width is 297 mm, and the length of an A3 drawing is 420 mm and the width is 297 mm.

[0045] (7-2) Initialize the minimum value in the x-direction of the bounding box of the manager cells minx=10000, the maximum value in the x-direction maxx=-10000, the minimum value in the y-direction miny=10000, and the maximum value in the y-direction maxy=-10000; (7-3) Set the counter cnt4=0; (7-4) Determine whether the counter cnt4 is less than the total number of grids in the manager cells. If yes, go to step (7-5); otherwise, go to step (7-7); (7-5) Obtain the coordinates {cx, cy} of the cnt4-th grid in the manager cells, and use the coordinates of this grid to update the minimum value in the x-direction minx, the maximum value in the x-direction maxx, the minimum value in the y-direction miny, and the maximum value in the y-direction maxy of the bounding box; Specifically, if cx is greater than the maximum value in the x-direction maxx, set the maximum value in the x-direction maxx=cx; if cx is less than the minimum value in the x-direction minx, set the minimum value in the x-direction minx=cx; if cy is greater than the maximum value in the y-direction maxy, set the maximum value in the y-direction maxy=cy; if cy is less than the minimum value in the y-direction miny, set the minimum value in the y-direction miny=cy; (7-6) Set the counter cnt4=cnt4+1, and return to step (7-4); (7-7) Update the minimum value in the x-direction minx, the maximum value in the x-direction maxx, the minimum value in the y-direction miny, and the maximum value in the y-direction maxy of the bounding box by using the height of the grid; Specifically, since all grid coordinates are the coordinates of the bottom-left vertex of the grid, and the dimension markings are located outside the grid, the bounding box needs to be enlarged, that is, maxx=maxx+h, minx=minx-h, maxy=maxy+h, miny=miny-h; (7-8) Calculate the scaling factor by using the updated minimum value in the x-direction minx, maximum value in the x-direction maxx, minimum value in the y-direction miny, and maximum value in the y-direction maxy of the bounding box obtained in step (7-7) and the drawing size obtained in step (1), and scale each outer contour line in the manager outProjs, each inner contour line in the manager inProjs obtained in step (4), as well as the dimension markings of each outer contour line and each inner contour line by using the scaling factor, so as to obtain a blanking drawing with dimension markings.

[0046] Specifically, this step involves first calculating the length of the bounding box len = maxx - minx and the width of the bounding box wid = maxy - miny; then, calculating the scaling factor in the x-direction = AX / len and the scaling factor in the y-direction = AY / wid respectively, and taking the larger of the two as the final scaling factor; finally, scaling the dimensions of each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4) according to the final scaling factor and using different development tools (such as the open-source modeling tools Opencascade and objectarx).

[0047] The advantage of this step (7) is that it calculates the bounding box data of the cells in the manager, making full use of the existing data, avoiding the need to recalculate all contour lines and dimensions, thus improving the calculation efficiency. At the same time, it fully considers the range of dimensions, ensuring that the final blanking drawing will not have dimensions exceeding the drawing size. Scaling using the scaling factor is essentially a matrix operation, which will not change the relative position of the contour lines and dimensions, ensuring the accuracy of the generated drawing, while also having high calculation efficiency.

[0048] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for automatically generating blanking drawings with dimension annotations for sheet metal parts, characterized in that, Includes the following steps: (1) Obtain the three-dimensional model of the sheet metal unfolded part, read all the faces on the three-dimensional model of the sheet metal unfolded part, and add all the faces to the pre-set face manager AllFaces; (2) Obtain the area of ​​each face in the face manager AllFaces, and take the face with the largest area as the main face; (3) Obtain the outer and inner ring edges on the main plane, and obtain the position matrix M based on the outer and inner ring edges, the center point of the main plane, and the normal vector; (4) Using the position matrix M obtained in step (3), project all the outer and inner ring edges on the main plane mainFace obtained in step (3) onto the XOY plane to obtain multiple outer contour lines and inner contour lines, and add all the outer contour lines and inner contour lines to the pre-set managers outProjs and inProjs respectively. (5) Obtain the grids occupied by each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4) on the XOY plane, and add the grids occupied by all outer contour lines and the grids occupied by each inner contour line to the pre-set manager cells. (6) Create corresponding dimension labels for each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4), and add the created dimension labels to the corresponding grid on the XOY plane in the manager cells; (7) Obtain the drawing sheet selected by the user, and scale each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4) according to the drawing sheet and the manager cells, as well as the dimension annotations of each outer contour line and each inner contour line, to obtain a blanking drawing with dimension annotations.

2. The method for automatically generating blanking drawings with dimension annotations for sheet metal parts according to claim 1, characterized in that, Step (2) includes the following sub-steps: (2-1) Initialize the main plane (mainFace) to be empty; (2-2) Initialize the maximum area (maxArea) to 0.0; (2-3) Set the counter i = 0; (2-4) Determine if the counter i is less than the total number of faces in the face manager AllFaces. If yes, proceed to step (2-5); otherwise, the process ends. (2-5) Calculate the area of ​​the i-th face AllFaces[i] in the face manager AllFaces using the open-source modeling tool opencascade, and determine whether the area is greater than the maximum area maxArea. If it is, proceed to step (2-6); otherwise, proceed to step (2-7). (2-6) Set the maximum area to maxArea=area, and set the main plane to mainFace=the i-th face AllFaces[i] in the face manager AllFaces; (2-7) Set the counter i = i + 1 and return to step (2-4).

3. The method for automatically generating blanking drawings with dimension annotations for sheet metal parts according to claim 1 or 2, characterized in that, Step (3) includes the following sub-steps: (3-1) Use the open-source modeling tool Opencascade to obtain all outer and inner ring edges on the main plane; (3-2) Obtain the center point P and normal vector N of the main plane, the three-dimensional coordinates (px, py, pz) of the center point P, and the three-dimensional coordinates (nx, ny, nz) of the normal vector N; (3-3) Obtain the longest outer ring edge, its direction E, and its three-dimensional coordinates (ex, ey, ez) among all the outer ring edges obtained in step (3-1); (3-4) Construct a matrix using the center point P and normal vector N obtained in step (3-2) and the direction E obtained in step (3-2), and use the inverse matrix of this matrix as the position matrix M.

4. The method for automatically generating blanking drawings with dimension annotations for sheet metal parts according to claim 3, characterized in that, Step (3-3) involves obtaining the longest outer loop edge among all outer loop edges, which includes the following sub-steps: (3-3-1) Initialize the maximum side length maxlen to 0, and initialize the counter cnt1 to 0; (3-3-2) Determine if the calculator cnt1 is less than the total number of all outer loop edges obtained in step (3-1). If it is, proceed to step (3-3-3); otherwise, the process ends. (3-3-3) Calculate the length of the cnt1th outer ring edge among all the outer ring edges obtained in step (3-1), and determine whether the length of the cnt1th outer ring edge is greater than the maximum edge length maxlen. If it is, set the maximum edge length maxlen = the length of the cnt1th outer ring edge, and set the cnt1th outer ring edge as the longest outer ring edge among all outer ring edges. Then the process ends. Otherwise, proceed to step (3-3-4). (3-3-4) Set the counter cnt1 = cnt1 + 1, and return to step (3-3-2). Steps (3-4) are as follows: First, the normal vector N and direction E are cross-multiplied to obtain direction F. Then, direction F is normalized to obtain three-dimensional coordinates (fx, fy, fz). Next, based on the three-dimensional coordinates (fx, fy, fz), the three-dimensional coordinates of direction E, the three-dimensional coordinates of center point P (px, py, pz), and the three-dimensional coordinates of normal vector N (nx, ny, nz), a matrix T = {fx, fy, fz, 0, ex, ey, ez, 0, nx, ny, nz, 0, px, py, pz, 1} is constructed. Finally, the inverse of matrix T is calculated as the position matrix M, i.e., M = T. -1 .

5. The method for automatically generating blanking drawings with dimension annotations for sheet metal parts according to claim 4, characterized in that, In step (4), using the position matrix M obtained in step (3), all outer ring edges on the main plane mainFace obtained in step (3) are projected onto the XOY plane to obtain multiple outer contour lines, and all outer contour lines are added to the pre-set manager outProjs. This process includes the following sub-steps: (4-1) Set the counter t=0 and initialize the manager outProjs to empty; (4-2) Determine whether the counter t is less than the total number of all outer ring edges on the main plane mainFace obtained in step (3). If it is, proceed to step (4-3); otherwise, the process ends. (4-3) Obtain the type of the t-th outer ring edge on the main plane mainFace obtained in step (3); (4-4) Determine whether the type of the t-th outer ring edge obtained in step (4-3) is a straight line. If it is, proceed to step (4-5); otherwise, proceed to step (4-7). (4-5) Obtain the three-dimensional coordinates of the starting point and the ending point of the t-th outer ring edge, and multiply them with the position matrix M respectively to obtain the three-dimensional coordinates of the projection point of the starting point and the projection point of the ending point respectively. (4-6) Use the three-dimensional coordinates of the starting point and the three-dimensional coordinates of the ending point obtained in step (4-5) to generate a projection line, add the projection line to the manager outProjs, and then proceed to step (4-13). (4-7) Determine whether the type of the t-th outer ring edge obtained in step (4-3) is an arc. If it is, proceed to step (4-8); otherwise, proceed to step (4-10). (4-8) Obtain the three-dimensional coordinates of the starting point, midpoint and ending point of the arc, and multiply them with the position matrix M respectively to obtain the three-dimensional coordinates of the projection point of the starting point, the projection point of the midpoint and the projection point of the ending point. (4-9) Use the three-dimensional coordinates of the starting point, the three-dimensional coordinates of the midpoint, and the three-dimensional coordinates of the ending point obtained in step (4-8) to generate a projected arc, add it to the manager outProjs, and proceed to step (4-13). (4-10) Determine whether the type of the t-th outer ring edge obtained in step (4-3) is a circle. If it is, proceed to step (4-11); otherwise, proceed to step (4-13). (4-11) Obtain the three-dimensional coordinates of the center of the circle, and multiply them with the position matrix M to obtain the three-dimensional coordinates of the projection point of the center of the circle; (4-12) Based on the three-dimensional coordinates and radius of the projection point of the center obtained in step (11), generate the projection circle and add it to the manager outProjs; (4-13) Set the counter t=t+1 and return to step (4-2).

6. The method for automatically generating blanking drawings with dimension annotations for sheet metal parts according to claim 5, characterized in that, Step (5) involves obtaining the grid cells occupied by each inner contour line in the XOY plane in the manager inProjs obtained in step (4), and adding all the grid cells occupied by the inner contour lines to the pre-set manager cells. This process specifically includes the following sub-steps: (5-1) Set the counter cnt2=0; (5-2) Determine if the counter cnt2 is less than the total number of inner contour lines in the manager inProjs obtained in step (4). If it is, proceed to step (5-3); otherwise, the process ends. (5-3) Determine whether the type of the inner contour line of the second line in the manager inProjs obtained in step (4) is a straight line, an arc, a circle, or another type. If it is a straight line, proceed to step (5-4); if it is an arc, proceed to step (5-5); if it is a circle, proceed to step (5-6); if it is another type, proceed to step (5-7). (5-4) Obtain the starting point and ending point of the inner contour line of the cnt2th line in the manager inProjs obtained in step (4), as well as the grid corresponding to the starting point and ending point on the XOY plane, and add these grids to the manager cells, and then proceed to step (5-7). (5-5) Obtain the starting point, midpoint and ending point of the inner contour line of the cnt2th line obtained in the manager inProjs in step (4), as well as the grid corresponding to the starting point, midpoint and ending point on the XOY plane, and add these grids to the manager cells for management, and then proceed to step (5-7). (5-6) Obtain the center and radius of the inner contour line of the cnt2th inner contour line obtained in step (4), obtain the four quadrant points of the inner contour line of the cnt2th inner contour line according to the center and radius, obtain the grid corresponding to the quadrant point and the center on the XOY plane, and add these grids to the manager cells; (5-7) Set the counter cnt2 = cnt2 + 1 and return to step (5-2).

7. The method for automatically generating blanking drawings with dimension annotations for sheet metal parts according to claim 6, characterized in that, Step (6) involves creating corresponding dimension annotations for each inner contour line in the manager inProjs obtained in step (4), and adding the corresponding grid on the XOY plane to the manager cells. This process includes the following sub-steps: (6-1) Set the counter cnt3=0; (6-2) Determine whether the counter cnt3 is less than the total number of inner contour lines in the inner contour line manager inProjs obtained in step (4). If yes, proceed to step (6-3); otherwise, the process ends. (6-3) Determine whether the cnt3 inner contour line in the manager inProjs obtained in step (4) is a straight line. If it is, proceed to step (6-4); otherwise, proceed to step (6-7). (6-4) Determine whether the inner contour line of the cnt3th line is a vertical straight line. If it is, proceed to step (6-5); otherwise, proceed to step (6-6). (6-5) Create a dimension to the left or right of the inner contour line of the cnt3 line, and then proceed to step (6-11). The method for creating dimension annotations to the left or right of the cnt3 inner contour line is as follows: First, initialize the direction symbol fl=0, obtain the start point, end point, and coordinates spt(sx, sy) of the cnt3 inner contour line. If the start point coordinates sx>0, set the direction symbol fl=1; otherwise, set the direction symbol fl=-1. Then, use the method in step (5-4) to obtain the grid scell={c0, c1} corresponding to the start point on the XOY plane and the grid ecell={d0, d1} corresponding to the end point on the XOY plane. After that, determine whether the grids scell and ecell are located in the management area. If a grid cell is not in the manager cells, dimension labels are created in the grid cells scell and ecell. If it is in the manager, the grid is incremented, i.e., c0 = c0 + h * fl and d0 = d0 + h * fl, where h is the grid height. After each increment, the grid cells scell and ecell are checked to see if they are in the manager cells. If they are not in the manager cells, dimension labels are created in the grid cells scell and ecell and the increment process ends. Otherwise, the increment process continues until the grid cells scell and ecell are in the manager cells. (6-6) Create a dimension above or below the inner contour line of the cnt3 line, and then proceed to step (6-11). The method for creating dimension annotations above or below the inner contour line is as follows: First, initialize the direction symbol fl = 0, obtain the start point, end point, and coordinates spt(xs, sy) of the 3rd inner contour line cnt3. If the start point coordinates sy > 0, set the direction symbol fl = 1; otherwise, set the direction symbol fl = -1. Then, use the method in step (5-4) to obtain the grid scell = {c0, c1} corresponding to the start point on the XOY plane and the grid ecell = {d0, d1} occupied by the end point on the XOY plane. After that, determine whether the grids scell and ecell are located in the manager cells. If they are not in the manager cells, then... In lls, dimension labels are created in the grid cells scell and ecell. If the grid is in the manager, the grid is incremented, i.e., c1=c1+h*fl, d1=d1+h*fl. After each increment, the grid cells scell and ecell are checked to see if they are in the manager cells. If they are not in the manager cells, dimension labels are created in the grid cells scell and ecell and the increment process ends. Otherwise, the increment process continues until the grid cells scell and ecell are in the manager cells. (6-7) Determine whether the cnt3 inner contour line is a circle. If it is, proceed to step (6-8); otherwise, proceed to step (6-9). (6-8) Create dimensioning around the inner contour line of the cnt3 line, and then proceed to step (6-11). The method for creating dimension annotations around the circle is as follows: using the method in steps (5-6), obtain the grids corresponding to the four quadrant points of the circle on the XOY plane: top={tx, ty}, bot = {bx, by}, left={lx, ly}, and rig={rx, ry}. Then, check whether the four grids top, bot, left, and rig are in the manager cells. If a grid is not in the manager, create a dimension annotation at that grid. If all four grids are in the manager cells, increment the four grids sequentially, i.e., ty = ty+h, by = by-h, lx = lx-h, and rx = rx+h. After the increment is completed, check whether the four grids are in the manager cells. If not, create a dimension annotation and end the increment process; otherwise, continue to execute this increment process until all four grids are in the manager cells. (6-9) Determine whether the cnt3 inner contour line is an arc. If it is, proceed to step (6-10); otherwise, proceed to step (6-12). (6-10) Create dimensioning around the inner contour line of the third cnt; The specific method for creating dimension annotations around the arc is as follows: First, obtain the quadrant points of the arc in the four directions of up, down, left, and right. Then, obtain the four grids corresponding to the quadrant points on the XOY plane and determine whether the four grids are in the manager cells. If not, create dimension annotations at the grids. Otherwise, increment the grids. After the increment is completed, check whether the four grids are in the manager cells. If not, create dimension annotations and end the increment process. Otherwise, continue to execute this increment process until all four grids are in the manager cells. (6-11) Add the grid where the dimension annotation was created to the cells manager; (6-12) Set the counter cnt3=cnt3+1 and return to step (6-2).

8. The method for automatically generating blanking drawings with dimension annotations for sheet metal parts according to claim 7, characterized in that, Step (7) includes the following sub-steps: (7-1) Obtain the map sheet selected by the user; (7-2) Initialize the bounding box of the cells manager with the minimum x-direction value minx = 10000, the maximum x-direction value maxx = -10000, the minimum y-direction value miny = 10000, and the maximum y-direction value maxy = -10000. (7-3) Set the counter cnt4 = 0; (7-4) Determine if the counter cnt4 is less than the total number of grid cells in the manager cells. If it is, proceed to step (7-5); otherwise, proceed to step (7-7). (7-5) Get the coordinates {cx, cy} of the 4th cell in the cell manager, and use the coordinates of the cell to update the minimum value minx, maximum value maxx, minimum value miny, and maximum value maxy in the bounding box in the x direction; (7-6) Set the counter cnt4 = cnt4 + 1, and return to step (7-4). (7-7) Update the minimum x-direction value minx, maximum x-direction value maxx, minimum y-direction value miny, and maximum y-direction value maxy of the bounding box using the height of the grid; (7-8) Calculate the scaling factor using the updated bounding box obtained in step (7-7) with the minimum x-direction value minx, maximum x-direction value maxx, minimum y-direction value miny, maximum y-direction value maxy and the size of the drawing obtained in step (1). Use the scaling factor to scale each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4), as well as the dimension annotations of each outer contour line and each inner contour line, to obtain a blanking drawing with dimension annotations.

9. The method for automatically generating blanking drawings with dimension annotations for sheet metal parts according to claim 8, characterized in that, In step (7-5), if cx>maximum value in x direction maxx, set the maximum value in x direction maxx=cx; if cx<minimum value in x direction minx, set the minimum value in x direction minx=cx; if cy>maximum value in y direction maxy, set the maximum value in y direction maxy=cy; if cy<minimum value in y direction miny, set the minimum value in y direction miny=cy; Step (7-7) is specifically: set maxx=maxx+h, minx=minx-h, maxy=maxy+h, miny=miny-h; Step (7-8) is specifically: firstly, calculate the length of the bounding box len = maxx-minx, and the width of the bounding box wid=maxy-miny; Then, calculate the scaling factor in the x direction = AX / len and the scaling factor in the y direction = AY / wid respectively, and take the larger value of the two as the final scaling factor; finally, according to the final scaling factor, and using different development tools, perform scaling processing on each outer contour line in the manager outProjs obtained in step (4), each inner contour line in the manager inProjs, and the dimension annotations of each outer contour line and each inner contour line.

10. A system for automatically generating blanking drawings with dimension annotations for sheet metal parts, characterized in that, Comprising: a first module, configured to obtain a 3D model of a unfolded sheet metal part, read all faces on the 3D model of the unfolded sheet metal part, and add all the faces into a preset face manager AllFaces; a second module, configured to obtain the area of each face in the face manager AllFaces, and take the face with the largest area as the main plane mainFace; a third module, configured to obtain outer ring edges and inner ring edges on the main plane mainFace, and obtain a position matrix M according to the outer ring edges and inner ring edges, as well as the center point and normal vector of the main plane mainFace; a fourth module, configured to project all outer ring edges and inner ring edges on the main plane mainFace obtained by the third module onto the XOY plane by using the position matrix M obtained by the third module, so as to obtain a plurality of outer contour lines and inner contour lines, and add all the outer contour lines and inner contour lines into a preset manager outProjs and a preset manager inProjs respectively; a fifth module, configured to obtain respectively the grids occupied on the XOY plane by each outer contour line in the manager outProjs obtained by the fourth module and each inner contour line in the manager inProjs obtained by the fourth module, and add the grids occupied by all outer contour lines and the grids occupied by each inner contour line into a preset manager cells; a sixth module, configured to create corresponding dimension annotations for each outer contour line in the manager outProjs obtained by the fourth module and each inner contour line in the manager inProjs obtained by the fourth module, and add the grids corresponding to the created dimension annotations on the XOY plane into the manager cells; The seventh module is used to obtain the drawing sheet selected by the user, and to scale each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained by the fourth module, as well as the dimension annotations of each outer contour line and each inner contour line, according to the drawing sheet and the manager cells, so as to obtain a blanking drawing with dimension annotations.

Citation Information

Patent Citations

  • Three-dimensional design inspection method and system for sheet metal parts

    CN108829935A

  • System, method and program for processing sheet metal model, and data structure of object-oriented sheet metal model used by same

    JP2007172057A