Method and system for generating blanking drawings with size marks for sheet metal parts
By generating a 3D model of the sheet metal unfolded part, and using projection and dimensioning algorithms to automatically create sheet metal blanking drawings, the problems of time-consuming manual operation and annotation errors in existing methods are solved, and efficient and accurate inner and outer contour lines and dimensioning are achieved.
Patent Information
- Application Number
- CN202511650939.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-12
- Publication Date
- 2026-02-27
AI Technical Summary
Existing methods for generating sheet metal blanking drawings require a lot of manual interaction, cannot automatically generate the inner contour lines of holes, and lack automatic dimension annotation functions, resulting in low efficiency and annotation errors.
By acquiring the 3D model of the sheet metal unfolded part, the outer and inner contour lines are generated using a projection algorithm, and the dimensioning algorithm is used to automatically create dimensioning. Combined with grid management and drawing scaling, a blanking drawing with dimensioning is generated.
The automation level has been improved, and the generated blanking drawings have clear inner and outer contour lines, evenly distributed dimensions, reasonable layout, and conformity to industry standards. This solves the problems of time-consuming and labor-intensive manual work and labeling errors in existing methods.
Smart Images

Figure CN121580458A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of three-dimensional digital process design, and more particularly, relates to a method and system for generating a blanking drawing with size annotations for sheet metal parts BACKGROUND
[0002] Sheet metal blanking drawing is used to represent the unfolded planar state of sheet metal parts before bending, and usually needs to contain information such as peripheral contour line of unfolded parts, internal hole line, size annotation, etc. The industry often uses dwg format or dxf format. As the core bridge connecting sheet metal design and manufacturing, the generation and optimization quality of sheet metal blanking drawing directly affects the efficiency and accuracy of subsequent sheet metal manufacturing.
[0003] There are mainly two methods for generating sheet metal blanking drawing. One is a method of manually calculating bending compensation and drawing blanking drawing, which generates two-dimensional projection lines and manually draws size annotations and other data. The other is a method of semi-automatically generating blanking drawing through three-dimensional CAD software. Engineers can use the existing functions of CAD software to automatically generate two-dimensional projection lines of three-dimensional models of sheet metal unfolded parts, and then manually complete size annotations and other data.
[0004] However, the above two methods for generating sheet metal blanking drawing have some defects that cannot be ignored.
[0005] First, the method of manually calculating bending compensation and drawing blanking drawing needs a lot of manual interactive operation. Designers need to manually complete view creation, layout adjustment, size annotation and other work, which is time-consuming and laborious, especially in large-scale blanking drawing tasks. Second, the method of semi-automatically generating blanking drawing through CAD software has low automation. The two-dimensional contour line generated by CAD software can usually only generate peripheral contour line, and cannot generate internal contour line of hole, so it cannot meet the actual needs of some enterprises. Third, the above two methods for generating sheet metal blanking drawing do not have the function of automatic size annotation. Manual annotation is prone to problems such as size annotation confusion, annotation error, unreasonable layout, and low size detection efficiency. SUMMARY
[0006] In view of the above defects or improvement needs of the prior art, the present application provides a method for generating blanking drawing with size marking for sheet metal parts, which aims to obtain a three-dimensional model of a sheet metal unfolded part, calculate the outer peripheral contour line and the inner contour line on the main plane by using a projection algorithm, automatically create size markings for the contour line by using a size marking algorithm, obtain the bounding box of the contour line and the size markings, automatically scale the contour line and the size markings according to the size of the bounding box and the size of the drawing, and finally generate the blanking drawing with size markings, so as to solve the technical problems that the existing method of manually calculating bending compensation and drawing blanking drawing needs a large amount of manual interactive operation, the designer needs to manually complete view creation, layout adjustment and size marking, etc., resulting in time-consuming and labor-consuming, and the existing method of semi-automatically generating blanking drawing by using CAD software can only generate the outer peripheral contour line, but cannot generate the inner contour line of the hole, thus failing to meet the actual needs of some enterprises, and the above two methods do not have the function of automatic size marking, and manual marking is prone to size marking confusion, marking errors, unreasonable layout, and low size detection efficiency.
[0007] To achieve the above-mentioned purpose, according to one aspect of the present application, a method for automatically generating blanking drawing with size marking for sheet metal parts is provided, comprising the following steps: (1) obtaining a three-dimensional model of a sheet metal unfolded part, reading all faces on the three-dimensional model of the sheet metal unfolded part, and adding all faces to a pre-set face manager AllFaces; (2) obtaining the area of each face in the face manager AllFaces, and taking the face with the largest area as the main plane mainFace; (3) obtaining the outer ring edge and the inner ring edge on the main plane mainFace, and obtaining a position matrix M according to the outer ring edge and the inner ring edge, and the center point and the normal vector of the main plane mainFace; (4) projecting all outer ring edges and inner ring edges on the main plane mainFace obtained in step (3) onto the XOY plane by using the position matrix M obtained in step (3), to obtain a plurality of outer contour lines and inner contour lines, and adding all outer contour lines and inner contour lines to a pre-set manager outProjs and a pre-set manager inProjs, respectively; (5) obtaining the grid occupied by each outer contour line in the manager outProjs and each inner contour line in the manager inProjs on the XOY plane obtained in step (4), and adding the grid occupied by all outer contour lines and the grid occupied by each inner contour line to a pre-set manager cells; (6) creating corresponding dimension tags for each outer contour line in the manager outProjs and each inner contour line in the manager inProjs, and adding the created dimension tags in corresponding grids on the XOY plane into the manager cells; (7) obtaining a selected map by a user, and performing scaling processing on each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4), and the dimension tags of each outer contour line and each inner contour line according to the selected map and the manager cells, to obtain a blanking drawing with dimension tags.
[0008] Preferably, step (2) comprises the following sub-steps: (2-1) initializing the main plane mainFace as null; (2-2) initializing the maximum area number maxArea as 0.0; (2-3) setting a counter i = 0; (2-4) judging whether the counter i is less than the total number of faces in the face manager AllFaces, if yes, turning to step (2-5), otherwise, ending the process; (2-5) calculating the area area of the i-th face AllFaces[i] in the face manager AllFaces by the open source modeling tool opencascade, and judging whether the area area is greater than the maximum area number maxArea, if yes, turning to step (2-6), otherwise, turning to step (2-7); (2-6) setting the maximum area number maxArea = area, and setting the main plane mainFace = the i-th face AllFaces[i] in the face manager AllFaces; (2-7) setting the counter i = i + 1, and returning to step (2-4).
[0009] Preferably, step (3) comprises the following sub-steps: (3-1) obtaining all outer loop edges and all inner loop edges on the main plane mainFace by the open source modeling tool Opencascade; (3-2) obtaining the center point P and the normal vector N of the main plane mainFace, 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) obtaining the outer loop edge with the longest length among all the outer loop edges obtained in step (3-1), the direction E thereof, and the three-dimensional coordinates (ex, ey, ez) thereof; (3-4) Construct a matrix using the center point P and the normal vector N obtained in step (3-2), and the direction E obtained in step (3-2), and take the inverse matrix of the matrix as the position matrix M.
[0010] Preferably, the process of obtaining the outer ring edge with the longest length in all the outer ring edges in step (3-3) comprises the following sub-steps: (3-3-1) Initialize the maximum edge length maxlen to 0, and initialize the counter cnt1 to 0; (3-3-2) Determine whether the counter cnt1 is less than the total number of all the outer ring edges obtained in step (3-1), if yes, go 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 yes, set the maximum edge length maxlen = the length of the cnt1th outer ring edge, and set the cnt1th outer ring edge as the outer ring edge with the longest length among all the outer ring edges, and then the process ends, otherwise, go to step (3-3-4); (3-3-4) Set the counter cnt1 = cnt1 + 1, and return to step (3-3-2); Step (3-4) is specifically, first, cross multiply the normal vector N and the direction E to obtain the direction F, then unitize the direction F to obtain the three-dimensional coordinates (fx, fy, fz), then construct the matrix T = {fx, fy, fz, 0, ex, ey, ez, 0, nx, ny, nz, 0, px, py, pz, 1} according to the three-dimensional coordinates (fx, fy, fz), the three-dimensional coordinates of the direction E, the three-dimensional coordinates of the center point P, and the three-dimensional coordinates of the normal vector N; finally, calculate the inverse matrix of the matrix T as the position matrix M, that is, M = T -1 .
[0011] Preferably, the process of projecting all the outer ring edges on the main plane mainFace obtained in step (3) onto the XOY plane to obtain a plurality of outer contour lines, and adding all the outer contour lines to the pre-set manager outProjs in step (4) comprises the following sub-steps: (4-1) Set the counter t = 0, and initialize the manager outProjs to be empty; (4-2) Determine whether the counter t is less than the total number of all the outer ring edges on the main plane mainFace obtained in step (3), if yes, go to step (4-3), otherwise, the process ends; (4-3) obtaining the type of the tth outer loop edge on the main plane mainFace obtained in step (3); (4-4) judging whether the type of the tth outer loop edge obtained in step (4-3) is a straight line, if yes, turning to step (4-5), otherwise, turning to step (4-7); (4-5) obtaining the three-dimensional coordinates of the start point and the end point of the tth outer loop edge, and multiplying the three-dimensional coordinates with the position matrix M respectively to obtain the three-dimensional coordinates of the projection point of the start point and the three-dimensional coordinates of the projection point of the end point respectively; (4-6) generating a projection straight line by using the three-dimensional coordinates of the projection point of the start point and the three-dimensional coordinates of the projection point of the end point obtained in step (4-5), and adding the projection straight line to the manager outProjs, and turning to step (4-13); (4-7) judging whether the type of the tth outer loop edge obtained in step (4-3) is a circular arc, if yes, turning to step (4-8), otherwise, turning to step (4-10); (4-8) obtaining the three-dimensional coordinates of the start point, the midpoint and the end point of the circular arc, and multiplying the three-dimensional coordinates with the position matrix M respectively to obtain the three-dimensional coordinates of the projection point of the start point, the three-dimensional coordinates of the projection point of the midpoint and the three-dimensional coordinates of the projection point of the end point respectively; (4-9) generating a projection circular arc by using the three-dimensional coordinates of the projection point of the start point, the three-dimensional coordinates of the projection point of the midpoint and the three-dimensional coordinates of the projection point of the end point obtained in step (4-8), and adding the projection circular arc to the manager outProjs, and turning to step (4-13); (4-10) judging whether the type of the tth outer loop edge obtained in step (4-3) is a circle, if yes, turning to step (4-11), otherwise, turning to step (4-13); (4-11) obtaining the three-dimensional coordinates of the center of the circle, and multiplying the three-dimensional coordinates with the position matrix M to obtain the three-dimensional coordinates of the projection point of the center; (4-12) generating a projection circle according to the three-dimensional coordinates of the projection point of the center obtained in step (11) and the radius, and adding the projection circle to the manager outProjs; (4-13) setting the counter t=t+1, and returning to step (4-2).
[0012] Preferably, the process of obtaining the grid occupied by each inner contour line in the manager inProjs obtained in step (4) on the XOY plane in step (5) comprises the following sub-steps: (5-1) setting the counter cnt2=0; (5-2) Determine whether the counter cnt2 is less than the total number of inner contours in the manager inProjs obtained in step (4). If yes, go to step (5-3), otherwise the process ends; (5-3) Determine whether the type of the cnt2th inner contour in the manager inProjs obtained in step (4) is a straight line type, a circular arc type, a circle type, or other type. If it is a straight line type, go to step (5-4); if it is a circular arc type, go to step (5-5); if it is a circle type, go to step (5-6); if it is other type, go to step (5-7); (5-4) Obtain the start point and end point of the cnt2th inner contour in the manager inProjs obtained in step (4), and the corresponding grids of the start point and end point in the XOY plane, and add these grids to the manager cells, and then go to step (5-7); (5-5) Obtain the start point, midpoint and end point of the cnt2th inner contour in the manager inProjs obtained in step (4), and the corresponding grids of the start point, midpoint and end point in the XOY plane, and add these grids to the manager cells, and then go to step (5-7); (5-6) Obtain the center and radius of the cnt2th inner contour in the manager inProjs obtained in step (4), obtain the four quadrant points of the cnt2th inner contour according to the center and radius, obtain the corresponding grids of the quadrant points and the center in 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, the process of creating a corresponding dimension tag for each inner contour in the manager inProjs obtained in step (4) in step (6) and adding the created dimension tag to the corresponding grid in the XOY plane to the manager cells 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 contours in the inner contour manager inProjs obtained in step (4). If yes, go to step (6-3), otherwise the process ends; (6-3) Determine whether the cnt3th inner contour in the manager inProjs obtained in step (4) is a straight line. If yes, go to step (6-4), otherwise go to step (6-7); (6-4) Determine whether the cnt3th inner contour is a vertical straight line. If yes, go to step (6-5), otherwise go to step (6-6); (6-5) Create dimension mark at the left or right of the cnt3th inner contour line, then go to step (6-11); The method of creating dimension mark at the left or right of the cnt3th inner contour line is as follows: first, initialize the direction mark fl=0, get the start point, end point of the cnt3th inner contour line, and the coordinate spt(sx, sy) of the start point, if the start point coordinate sx>0, set the direction mark fl=1, otherwise set the direction mark fl=-1; then, get the grid scell={c0, c1} corresponding to the start point and the grid ecell={d0, d1} corresponding to the end point on XOY plane by the method in step (5-4); thereafter, judge whether the grid scell and ecell are in the manager cells, if not in the manager cells, create dimension mark in the grid scell and ecell, if in the manager, perform increment processing on the grid, i.e. set c0=c0+h*fl, d0=d0+h*fl, wherein h is the grid height, after each increment, check whether the grid scell and ecell are in the manager cells, if not in the manager cells, create dimension mark in the grid scell and ecell and end the increment process, otherwise continue to execute the increment process until the grid scell and ecell are in the manager cells; (6-6) Create dimension mark at the top or bottom of the cnt3th inner contour line, then go to step (6-11); The method of creating dimension mark at the top or bottom of the inner contour line is as follows: first, initialize the direction mark fl=0, get the start point, end point of the cnt3th inner contour line, and the coordinate spt(xs, sy) of the start point, if the start point coordinate sy>0, set the direction mark fl=1, otherwise set the direction mark fl=-1; then, get the grid scell={c0, c1} corresponding to the start point and the grid ecell={d0, d1} corresponding to the end point on XOY plane by the method in step (5-4), thereafter, judge whether the grid scell and ecell are in the manager cells, if not in the manager cells, create dimension mark in the grid scell and ecell, if in the manager, perform increment processing on the grid, i.e. set c1=c1+h*fl, d1=d1+h*fl, after each increment, check whether the grid scell and ecell are in the manager cells, if not in the manager cells, create dimension mark in the grid scell and ecell and end the increment process, otherwise continue to execute the increment process until the grid scell and ecell are in the manager cells; (6-7) judging whether the cnt3th inner contour line is a circle, if yes, go to step (6-8), otherwise go to step (6-9); (6-8) creating a dimension mark around the cnt3th inner contour line, and then go to step (6-11); The method of creating a dimension mark around the circle is that, the four quadrant points of the circle are respectively obtained in the XOY plane by the method in step (5-6), and the four grids top={tx, ty}, bot={bx, by}, left={lx, ly}, and rig={rx, ry} corresponding to the four quadrant points are obtained, then the four grids are checked in sequence, if a certain grid is not in the manager, a dimension mark is created at the grid, if the four grids are all in the manager cells, the four grids are processed in sequence, that is, ty=ty+h, by=by-h, lx=lx-h, and rx=rx+h, after the incrementing is completed, it is checked whether the four grids are in the manager cells, if not, a dimension mark is created and the incrementing process is ended, otherwise the incrementing process is continuously executed until the four grids are all in the manager cells; (6-9) judging whether the cnt3th inner contour line is an arc, if yes, go to step (6-10), otherwise go to step (6-12); (6-10) creating a dimension mark around the cnt3th inner contour line; The method of creating a dimension mark around the arc is that, first, the quadrant points of the arc in the up, down, left and right directions are obtained, then the four grids corresponding to the quadrant points in the XOY plane are obtained, and it is judged whether the four grids are in the manager cells, if not, a dimension mark is created at the grid, otherwise the grids are processed in sequence, after the incrementing is completed, it is checked whether the four grids are in the manager cells, if not, a dimension mark is created and the incrementing process is ended, otherwise the incrementing process is continuously executed until the four grids are all in the manager cells; (6-11) adding the grid where the dimension mark is created into the manager cells; (6-12) setting a counter cnt3=cnt3+1, and returning to step (6-2).
[0014] Preferably, step (7) comprises the following sub-steps: (7-1) obtaining the map selected by the user; (7-2) initializing the minimum value minx=10000 of the bounding box of the manager cells in the x direction, the maximum value maxx=-10000 of the bounding box of the manager cells in the x direction, the minimum value miny=10000 of the bounding box of the manager cells in the y direction, and the maximum value maxy=-10000 of the bounding box of the manager cells in the y direction. (7-3) Set 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 cnt4th grid in the manager cells, and update the x-direction minimum value minx, the x-direction maximum value maxx, the y-direction minimum value miny, and the y-direction maximum value maxy of the bounding box using the coordinates of the grid; (7-6) Set counter cnt4 = cnt4 + 1, and return to step (7-4); (7-7) Update the x-direction minimum value minx, the x-direction maximum value maxx, the y-direction minimum value miny, and the y-direction maximum value maxy of the bounding box using the height of the grid; (7-8) Calculate the scaling factor using the x-direction minimum value minx, the x-direction maximum value maxx, the y-direction minimum value miny, and the y-direction maximum value maxy of the updated bounding box obtained in step (7-7) and the size of the map obtained in step (1), and perform scaling processing on each outer contour line in the manager outProjs and each inner contour line in the manager inProjs, and the size markings of each outer contour line and each inner contour line using the scaling factor, to obtain the cutting drawing with size markings.
[0015] Preferably, in step (7-5), if cx > the x-direction maximum value maxx, set the x-direction maximum value maxx = cx, if the x-direction minimum value cx < minx, set the x-direction minimum value minx = cx, if cy > the y-direction maximum value maxy, set the y-direction maximum value maxy = cy, and if cy < the y-direction minimum value miny, set the y-direction minimum value miny = cy; Step (7-7) is specifically setting maxx = maxx + h, minx = minx - h, maxy = maxy + h, and miny = miny - h; The steps (7-8) are specifically as follows: first, the length len=maxx-minx of the bounding box and the width wid=maxy-miny of the bounding box are calculated; then, the scaling factor in the x direction =AX / len and the scaling factor in the y direction =AY / wid are calculated respectively, and the larger one of the two is taken as the final scaling factor; finally, according to the final scaling factor, each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4), and the dimension mark of each outer contour line and each inner contour line are scaled by using different development tools (for example, the open source modeling tool Opencascade and objectarx).
[0016] According to another aspect of the present application, a system for automatically generating a blank drawing with dimension marks for a sheet metal part is provided, comprising: A first module is configured to obtain a sheet metal unfolded part three-dimensional model, read all faces on the sheet metal unfolded part three-dimensional model, and add all the faces to a pre-set face manager AllFaces; A second module is configured to obtain the area of each face in the face manager AllFaces, and take the face with the largest area as a main plane mainFace; A third module is configured to obtain an outer ring edge and an inner ring edge on the main plane mainFace, and obtain a position matrix M according to the outer ring edge and the inner ring edge, and a center point and a normal vector of the main plane mainFace; A fourth module is configured to project all the outer ring edges and the inner ring edges on the main plane mainFace obtained by the third module onto an XOY plane by using the position matrix M obtained by the third module, to obtain a plurality of outer contour lines and inner contour lines, and add all the outer contour lines and the inner contour lines to a pre-set manager outProjs and a pre-set manager inProjs respectively; A fifth module is configured to obtain the grid occupied by each outer contour line in the manager outProjs and the grid occupied by each inner contour line in the manager inProjs on the XOY plane respectively, and add the grid occupied by all the outer contour lines and the grid occupied by each inner contour line to a pre-set manager cells; A sixth module is configured to create a corresponding dimension mark for each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained by the fourth module, and add the corresponding grid on the XOY plane to the manager cells; The seventh module is used for acquiring the selected map and performing scaling processing on each outer contour line in the manager outProjs and each inner contour line in the manager inProjs and the dimension mark of each outer contour line and each inner contour line according to the map and the manager cells to obtain the blanking drawing paper with the dimension mark.
[0017] Overall, compared with the prior art, the above technical solutions conceived by the present application can achieve the following beneficial effects: (1) The present application greatly improves the automation degree of the present application by adopting step (4) to support automatic acquisition of the inner and outer ring edges on the sheet metal unfolded part three-dimensional model and generation of the inner and outer contour lines, step (6) to support automatic creation of the dimension mark, and step (7) to support automatic scaling of the dimension mark and the contour line, thereby solving the technical problem of the existing method of manually calculating the bending compensation and drawing the blanking drawing, which requires a large amount of manual interactive operation, and the designer needs to manually complete the view creation, layout adjustment and dimension mark, resulting in time-consuming and labor-intensive; (2) The present application can better generate the blanking drawing for the common holes, grooves and other structures in the sheet metal part, and can meet the needs of enterprises by adopting step (4) to support generation of the inner and outer contour lines, and steps (6) and (7) to support automatic generation of the dimension mark and automatic scaling of the dimension mark and the contour line, thereby solving the technical problem of the existing method of semi-automatic generation of the blanking drawing by the CAD software, which can only generate the outer contour line by the two-dimensional contour line generated by the CAD software, and cannot generate the inner contour line of the hole, thus cannot meet the actual needs of some enterprises; (3) The present application can ensure that the dimension mark is from inside to outside and uniformly distributed around the contour line by adopting steps (5) and (6) to rasterize the XOY plane, record the occupied grid of the projection line, and perform dimension marking on the inner and outer contour lines, can make the dimension mark layout more compact and orderly, and can prevent the dimension mark from overlapping and crossing, thereby improving the drawing generation quality and solving the technical problems of the existing two methods without automatic dimension marking function and the manual marking method prone to dimension mark confusion, marking error, unreasonable layout and low dimension detection efficiency; (4) The present application can improve the quality of the blanking drawing generation and make it more in line with the industry standards by adopting steps (2) and (3) to find the main plane by the maximum area, calculate the position matrix by the center of the main plane, normal vector and longest side, and fully utilize the geometric characteristics of the sheet metal unfolded part three-dimensional model to ensure that the final generated projection contour line is located at the center of the map and the longest side of the contour line is flush with the horizontal direction of the map; (5) The algorithm provided by the present application is simple in logic, convenient to expand and modify to match different business scenarios, for example, for part of the scene, only the inner contour line is not needed, and only the inner ring edge is not processed to meet the requirements; for part of the scene, only the appropriate area is found from the unoccupied grid to meet the technical requirements of generating a blanking drawing. (6) The present application has high automation degree, and compared with the existing method, the drawing generation efficiency can be greatly improved. BRIEF DESCRIPTION OF DRAWINGS
[0018] Figure 1 is the overall flowchart of the method for automatically generating a blanking drawing with size annotations for sheet metal parts; Figure 2 is a schematic view of a sheet metal unfolded part three-dimensional model; Figure 3 is a flowchart of projecting the inner and outer ring edges to the XOY plane; Figure 4 is a schematic view of a grid size annotation; Figure 5 is a flowchart of creating corresponding size annotations for the contour line; Figure 6 is a detailed flowchart of step (7) in the method of the present application. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application is further described in detail below in combination with the drawings and examples. It should be understood that the specific examples described herein are only used to explain the present application and do not limit the present application. In addition, the technical features involved in each embodiment of the present application described below can be combined with each other as long as they do not conflict with each other.
[0020] The basic idea of the present application is to provide a method for automatically generating a blanking drawing with size annotations for sheet metal parts. First, the inner and outer contour lines of the blanking drawing are generated using the geometric data of the sheet metal unfolded part, and the size annotations are marked on the inner and outer contour lines. The grid is used to ensure that the size annotations are evenly distributed and will not overlap. Finally, the inner and outer contour lines and the size annotations are scaled according to the bounding box of the grid and the size of the drawing.
[0021] As shown in Figure 1 , the present application provides a method for automatically generating a blanking drawing with size annotations for sheet metal parts, comprising the following steps: (1) Obtain a sheet metal unfolded part three-dimensional model, read all the faces on the sheet metal unfolded part three-dimensional model, and add all the faces to the pre-set face manager AllFaces; Specifically, this step takes the sheet metal unfolded piece three-dimensional model as the system input, and obtains the faces in the sheet metal unfolded piece three-dimensional model, including planes, cylindrical surfaces, conical surfaces, annular surfaces, spherical surfaces, etc. through the open source modeling tool Opencascade.
[0022] The sheet metal unfolded piece three-dimensional model in this step is first designed by a mechanical structure designer, and then flattened through a specific tool (such as CAD software) to obtain the sheet metal unfolded piece three-dimensional model, as shown in the schematic diagram. Figure 2
[0023] (2) Obtain the area of each face in the face manager AllFaces, and take the face with the largest area as the main plane mainFace; Specifically, this step includes the following sub-steps: (2-1) Initialize the main plane mainFace to be empty; (2-2) Initialize the maximum area number maxArea to be 0.0; (2-3) Set the counter i = 0; (2-4) Determine whether the counter i is less than the total number of faces in the face manager AllFaces. If yes, go to step (2-5), otherwise the process ends; (2-5) Calculate the area area of the i-th face AllFaces[i] in the face manager AllFaces through the open source modeling tool opencascade, and determine whether the area area is greater than the maximum area number maxArea. If yes, go to step (2-6), otherwise go to step (2-7); (2-6) Set the maximum area number 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 the main plane is found by using the maximum area, which fully utilizes the characteristics of the sheet metal unfolded piece three-dimensional model, i.e. the sheet metal unfolded piece three-dimensional model is a plane type three-dimensional model. Finding the main plane by area can not only realize automatic face finding, but also ensure accuracy.
[0024] (3) Obtain the outer ring edge and the inner ring edge on the main plane mainFace, and obtain the position matrix M according to the outer ring edge and the inner ring edge, and the center point and normal vector of the main plane mainFace; Specifically, the edges on the main plane mainFace can be divided into inner ring edges or outer ring edges, both of which are sets composed of multiple edges, and the type of a single edge in the set is a straight line, an arc, or a circle. The center position and the normal vector of the main plane mainFace can be used to calculate the position matrix M. This step includes the following sub-steps: (3-1) Obtain all outer ring edges and all inner ring edges on the main plane mainFace by using the open source modeling tool Opencascade. (3-2) Obtain the center point P and the normal vector N of the main plane mainFace, 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 outer ring edge with the longest length among all the outer ring edges obtained in step (3-1), the direction E thereof, and the three-dimensional coordinates (ex, ey, ez) thereof. This process of obtaining the outer ring edge with the longest length among all the outer ring edges in this step includes the following sub-steps: (3-3-1) Initialize the maximum edge length maxlen to 0, and initialize the counter cnt1 to 0. (3-3-2) Determine whether the counter cnt1 is less than the total number of all the outer ring edges obtained in step (3-1). If yes, go 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 yes, set the maximum edge length maxlen = the length of the cnt1th outer ring edge, and set the cnt1th outer ring edge as the outer ring edge with the longest length among all the outer ring edges, and then the process ends, otherwise, go to step (3-3-4). (3-3-4) Set the counter cnt1 = cnt1 + 1, and return to step (3-3-2).
[0025] Obtain the start point PS and the end point PE of the longest edge, and then the direction E = PE-PS. After unitizing the direction E, the three-dimensional coordinates ex, ey, and ez thereof can be obtained. (3-4) Construct a matrix by using the center point P and the normal vector N obtained in step (3-2), and the direction E obtained in step (3-2), and use the inverse matrix of the matrix as the position matrix M. The step is specifically as follows: first, the normal vector N and the direction E are crossed to obtain the direction F, then the direction F is unitized to obtain three-dimensional coordinates (fx, fy, fz), then a matrix T is constructed according to the three-dimensional coordinates (fx, fy, fz), the three-dimensional coordinates of the direction E, 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, that is, T = {fx, fy, fz, 0, ex, ey, ez, 0, nx, ny, nz, 0, px, py, pz, 1}; and finally, the inverse matrix of the matrix T is calculated as the position matrix M, that is, M = T -1 .
[0026] The advantage of the step (3) is that the data of the center point P of the main plane is set to the position matrix, so that the position center of the projected contour line is just located at the coordinate origin of the XOY plane, thereby ensuring that the projected contour line is located at the center of the map sheet. The data of the direction E of the longest outer ring edge in all the outer ring edges is set to the position matrix, so that the longest projected contour line is located at a horizontal position in the map sheet, thereby ensuring that the projected contour line is properly arranged and meets the design standard of the blanking drawing.
[0027] (4) Projecting all the outer ring edges and inner ring edges on the main plane mainFace obtained in the step (3) onto the XOY plane by using the position matrix M obtained in the step (3) to obtain a plurality of outer contour lines and inner contour lines, and adding all the outer contour lines and inner contour lines into the pre-set manager outProjs and manager inProjs respectively; Specifically, the managers outProjs and inProjs are a linked list for managing data objects. For each edge in the outer ring edges and the inner ring edges, it is judged whether the edge is a straight line, a circular arc or a circle, and the corresponding method is used to project the edge onto the XOY plane to obtain a projection line, and the projection line is added into the manager outProjs or inProjs for management. As shown in Figure 3 The process of projecting all the outer ring edges on the main plane mainFace obtained in the step (3) onto the XOY plane by using the position matrix M obtained in the step (3) to obtain a plurality of outer contour lines and adding all the outer contour lines into the pre-set manager outProjs in the step includes the following sub-steps: (4-1) setting a counter t = 0 and initializing the manager outProjs to be empty; (4-2) judging whether the counter t is less than the total number of all the outer ring edges on the main plane mainFace obtained in the step (3), if yes, proceeding to step (4-3), otherwise, ending the process; (4-3) obtaining the type of the tth outer ring edge on the main plane mainFace obtained in the step (3); Specifically, the type of the tth outer ring edge can be directly obtained by the open source modeling tool Opencascade. The type of the outer ring edge.
[0028] (4-4) Determine whether the type of the tth outer ring edge obtained in step (4-3) is a straight line. If yes, go to step (4-5); otherwise, go to step (4-7). (4-5) Obtain the three-dimensional coordinates of the start point and the end point of the tth outer ring edge, and multiply them with the position matrix M respectively to obtain the three-dimensional coordinates of the projection point of the start point and the three-dimensional coordinates of the projection point of the end point. Specifically, the method for calculating the projection point is that, according to the three-dimensional coordinates of the start point and the end point and the data of the position matrix M in step (3-4), the multiplication result can be directly obtained by using the matrix multiplication formula, which is the three-dimensional coordinates of the projection point.
[0029] (4-6) Generate a projection straight line using the three-dimensional coordinates of the projection point of the start point and the three-dimensional coordinates of the projection point of the end point obtained in step (4-5), and add the projection straight line to the manager outProjs, and go to step (4-13). (4-7) Determine whether the type of the tth outer ring edge obtained in step (4-3) is an arc. If yes, go to step (4-8); otherwise, go to step (4-10). (4-8) Obtain the three-dimensional coordinates of the start point, the midpoint and the end 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 start point, the three-dimensional coordinates of the projection point of the midpoint and the three-dimensional coordinates of the projection point of the end point. (4-9) Generate a projection arc using the three-dimensional coordinates of the projection point of the start point, the three-dimensional coordinates of the projection point of the midpoint and the three-dimensional coordinates of the projection point of the end point obtained in step (4-8), and add the projection arc to the manager outProjs, and go to step (4-13). (4-10) Determine whether the type of the tth outer ring edge obtained in step (4-3) is a circle. If yes, go to step (4-11); otherwise, go 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. (4-12) Generate a projection circle according to the three-dimensional coordinates of the projection point of the center obtained in step (11) and the radius, and add the projection circle to the manager outProjs. (4-13) Set the counter t=t+1, and return to step (4-2). The method for generating a projection line for the inner ring edge is the same as the above steps, which will not be described here.
[0030] The step (4) has the advantages that the method of creating the contour line by using the projection method is extremely efficient, the projection calculation of the line is converted into the operation of points and matrix, and extremely high operation efficiency can be achieved under the premise of ensuring accuracy.
[0031] (5) each outer contour line in the manager outProjs obtained in step (4) and each inner contour line in the manager inProjs occupies a grid on the XOY plane, and all the grids occupied by the outer contour lines and the grids occupied by each inner contour line are added to the pre-set manager cells; Specifically, in the present application, the grid refers to a small square on the XOY plane, each square is equal in height and greater than the height of the size mark, as shown in Figure 4 The grid height is h, each grid can be represented by the left lower corner vertex of the square, such as {0, 0} represents a small square surrounded by points (0, 0), (h, 0), (h, h), (0, h), and {3h, 4h} represents a small square surrounded by points (3h, 4h), (4h, 4h), (4h, 5h), (3h, 5h). The occupied grid of each inner contour line in the manager inProjs is calculated and added to the manager cells; In this step, the grid occupied by each inner contour line in the manager inProjs obtained in step (4) on the XOY plane is obtained, and all the grids occupied by the inner contour lines are added to the pre-set manager cells. This process specifically includes the following sub-steps: (5-1) set the counter cnt2 = 0; (5-2) judge whether the counter cnt2 is less than the total number of inner contour lines in the manager inProjs obtained in step (4), if yes, go to step (5-3), otherwise the process is ended; (5-3) judge whether the type of the cnt2th inner contour line in the manager inProjs obtained in step (4) is a straight line type, a circular arc type, a circle type or other types, if it is a straight line type, go to step (5-4), if it is a circular arc type, go to step (5-5), if it is a circle type, go to step (5-6), and if it is other types, go to step (5-7); (5-4) obtain the start point and end point of the cnt2th inner contour line in the manager inProjs obtained in step (4), and the corresponding grid on the XOY plane, and add these grids to the manager cells, and then go to step (5-7); Specifically, the process of obtaining the grid corresponding to the starting point is as follows: first, the x-coordinate of the starting point is divided by the height h of the grid corresponding to the starting point on the XOY plane to obtain a remainder m, and then the y-coordinate of the starting point is divided by the height h of the grid corresponding to the starting point on the XOY plane to obtain a remainder n, the grid corresponding to the starting point is {m*h, n*h}, and the grid is added to the manager cells for management.
[0032] The process of obtaining the grid corresponding to the ending point is 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 cnt2th inner contour line in the manager inProjs obtained in step (4), and the grids 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 go to step (5-7); The process of obtaining the grid corresponding to the starting point, midpoint and ending point on the XOY plane in this step is the same as that of (5-4) above, and will not be repeated here.
[0034] (5-6) Obtain the center and radius of the cnt2th inner contour line in the manager inProjs obtained in step (4), obtain the four quadrant points of the cnt2th inner contour line according to the center and radius, obtain the grids corresponding to the quadrant points and the center on the XOY plane, and add these grids to the manager cells; Specifically, the method of obtaining the four quadrant points of the cnt2th inner contour line in this step is as follows: the coordinates of the center of the cnt2th inner contour line are O(x0, y0), and the radius is 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). The method in step (5-4) can be used to calculate the grids corresponding to the center, upper quadrant point, lower quadrant point, left quadrant point and right quadrant point on the XOY plane.
[0035] (5-7) Set the counter cnt2 = cnt2 + 1, and return to step (5-2); The process of obtaining the grid occupied by each outer contour line in the manager outProjs obtained in step (4) on the XOY plane and adding all the grids occupied by the outer contour lines to the pre-set manager cells is the same as that of the inner contour line above, and will not be repeated here The step (5) has the advantages that the XOY plane is rasterized, the position calculation on the XOY plane is simpler, the position of the dimension mark can be determined more conveniently, and the calculation efficiency is improved; meanwhile, the horizontal and vertical grid is adopted, so that it can be ensured that the subsequent dimension mark is located in the horizontal or vertical direction, the generated blanking drawing is more beautiful, and the quality is higher; the grid occupied by the inner and outer contour lines is added in the manager cells in advance, so that it can be ensured that the subsequent generated dimension mark and the inner and outer contour lines are not overlapped, and the clarity and generation quality of the blanking drawing are improved.
[0036] (6) creating the corresponding dimension mark for each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4), and adding the corresponding grid on the XOY plane in the manager cells; As shown in Figure 5 the step of creating the corresponding dimension mark for each inner contour line in the manager inProjs obtained in step (4) and adding the corresponding grid on the XOY plane in the manager cells includes the following sub-steps: (6-1) setting a counter cnt3=0; (6-2) judging whether the counter cnt3 is less than the total number of the inner contour lines in the manager inProjs obtained in step (4), if yes, turning to step (6-3), otherwise, ending the process; (6-3) judging whether the cnt3th inner contour line in the manager inProjs obtained in step (4) is a straight line, if yes, turning to step (6-4), otherwise, turning to step (6-7); (6-4) judging whether the cnt3th inner contour line is a vertical straight line, if yes, turning to step (6-5), otherwise, turning to step (6-6); (6-5) creating the dimension mark on the left or right side of the cnt3th inner contour line, and then turning to step (6-11); Specifically, the method of creating dimension label on the left or right of the cnt3th inner contour line is as follows: first, initialize the direction mark fl=0, obtain the start point, end point of the cnt3th inner contour line, and the coordinate spt(sx, sy) of the start point, if the start point coordinate sx>0, set the direction mark fl=1, otherwise set the direction mark fl=-1; then, obtain the grid scell={c0, c1} corresponding to the start point on XOY plane and the grid ecell={d0, d1} corresponding to the end point on XOY plane by the method in step (5-4); thereafter, judge whether the grid scell and ecell are located in the manager cells, if not, create dimension label in the grid scell and ecell, if yes, perform increment processing on the grid, that is, set c0=c0+h*fl, d0=d0+h*fl, wherein h is the grid height, after each increment, check whether the grid scell and ecell are located in the manager cells, if not, create dimension label in the grid scell and ecell and end the increment process, otherwise, continuously execute the increment process until the grid scell and ecell are located in the manager cells.
[0037] Specifically, the straight line label can be created by using the open source modeling tool Opencascade, and the method is as follows: input the cnt3th inner contour line, dimension height, grid position and other parameters by using the interface AIS_LengthDimension of the open source modeling tool Opencascade, and the dimension label can be created.
[0038] (6-6) create dimension label above or below the cnt3th inner contour line, and then turn to step (6-11); Specifically, the method of creating dimension notes above or below the inner contour line is that, first, initialize the direction mark fl=0, get the start point and end point of the cnt3th inner contour line, and the coordinate spt(xs, sy) of the start point, if the start point coordinate sy>0, set the direction mark fl=1, otherwise set the direction mark fl=-1; then get the grid scell={c0, c1} corresponding to the start point on XOY plane and the grid ecell={d0, d1} occupied by the end point on XOY plane by the method in step (5-4), thereafter, judge whether the grids scell and ecell are in the manager cells, if not in the manager cells, create dimension notes in the grids scell and ecell, if in the manager, perform incremental processing on the grids, that is, set c1=c1+h*fl, d1=d1+h*fl, after each increment, check whether the grids scell and ecell are in the manager cells, if not in the manager cells, create dimension notes in the grids scell and ecell and end the incremental process, otherwise continue to execute the incremental process until the grids scell and ecell are in the manager cells.
[0039] (6-7) judge whether the cnt3th inner contour line is a circle, if yes, go to step (6-8), otherwise go to step (6-9); (6-8) create dimension notes around the cnt3th inner contour line, and then go to step (6-11); Specifically, the circumference of the circle can be understood as four directions of up, down, left and right, or eight directions of up, down, left, right, left up, left down, right up and right down, in the present application, the four directions of up, down, left and right are adopted for simplifying the processing.
[0040] The method of creating dimension notes around the circle in the present step is that, get the grids top={tx, ty}, bot={bx, by}, left={lx, ly} and rig={rx, ry} corresponding to the four quadrant points of the circle on XOY plane by the method in step (5-6), then check whether the four grids top, bot, left and rig are in the manager cells in turn, if a certain grid is not in the manager, create dimension notes at the grid, if the four grids are all in the manager cells, perform incremental processing on the four grids in turn, that is, ty=ty+h, by=by-h, lx=lx-h, rx=rx+h, after the incremental processing is completed, check whether the four grids are in the manager cells, if not, create dimension notes and end the incremental process, otherwise continue to execute the incremental process until the four grids are all in the manager cells.
[0041] (6-9) judging whether the cnt3th inner contour line is a circular arc, if yes, turning to step (6-10), otherwise, turning to step (6-12); (6-10) creating a dimension mark around the cnt3th inner contour line; Specifically, the method of creating a dimension mark around a circular arc is similar to step (6-8). First, the quadrant points of the circular arc in the four directions of up, down, left and right are obtained. Then, the four grids corresponding to the quadrant points in the XOY plane are obtained. It is judged whether the four grids are in the manager cells. If not, a dimension mark is created at the grid. Otherwise, the grids are incremented. After the increment is completed, it is checked whether the four grids are in the manager cells. If not, the dimension mark is created and the increment process is ended. Otherwise, the increment process is continuously executed until the four grids are in the manager cells.
[0042] (6-11) adding the grid where the dimension mark is created to the manager cells; (6-12) setting the counter cnt3 = cnt3 + 1, and returning to step (6-2); The process of creating a dimension mark for each outer contour line in the manager outProjs obtained in step (4) and adding the corresponding grid of the created dimension mark to the manager cells is the same as the above process, which will not be repeated here.
[0043] The advantages of this step (6) are that the dimension marks of the inner contour lines are drawn first, and then the dimension marks of the outer contour lines are drawn, which can ensure that the dimension marks are arranged from inside to outside, the overall drawing is more organized, and the dimension marks can be distributed compactly without large blank areas, making the drawing more beautiful. Secondly, for each contour line, the directions of up, down, left and right are calculated, which can ensure that the dimension marks are evenly distributed around the drawing, and the problem of crowded dimension marks in one direction is avoided, making the generated drawing of higher quality. Finally, the position of the grid occupied by each dimension mark in the XOY plane is calculated, which can ensure that the dimension marks do not overlap with other dimension marks, improving the clarity of the drawing.
[0044] (7) obtaining the selected map by the user, and scaling 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 marks of each outer contour line and each inner contour line, according to the selected map and the manager cells, to obtain a cutting drawing with dimension marks; As shown in Figure 6 , this step includes the following sub-steps: (7-1) obtaining the selected map by the user; Specifically, the user can obtain the length and width data of the map after selecting the map, such as the length of an A4 map is 210 mm and the width is 297 mm, and the length of an A3 map is 420 mm and the width is 297 mm.
[0045] (7-2) Initialize the minimum value minx of the bounding box of the manager cells in the x direction, the maximum value maxx of the bounding box of the manager cells in the x direction, the minimum value miny of the bounding box of the manager cells in the y direction, and the maximum value maxy of the bounding box of the manager cells in the y direction, wherein minx = 10000, maxx = -10000, miny = 10000, and 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 cnt4th grid in the manager cells, and update the x direction minimum value minx, the x direction maximum value maxx, the y direction minimum value miny, and the y direction maximum value maxy of the bounding box using the coordinates of the grid; Specifically, if cx > the x direction maximum value maxx, set the x direction maximum value maxx = cx, if the x direction minimum value cx < minx, set the x direction minimum value minx = cx, if cy > the y direction maximum value maxy, set the y direction maximum value maxy = cy, and if cy < the y direction minimum value miny, set the y direction minimum value miny = cy; (7-6) Set the counter cnt4 = cnt4 + 1, and return to step (7-4); (7-7) Update the x direction minimum value minx, the x direction maximum value maxx, the y direction minimum value miny, and the y direction maximum value maxy of the bounding box using the height of the grid; Specifically, since the grid coordinates are all the coordinates of the left lower corner vertex of the grid, and the size mark is outside the grid, the bounding box needs to be enlarged, i.e., maxx = maxx + h, minx = minx - h, maxy = maxy + h, and miny = miny - h; (7-8) Calculate the scaling factor using the x direction minimum value minx, the x direction maximum value maxx, the y direction minimum value miny, and the y direction maximum value maxy of the updated bounding box obtained in step (7-7) and the size of the map 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, and the size mark of each outer contour line and each inner contour line using the scaling factor, to obtain the cutting drawing with the size mark.
[0046] The step specifically comprises the following steps. 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 of the x direction =AX / len and the scaling factor of the y direction =AY / wid, respectively, and taking the larger one as the final scaling factor; finally, scaling each outer contour line in the manager outProjs and each inner contour line in the manager inProjs, as well as the dimension mark of each outer contour line and each inner contour line, according to the final scaling factor and using different development tools (such as the open source modeling tool Opencascade and objectarx).
[0047] The step (7) has the advantages that the bounding box data of the manager cells is calculated, the existing data is fully utilized, the calculation efficiency is improved by avoiding the recalculation of all contour lines and dimension marks, the range of the dimension mark is fully considered, the generated blanking drawing is ensured not to have the situation that the dimension mark exceeds the drawing sheet, the scaling by using the scaling factor is essentially a matrix operation, the relative positions of the contour lines and the dimension mark are not changed, the accuracy of the generated drawing is guaranteed, and the calculation efficiency is higher.
[0048] Those skilled in the art can easily understand that the above description is only the preferred embodiment of the present application, and is not used to limit the present application, and any modification, equivalent replacement and improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A method for automatically generating a blank drawing with dimension marks for sheet metal parts, characterized in that, The method comprises the following steps: (1) obtaining a three-dimensional model of a sheet metal unfolding part, reading all faces on the three-dimensional model of the sheet metal unfolding part, and adding all the faces to a pre-set face manager AllFaces; (2) obtaining the area of each face in the face manager AllFaces, and taking the face with the largest area as a main plane mainFace; (3) obtaining an outer ring edge and an inner ring edge on the main plane mainFace, and obtaining a position matrix M according to the outer ring edge and the inner ring edge and a center point and a normal vector of the main plane mainFace; (4) projecting all the outer ring edges and the inner ring edges on the main plane mainFace obtained in step (3) onto an XOY plane by using the position matrix M obtained in step (3) to obtain a plurality of outer contour lines and inner contour lines, and adding all the outer contour lines and the inner contour lines to pre-set managers outProjs and inProjs respectively; (5) obtaining the grid occupied by each outer contour line in the manager outProjs and each inner contour line in the manager inProjs on the XOY plane respectively, and adding the grid occupied by each outer contour line and the grid occupied by each inner contour line to a pre-set manager cells; (6) creating 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 adding the corresponding grid on the XOY plane to the manager cells; (7) obtaining a selected map according to the map and the manager cells, and performing scaling processing on each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained in step (4) and the dimension labels of each outer contour line and each inner contour line to obtain a blanking drawing with dimension labels.
2. The method for automatically generating blank drawing with dimension mark for sheet metal part according to claim 1, characterized in that, Step (2) comprises the following sub-steps: (2-1) initializing the main plane mainFace as empty; (2-2) initializing the maximum area number maxArea as 0.0; (2-3) setting a counter i = 0; (2-4) judging whether the counter i is less than the total number of faces in the face manager AllFaces, if yes, turning to step (2-5), otherwise, ending the process; (2-5) calculating the area area of the i-th face AllFaces[i] in the face manager AllFaces by using an open source modeling tool opencascade, and judging whether the area area is greater than the maximum area number maxArea, if yes, turning to step (2-6), otherwise, turning to step (2-7); (2-6) setting the maximum area number maxArea = area, and setting the main plane mainFace = the i-th face AllFaces[i] in the face manager AllFaces; (2-7) setting the counter i = i + 1, and returning to step (2-4).
3. The method of claim 1 or 2, wherein the method further comprises: Step (3) comprises the following sub-steps: (3-1) Obtain all outer loop edges and all inner loop edges on the main plane mainFace by using the open source modeling tool Opencascade; (3-2) Obtain the center point P and the normal vector N of the main plane mainFace, 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 outer loop edge with the longest length among all the outer loop edges obtained in step (3-1), the direction E thereof, and the three-dimensional coordinates (ex, ey, ez) thereof; (3-4) Construct a matrix by using the center point P and the normal vector N obtained in step (3-2) and the direction E obtained in step (3-2), and take the inverse matrix of the matrix as the position matrix M.
4. The method for automatically generating a blank drawing with size annotations for a sheet metal part according to any one of claims 1 to 3, characterized in that, The process of obtaining the outer loop edge with the longest length among all the outer loop edges in step (3-3) comprises the following sub-steps: (3-3-1) Initialize the maximum edge length maxlen to 0 and initialize the counter cnt1 to 0; (3-3-2) Determine whether the counter cnt1 is less than the total number of all the outer loop edges obtained in step (3-1), if yes, proceed to step (3-3-3), otherwise, the process ends; (3-3-3) Calculate the length of the cnt1th outer loop edge among all the outer loop edges obtained in step (3-1), and determine whether the length of the cnt1th outer loop edge is greater than the maximum edge length maxlen, if yes, set the maximum edge length maxlen = the length of the cnt1th outer loop edge, and set the cnt1th outer loop edge as the outer loop edge with the longest length among all the outer loop edges, and 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); Step (3-4) is specifically, first, the normal vector N and direction E cross multiplication, to get the direction F, then, the direction F unitization, to get three-dimensional coordinates (fx, fy, fz), then, according to the three-dimensional coordinates (fx, fy, fz), the three-dimensional coordinates of direction E, the three-dimensional coordinates of the center point P (px, py, pz), and the three-dimensional coordinates of the normal vector N (nx, ny, nz) construct matrix T = {fx, fy, fz, 0, ex, ey, ez, 0, nx, ny, nz, 0, px, py, pz, 1}; Finally, calculate the inverse matrix of matrix T as the position matrix M, that is, M = T -1 .
5. The method for automatically generating blank drawing with dimension mark for sheet metal part according to claim 4, characterized in that, The process of projecting all the outer loop edges on the main plane mainFace obtained in step (3) onto the XOY plane by using the position matrix M obtained in step (3) to obtain a plurality of outer contour lines, and adding all the outer contour lines to the pre-set manager outProjs in step (4) comprises the following sub-steps: (4-1) Set the counter t = 0, and initialize the manager outProjs to be empty; (4-2) Determine whether the counter t is less than the total number of all the outer loop edges on the main plane mainFace obtained in step (3), if yes, proceed to step (4-3), otherwise, the process ends; (4-3) Obtain the type of the tth outer loop edge on the main plane mainFace obtained in step (3); (4-4) Determine whether the type of the tth outer loop edge obtained in step (4-3) is a straight line, if yes, proceed to step (4-5), otherwise, proceed to step (4-7); (4-5) Obtain the three-dimensional coordinates of the start point and the end point of the tth outer loop edge, and perform multiplication processing with the position matrix M to obtain the projection point three-dimensional coordinates of the start point and the projection point three-dimensional coordinates of the end point, respectively; (4-6) using the start point and the end point of the projection point three-dimensional coordinates obtained in step (4-5) to generate a projection straight line, and add the projection straight line to the manager outProjs, and go to step (4-13); (4-7) determine whether the type of the tth outer ring edge obtained in step (4-3) is a circular arc, if so go to step (4-8), otherwise go to step (4-10); (4-8) obtain the three-dimensional coordinates of the start point, midpoint and end point of the circular arc, and multiply them with the position matrix M to obtain the projection point three-dimensional coordinates of the start point, the midpoint and the end point, respectively; (4-9) using the start point, the midpoint and the end point of the projection point three-dimensional coordinates obtained in step (4-8) to generate a projection circular arc, and add the projection circular arc to the manager outProjs, and go to step (4-13); (4-10) determine whether the type of the tth outer ring edge obtained in step (4-3) is a circle, if so go to step (4-11), otherwise go to step (4-13); (4-11) obtain the three-dimensional coordinates of the center of the circle, and multiply it with the position matrix M to obtain the projection point three-dimensional coordinates of the center of the circle; (4-12) generate a projection circle according to the projection point three-dimensional coordinates of the center of the circle and the radius obtained in step (11), and add the projection circle to the manager outProjs; (4-13) set the counter t=t+1, and return to step (4-2).
6. The method for automatically generating blank drawing with dimension mark for sheet metal part according to claim 5, characterized in that, In step (5), the manager inProjs obtained in step (4) is obtained, and the grid occupied by each inner contour line in the XOY plane is added to the pre-set manager cells, and the process 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 so go to step (5-3), otherwise the process is ended; (5-3) determine whether the type of the cnt2th inner contour line in the manager inProjs obtained in step (4) is a straight line type, a circular arc type, a circle type or other types, if it is a straight line type go to step (5-4), if it is a circular arc type go to step (5-5), if it is a circle type go to step (5-6), if it is other types go to step (5-7); (5-4) obtain the start point and the end point of the cnt2th inner contour line in the manager inProjs obtained in step (4), and the corresponding grid in the XOY plane, and add these grids to the manager cells, and then go to step (5-7); (5-5) obtain the start point, the midpoint and the end point of the cnt2th inner contour line in the manager inProjs obtained in step (4), and the corresponding grid in the XOY plane, and add these grids to the manager cells, and then go to step (5-7); (5-5) obtain the start point, the midpoint and the end point of the cnt2th inner contour line in the manager inProjs obtained in step (4), and the corresponding grid in the XOY plane, and add these grids to the manager cells, and then go to step (5-7); (5-6) Obtain the center and radius of the cnt2th inner contour line in the manager inProjs obtained in step (4), obtain four quadrant points of the cnt2th inner contour line according to the center and the radius, obtain the corresponding grids of the quadrant points and the center in the XOY plane, and add the 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 blank drawing with dimension mark for sheet metal part according to claim 6, characterized in that, The process of creating corresponding dimension tags for each inner contour line in the manager inProjs obtained in step (4) in step (6) and adding the created dimension tags to the corresponding grids in the XOY plane to the manager cells 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 manager inProjs obtained in step (4), if yes, go to step (6-3), otherwise the process is ended; (6-3) Determine whether the cnt3th inner contour line in the manager inProjs obtained in step (4) is a straight line, if yes, go to step (6-4), otherwise go to step (6-7); (6-4) Determine whether the cnt3th inner contour line is a vertical straight line, if yes, go to step (6-5), otherwise go to step (6-6); (6-5) Create a dimension tag on the left or right side of the cnt3th inner contour line, and then go to step (6-11); The method of creating a dimension tag on the left or right side of the cnt3th inner contour line is as follows: first, initialize the direction mark fl=0, obtain the start point, end point of the cnt3th inner contour line, and the coordinate spt(sx, sy) of the start point, if the start point coordinate sx>0, set the direction mark fl=1, otherwise set the direction mark fl=-1; then, obtain the grid scell={c0, c1} corresponding to the start point in the XOY plane and the grid ecell={d0, d1} corresponding to the end point in the XOY plane by the method in step (5-4); thereafter, determine whether the grids scell and ecell are located in the manager cells, if not, create a dimension tag in the grids scell and ecell, if in the manager, perform incremental processing on the grids, that is, set c0=c0+h*fl, d0=d0+h*fl, wherein h is the grid height, after each increment, check whether the grids scell and ecell are in the manager cells, if not, create a dimension tag in the grids scell and ecell and end the incremental process, otherwise continue to execute the incremental process until the grids scell and ecell are located in the manager cells; (6-6) Create a dimension tag on the upper or lower side of the cnt3th inner contour line, and then go to step (6-11); The method of creating dimension mark above or below the inner contour line is that first, the direction mark fl=0 is initialized, the start point and end point of the cnt3th inner contour line and the coordinate spt(xs, sy) of the start point are obtained, if the start point coordinate sy>0, the direction mark fl=1 is set, otherwise the direction mark fl=-1 is set; then the method in step (5-4) is used to obtain the grid scell={c0, c1} corresponding to the start point on XOY plane and the grid ecell={d0, d1} occupied by the end point on XOY plane, thereafter, it is judged whether the grids scell and ecell are located in the manager cells or not, if not, the dimension mark is created in the grids scell and ecell, if in the manager, the grids are processed by increment, that is, c1=c1+h*fl, d1=d1+h*fl, after each increment, it is checked whether the grids scell and ecell are in the manager cells or not, if not, the dimension mark is created in the grids scell and ecell and the increment process is ended, otherwise the increment process is continuously executed until the grids scell and ecell are located in the manager cells; (6-7) it is judged whether the cnt3th inner contour line is a circle or not, if yes, step (6-8) is entered, otherwise step (6-9) is entered; (6-8) the dimension mark is created around the cnt3th inner contour line, and then step (6-11) is entered; The method of creating dimension mark around the circle is that the method in step (5-6) is used to obtain the grids top={tx, ty}, bot={bx, by}, left={lx, ly} and rig={rx, ry} corresponding to the four quadrant points of the circle on XOY plane respectively, then the four grids top, bot, left and rig are checked in turn, if a certain grid is not in the manager, the dimension mark is created at the grid, if the four grids are all in the manager cells, the four grids are processed by increment in turn, that is, ty=ty+h, by=by-h, lx=lx-h, rx=rx+h, after the increment is completed, it is checked whether the four grids are in the manager cells or not, if not, the dimension mark is created and the increment process is ended, otherwise the increment process is continuously executed until the four grids are all located in the manager cells; (6-9) it is judged whether the cnt3th inner contour line is an arc or not, if yes, step (6-10) is entered, otherwise step (6-12) is entered; (6-10) the dimension mark is created around the cnt3th inner contour line; The method for creating the dimension mark around the arc specifically comprises the following steps: firstly, obtaining the quadrant points of the arc in the four directions of up, down, left and right; then, obtaining the four grids corresponding to the quadrant points in the XOY plane; judging whether the four grids are in the manager cells; if not, creating the dimension mark at the grids; otherwise, performing the increment processing on the grids; after the increment processing is completed, checking whether the four grids are in the manager cells; if not, creating the dimension mark and ending the increment process; otherwise, continuously executing the increment process until the four grids are in the manager cells. (6-11) adding the grids where the dimension mark is created into the manager cells; (6-12) setting the counter cnt3 = cnt3 + 1, and returning to step (6-2).
8. The method for automatically generating blank drawing with dimension mark for sheet metal part according to claim 7, characterized in that, Step (7) comprises the following sub-steps: (7-1) obtaining the map sheet selected by the user; (7-2) initializing the minimum value minx = 10000 of the bounding box of the manager cells in the x direction, the maximum value maxx = -10000 of the bounding box of the manager cells in the x direction, the minimum value miny = 10000 of the bounding box of the manager cells in the y direction, and the maximum value maxy = -10000 of the bounding box of the manager cells in the y direction; (7-3) setting the counter cnt4 = 0; (7-4) judging whether the counter cnt4 is less than the total number of grids in the manager cells; if yes, turning to step (7-5); otherwise, turning to step (7-7); (7-5) obtaining the coordinates {cx, cy} of the cnt4th grid in the manager cells, and updating the minimum value minx of the bounding box in the x direction, the maximum value maxx of the bounding box in the x direction, the minimum value miny of the bounding box in the y direction, and the maximum value maxy of the bounding box in the y direction using the coordinates of the grid; (7-6) setting the counter cnt4 = cnt4 + 1, and returning to step (7-4); (7-7) updating the minimum value minx of the bounding box in the x direction, the maximum value maxx of the bounding box in the x direction, the minimum value miny of the bounding box in the y direction, and the maximum value maxy of the bounding box in the y direction using the height of the grid; (7-8) calculating the scaling factor using the updated minimum value minx of the bounding box in the x direction, the maximum value maxx of the bounding box in the x direction, the minimum value miny of the bounding box in the y direction, and the maximum value maxy of the bounding box in the y direction obtained in step (7-7) and the size of the map sheet obtained in step (1), and performing the scaling processing on each outer contour line in the manager outProjs, each inner contour line in the manager inProjs, and the dimension mark of each outer contour line and each inner contour line using the scaling factor, to obtain the blanking drawing with the dimension mark.
9. The method for automatically generating the blanking drawing with the dimension mark for the sheet metal part according to claim 8, wherein In step (7-5), if cx>x direction maximum value maxx, set x direction maximum value maxx=cx, if x direction minimum value cxminx, set y direction minimum value 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, first, calculate the length of the bounding box len=maxx-minx, the width of the bounding box wid=maxy-miny; Then, respectively calculate the x direction scaling factor =AX / len and y direction scaling factor =AY / wid, 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 (such as open source modeling tool Opencascade and objectarx) to scale the management outProjs in step (4) each outer contour line and each inner contour line in the manager inProjs, and the size of each outer contour line and each inner contour line.
10. A system for automatically generating blank drawing with dimensioned marking for sheet metal parts, characterized in that, Comprise: The first module is used for obtaining a sheet metal development three-dimensional model, reading all faces on the sheet metal development three-dimensional model, and adding all faces to a pre-set face manager AllFaces; The second module is used for obtaining the area of each face in the face manager AllFaces, and taking the face with the largest area as the main plane mainFace; The third module is used for obtaining the outer ring edge and the inner ring edge on the main plane mainFace, and obtaining the position matrix M according to the outer ring edge and the inner ring edge, and the center point and normal vector of the main plane mainFace; The fourth module is used for projecting 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, to obtain a plurality of outer contour lines and inner contour lines, and adding all outer contour lines and inner contour lines to the pre-set manager outProjs and the manager inProjs respectively; The fifth module is used for obtaining the grid occupied by each outer contour line in the manager outProjs and each inner contour line in the manager inProjs on the XOY plane respectively, and adding 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 for creating corresponding dimension marks for each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained by the fourth module, and adding the corresponding grid of the created dimension marks on the XOY plane to the manager cells; The seventh module is configured to acquire the selected map sheet, and perform scaling processing on each outer contour line in the manager outProjs and each inner contour line in the manager inProjs obtained by the fourth module, and the size label of each outer contour line and each inner contour line according to the selected map sheet and the manager cells, to obtain the blanking drawing paper with the size label.
Citation Information
Patent Citations
Three-dimensional design inspection method and system for sheet metal parts
CN108829935A
Keyboard
JP1999003158A
Method and device for recognizing forming shape of sheet metal model and storage medium storing program of forming shape recognition method of sheet metal model
JP2001142517A
System, method and program for processing sheet metal model, and data structure of object-oriented sheet metal model used by same
JP2007172057A
Sheet metal model creation device and sheet metal model creation method
US20110032254A1