PCB Graphic File and Drilling File Alignment Method, Equipment, and Storage Medium
By selecting the reference layer pad coordinates in the PCB graphics file, forming a coordinate parameter list and comparing the points, the problem of slow alignment between the graphics file and the drilling file is solved, and efficient and accurate determination of the drilling position is achieved.
Patent Information
- Application Number
- CN202411930469.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2044-12-26
AI Technical Summary
In the prior art, PCB graphics files cannot directly correspond to drilling files, resulting in slow resolution of drilling files and dependent on operator experience, which is easy to miss.
By importing the graphics files of each layer of the PCB, selecting the reference layer pad coordinates to form a list of all possible coordinate parameters, selecting points and pad coordinates to compare, filtering wrong parameters, and using electronic devices and storage media to achieve fast and accurate alignment.
Improve the accuracy and efficiency of the alignment of graphics files and drilling files, reduce human errors, and ensure the accuracy of drilling positions.
Smart Images

Figure CN119740526B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of PCB processing, and particularly to a method, device, and storage medium for aligning PCB graphic files and drilling files. Background Art
[0002] The PCB graphic file refers to various hierarchical files in the PCB board processing process, and the most common type is the gerber file. There are also various graphic information on each layer of graphic files, which are used for subsequent plugging or mounting of various components, and finally obtain the finished product. The drilling file generally refers to a string file with coordinate attributes. After importing the drilling file into the drilling equipment, drilling information is obtained to complete the drilling operation. Plugging components requires drilling and then corresponding to the hole positions for plugging and soldering. This means that the drilling positions indicated by the drilling file and the pad positions reserved in the graphic file are in a corresponding relationship.
[0003] In the PCB design stage, due to different habits of different designers and the lack of a unified standard in the industry, the graphic file and the drilling file cannot be directly corresponding. It is necessary to parse the drilling file, and finally obtain information such as the ratio and unit of the correct drilling file. Only by importing the parsed drilling file into the system can the correct drilling operation be completed.
[0004] The traditional drilling file parsing work is to import the drilling file into a graphic software, generate a virtual component layer using the coordinate file, compare the pad information between the virtual component layer and the graphic layer to determine whether they are aligned. If there is an error, adjustments are made through rotation, translation, etc. This verification process is slow, relies on the experience of the operator, and is prone to omission. Summary of the Invention
[0005] (I) Technical Solution
[0006] To solve the above technical problems, the present invention provides a method, device, and storage medium for aligning PCB graphic files and drilling files.
[0007] The specific technical solution is as follows:
[0008] A method for aligning PCB graphic files and drilling files includes the following steps:
[0009] Step 1: Import the graphic files of each layer of the PCB, select the top layer of the circuit layer as the reference layer, and obtain the pad coordinates and the number of pads in the reference layer;
[0010] Step 2: Import the coordinate data of the drilling file, form a list of all possible coordinate parameter combinations according to the coordinate data; form a hole position diagram according to each group of coordinate parameter lists;
[0011] Step 3: Select at least three points from the hole position diagram, obtain the coordinates of the selected points, and compare these coordinates with all pad coordinates. When there is a one-to-one correspondence between the coordinates of the selected points and the pad coordinates in the reference layer graphic file, confirm that the coordinate parameter list corresponding to this group of hole position diagrams is the standard value;
[0012] In the second step described above, the steps for forming the coordinate parameter list include:
[0013] Step 21: Select the number of digits with the longest length among the coordinate data in the drilling file as the coordinate digit length;
[0014] Step 22: When all coordinate data are of the coordinate digit length, do not omit zeros at this time. When there are differences in the coordinate data lengths, perform leading zero omission and trailing zero omission respectively to make them up to the coordinate digit length;
[0015] Step 23: Select the ratio and unit of the adjusted coordinate data respectively. The coordinate digit length is n, and there are n - 1 kinds of ratios, which are (1, n - 1), (2, n - 2), (3, n - 3)... (n - 2, 2), (n - 1, 1) respectively, and the units are inch or mm respectively, forming 2*(n - 1) groups of coordinate parameter lists.
[0016] Furthermore, in the third step, the steps for comparing the selected points with the pad coordinates include:
[0017] Step 31: Select the first point p from the selected points;
[0018] Step 32: Select each pad coordinate in a loop, calculate the differences between the x-axis data and y-axis data of the pad coordinate and the coordinates of point p respectively, and obtain the offset values of the pad coordinate and point p on the x-axis and y-axis;
[0019] Step 33: Add the offset values to the x-axis and y-axis data of the other selected points respectively. When the calculated point coordinates are the same as the other pad coordinates, recognize that this ratio and unit are the standard values, otherwise they are non-standard values.
[0020] Furthermore, the number of selected points is 5, and the specific selection steps are as follows:
[0021] Step a: Draw a rectangular frame in the hole position diagram. This rectangular frame is the smallest rectangle that includes all the hole positions in the hole position diagram, and the sides of the rectangle are parallel to the x-axis and y-axis respectively;
[0022] Step b: Select the points that are closest to the four corners and the center point of the rectangular frame respectively.
[0023] Furthermore, it also includes filtering error parameters, and the specific steps are:
[0024] Step A: Measure the area of the reference layer pattern. The area of the reference layer pattern refers to the product of the length and width of the pattern file in the reference layer;
[0025] Step B: Measure the area of the rectangular frame delimited in Step A. The area of the rectangular frame refers to the product of the length and width;
[0026] Step C: When the ratio of the area of the rectangular frame to the number of drilled holes is less than 0.001, confirm that the coordinate parameter list corresponding to this set of hole bitmaps is a non-standard value;
[0027] Step D: When the area of the rectangular frame is greater than the area of the reference layer pattern, confirm that the coordinate parameter list corresponding to this set of hole bitmaps is a non-standard value;
[0028] The above steps are before Step 3.
[0029] Based on the same concept, the present invention also provides an electronic device, including a memory and a processor. A program is stored on the memory and can run on the processor. When the program is executed by the processor, the electronic device implements the method described in any one of the above.
[0030] Based on the same concept, the present invention also provides a readable storage medium. A program is stored in the readable storage medium. When the program is executed, the method described in any one of the above is implemented.
[0031] (2) Beneficial effects
[0032] Compared with the prior art, the present invention provides a method that can achieve alignment between a pattern file and a drilled hole file. By forming all coordinate parameter lists, corresponding hole bitmaps are formed, and points with certain identifiers are formed in the hole bitmaps. Coordinate alignment is performed between the points and the pattern file, which can improve the alignment accuracy. At the same time, by selecting effective points during the process, some coordinate parameter lists that obviously do not meet the requirements can be quickly filtered out. On the one hand, the accuracy of the final result is guaranteed, and on the other hand, the alignment work efficiency can also be improved. Description of the drawings
[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0034] Figure 1 For the specific implementation steps of the invention;
[0035] Figure 2 For an example of a PCB pattern design file;
[0036] Figure 3 These are the specific implementation steps of Step 2;
[0037] Figure 4 These are the specific implementation steps of Step 3;
[0038] Figure 5 This is an example of hole selection in the hole position diagram. Specific Embodiments
[0039] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the invention. The described embodiments are only a part of the embodiments of the invention, rather than all of the embodiments. Based on the embodiments in the invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts belong to the scope of protection of the invention.
[0040] In the related prior art, the traditional drilling file parsing work is to import the drilling file into graphic software, generate a virtual component layer using the coordinate file, compare the pad information between the virtual component layer and the graphic layer to determine whether the alignment is correct. If there is an error, adjustment is completed through methods such as rotation and translation. This verification process is relatively slow, relies on the experience of the operator, and is prone to omission.
[0041] Embodiment 1
[0042] Please refer to Figure 1 , to solve the problems existing in the related prior art, the present invention provides a method for aligning PCB graphic files and drilling files, including the following steps:
[0043] Step 1: Import the graphic files of each layer of the PCB, select the top layer of the circuit layer as the reference layer, and obtain the pad coordinates and the number of pads in the reference layer;
[0044] Among them, each layer of graphic file of the PCB is a separate file. The graphic file contains circuit and pad information. Each layer corresponds to a file. The common graphic file is a gerber file. The files of each level are imported in the same size and correspond to each other.
[0045] The pad is the basic component unit of surface mounting, used to form the pad pattern of the circuit board, that is, various pad combinations designed for special component types. The positions of the plug-in components are also the positions where drilling needs to be performed, that is, the corresponding positions of the pads. Please refer to Figure 2 , Figure 2 This is a common PCB graphic design file. Among them, 1 is the circuit graphic, 2 is the pad, and the outer frame represented by 3 is the graphic outer frame. By obtaining the graphic outer frame, the area of the graphic can be calculated.
[0046] Step 2: Import the coordinate data of the drilling file, form a list of all possible coordinate parameters based on the coordinate data, and form a hole position diagram according to each set of coordinate parameter lists.
[0047] The coordinate data of the drilling file refers to the specific position of each hole. In the industry, it is expressed in the form of x and y coordinates, with the unit being inch or mm. Selecting different scales and units can form different point coordinates. By confirming the position of each hole in the same standard coordinate, the corresponding hole position diagram can be obtained.
[0048] Step 3: Select at least three points from the hole position diagram, obtain the coordinates of the selected points, and compare these coordinates with all pad coordinates. When there is a one-to-one correspondence between the coordinates of the selected points and the pad coordinates in the reference layer graphic file, it is confirmed that the coordinate parameter list corresponding to this set of hole position diagrams is the standard value.
[0049] Please refer to Figure 3 , in Step 2, the steps to form the coordinate parameter list include:
[0050] Step 21: Select the number of digits with the longest number of digits in the coordinate data of the drilling file as the coordinate digit length.
[0051] Step 22: When all coordinate data are of the coordinate digit length, do not omit zeros at this time. When there are different coordinate data lengths, perform leading zero omission and trailing zero omission respectively to make up to the coordinate digit length.
[0052] Step 23: Select the scale and unit for the adjusted coordinate data respectively. The coordinate digit length is n, and there are n - 1 kinds of scales, which are (1, n - 1), (2, n - 2), (3, n - 3)... (n - 2, 2), (n - 1, 1) respectively, and the units are inch or mm, forming 2*(n - 1) sets of coordinate parameter lists.
[0053] Table 1 is an example of the coordinate list:
[0054] x y 0335866 0354 002648 0033491 0358463 033448
[0055] The above example will be used to specifically illustrate Steps 21 - 23.
[0056] The coordinate digit length referred to in Step 21 is the maximum number of digits of the coordinates in the coordinate list. In the above example, the maximum number of digits of the three coordinates "0335866", "0033491", and "0358463" is 7, so the maximum number of digits is 7.
[0057] In step 22, when there is a situation where the length of the coordinate number is less than 7 digits, leading zero suppression and trailing zero suppression are respectively performed. Leading zero suppression means that when the number of digits of the coordinate number is less than the coordinate number length, zeros are added in front of the coordinate number until the coordinate number length is reached. Trailing zero suppression means that when the number of digits of the coordinate number is less than the coordinate number length, zeros are added after the coordinate number until the coordinate number length is reached. The above coordinate lists are respectively subjected to leading zero suppression and trailing zero suppression to obtain the following two sets of tables:
[0058] The table after trailing zero suppression is as follows:
[0059] x y 0335866 0354000 0026480 0033491 0358463 0334480
[0060] The table after leading zero suppression is as follows:
[0061] x y 0335866 0000354 0002648 0033491 0358463 0033448
[0062] At this time, the digit length is 7, so there are a total of 6 ratios. The ratio refers to adjusting the size of the coordinate number by adding a decimal point to the number, which are respectively (1,6), (2,5), (3,4), (4,3), (5,2), and (6,1). Corresponding to the table after trailing zero suppression, 6 sets of coordinate parameter lists are formed, which are respectively:
[0063] For trailing zero suppression, the coordinate parameter list corresponding to the ratio (1,6) is:
[0064] x y 0.335866 0.354000 0.026480 0.033491 0.358463 0.334480
[0065] For trailing zero suppression, the coordinate parameter list corresponding to the ratio (2,5) is:
[0066] x y 03.35866 03.54000 00.26480 00.33491 03.58463 03.34480
[0067] For trailing zero suppression, the coordinate parameter list corresponding to the ratio (3,4) is:
[0068] x y 033.5866 035.4000 002.6480 003.3491 035.8463 033.4480
[0069] For trailing zero suppression, the coordinate parameter list corresponding to the ratio (4,3) is:
[0070] x y 0335.866 0354.000 0026.480 0033.491 0358.463 0334.480
[0071] For trailing zero suppression, the coordinate parameter list corresponding to the ratio (5,2) is:
[0072] x y 03358.66 03540.00 00264.80 00334.91 03584.63 03344.80
[0073] For trailing zero suppression, the coordinate parameter list corresponding to the ratio (6,1) is:
[0074] x y 033586.6 035400.0 002648.0 003349.1 035846.3 033448.0
[0075] If the above six groups of coordinate parameter lists respectively select two length units, inch and mm, then 12 groups of coordinate parameter lists are correspondingly obtained; if the trailing zeros are omitted, 12 groups of coordinate parameter lists are also obtained. When the lengths of the coordinate data in the original drilling file are unified, the way of not omitting zeros is adopted, and 12 groups of coordinate parameter lists are also obtained, that is, 2*(n - 1) groups of coordinate parameter lists.
[0076] Import the coordinates in each group of the above coordinate parameter lists into a standard coordinate to form a hole bitmap, and correspondingly form 2*(n - 1) hole bitmaps.
[0077] Please refer to Figure 4 , in step three, the comparison steps between the selected points and the pad coordinates include:
[0078] Step 31: Select the first point p in the selected positions;
[0079] Step 32: Select a pad coordinate in a loop, calculate the differences between the x-axis data and y-axis data of the pad coordinate and the coordinates of point p respectively to obtain the offset values of the pad coordinate and point p on the x-axis and y-axis;
[0080] Step 33: Add the offset values to the x-axis and y-axis data of the other selected points respectively. When the coordinates of the points after the operation are the same as the coordinates of other pads, it is determined that the ratio and unit are standard values, otherwise they are non-standard values.
[0081] Specifically, step 31 means that in the above 2*(n - 1) groups of coordinate parameter lists, select a point p, subtract the x-axis data and y-axis data of the coordinates of this point from the coordinates of each pad on the reference layer in turn to obtain several groups of offset values, and add each group of offset values to the x-axis data and y-axis data of the coordinates of the other selected points respectively. Only when the coordinates of all the other points after the operation exist in the reference layer and are the same as the coordinates of a pad, it means that the selected points correspond to the pad coordinates on the reference layer, and it also means that the coordinate parameter list is a standard value, otherwise it is a non-standard value.
[0082] Please refer to Figure 5 , Figure 5 is an example of a hole bitmap. Specifically, the number of selected points is 5, and the specific selection steps are as follows:
[0083] Step a: Draw a rectangular frame in the hole bitmap. This rectangular frame is the smallest rectangle that includes all the holes in the hole bitmap, and the sides of the rectangle are parallel to the x-axis and y-axis respectively. Among them, the outer frame 4 of the rectangle is the outer frame of the smallest rectangle that includes all the holes;
[0084] Step b: Select the points that are closest to the four corners and the center point of the rectangular frame respectively. Specifically, in Figure 5Among them, point 5 is the point closest to the four corners and the center point of the rectangular frame.
[0085] The above 5 points have corresponding uniqueness, which can effectively avoid the overlap of points with other similar points, thus avoiding the error resulting in the wrong result. At the same time, the more points there are, the more accurate the result of the entire operation will be, and the corresponding amount of calculation will also increase. Considering comprehensively, selecting 5 points in the above way ensures the efficiency on the one hand and also ensures the efficiency of the operation.
[0086] At the same time, the above steps also include filtering error parameters, and the specific steps are as follows:
[0087] Step A: Measure the area of the reference layer pattern. The area of the reference layer pattern refers to the product of the length and width of the pattern file in the reference layer;
[0088] Step B: Measure the area of the rectangular frame defined in step a. The area of the rectangular frame refers to the product of the length and width;
[0089] Step C: When the ratio of the area of the rectangular frame to the number of drilled holes is less than 0.001, confirm that the coordinate parameter list corresponding to this group of hole bitmaps is a non-standard value;
[0090] In step C, when the ratio of the area of the rectangular frame to the number of drilled holes is less than 0.001, it means that there are fewer drilled hole patterns and more drilled holes. It is impossible to achieve multiple holes overlapping in a very small position in the PCB field. This data is obviously unreasonable. Therefore, this group of coordinate parameters is obviously wrong and can be directly defined as a non-standard value. This can reduce unnecessary calculations, and this data mostly appears in the case where leading zeros need to be omitted.
[0091] Step D: When the area of the rectangular frame is greater than the area of the reference layer pattern, confirm that the coordinate parameter list corresponding to this group of hole bitmaps is a non-standard value;
[0092] In step D, when the area of the rectangular frame is greater than the area of the reference layer pattern, it means that the drilled hole position exceeds the area of the reference layer pattern. Since the drilled hole position needs to correspond to the pad information, and the pad information is selected from the reference layer pattern file, it means that the pad information must be within the area of the reference layer pattern. When the area of the rectangular frame is greater than the area of the reference layer pattern, it means that there must be a certain point position exceeding the area of the reference layer pattern. Then the exceeding point position must be confirmed as a non-standard value through the operations of steps 31 - 33. Therefore, it can be directly confirmed that the coordinate parameter list corresponding to this group of hole bitmaps is a non-standard value. This can also filter part of the data, reduce the amount of calculation, and improve work efficiency.
[0093] The above steps are before step three.
[0094] Based on the same concept, the present invention also provides an electronic device, including a memory and a processor. A program that can run on the processor is stored on the memory. When the program is executed by the processor, the electronic device implements any of the above methods.
[0095] Based on the same concept, the present invention also provides a readable storage medium. A program is stored in the readable storage medium. When the program is executed, it implements any of the above methods.
[0096] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for aligning a PCB graphic file and a drilling file, characterized in that: It includes the following steps: Step 1: Import the graphic files of each layer of the PCB, select the top layer of the circuit layer as the reference layer, and obtain the pad coordinates and the number of pads in the reference layer; Step 2: Import the coordinate data of the drilling file, form a list of all possible coordinate parameter lists according to the coordinate data; form a hole bitmap according to each group of coordinate parameter lists; Step 3: Select at least three points from the hole bitmap, obtain the coordinates of the selected points, compare the coordinates with all pad coordinates. When there is a one-to-one correspondence between the coordinates of the selected points and the pad coordinates in the reference layer graphic file, confirm that the coordinate parameter list corresponding to this group of hole bitmaps is the standard value; In the second step, the steps of forming the coordinate parameter list include: Step 21: Select the number of digits with the longest number of digits in the coordinate data of the drilling file as the coordinate digit length; Step 22: When all coordinate data are of the coordinate digit length, do not omit zeros at this time. When there are coordinate data with different lengths, perform leading zero omission and trailing zero omission respectively to make up to the coordinate digit length; Step 23: Select the ratio and unit of the adjusted coordinate data respectively. The coordinate digit length is n, and there are n - 1 kinds of ratios, which are (1, n - 1), (2, n - 2), (3, n - 3)... (n - 2, 2), (n - 1, 1) respectively, and the units are inch or mm respectively, forming 2*(n - 1) groups of coordinate parameter lists.
2. The method for aligning a PCB graphic file and a drilling file according to claim 1, wherein: In the third step, the comparison steps between the selected points and the pad coordinates include: Step 31: Select the first point p from the selected points; Step 32: Loop through each pad coordinate, calculate the differences between the x-axis data and y-axis data of the pad coordinate and the p-point coordinate respectively, and obtain the offset values of the pad coordinate and the p-point on the x-axis and y-axis; Step 33: Add the offset values to the x-axis and y-axis data of the other selected points respectively. When the calculated point coordinates are the same as the other pad coordinates, recognize that this ratio and unit are the standard values, otherwise they are non-standard values.
3. A method for aligning a PCB graphic file and a drilling file according to claim 2, characterized in that: The number of selected points is 5, and the specific selection steps are as follows: Step a: Define a rectangular frame in the hole bitmap. This rectangular frame is the smallest rectangle that includes all the holes in the hole bitmap, and the sides of the rectangle are parallel to the x-axis and y-axis respectively; Step b: Select the points that are closest to the four corners and the center point of the rectangular frame respectively.
4. A method for aligning a PCB graphic file and a drilling file according to claim 3, characterized in that: It also includes filtering error parameters, and the specific steps are: Step A: Measure the area of the reference layer graphic. The area of the reference layer graphic refers to the product of the length and width of the graphic file in the reference layer; Step B: Measure the area of the rectangular frame defined in step a. The area of the rectangular frame refers to the product of the length and width; Step C: When the ratio of the area of the rectangular frame to the number of drill holes is less than 0.001, confirm that the coordinate parameter list corresponding to this group of hole bitmaps is a non-standard value; Step D: When the area of the rectangular frame is greater than the area of the reference layer graphic, confirm that the coordinate parameter list corresponding to this group of hole bitmaps is a non-standard value; The above steps are before step three.
5. An electronic device, characterized in that: It includes a memory and a processor. A program that can run on the processor is stored on the memory. When the program is executed by the processor, the electronic device realizes the method described in any one of claims 1 to 4.
6. A readable storage medium, wherein a program is stored in the readable storage medium, characterized in that, When the said program is executed, the method described in any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Method for inspecting and generating work data of PCB inspection device
CN105844048A
Automatic alignment method for bonding pads in coordinate file and Gerber file
CN113966084A