A method and apparatus for automatically aligning coordinate data with Gerber data
Patent Information
- Application Number
- CN202510471158.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-15
- Publication Date
- 2026-10-23
Smart Images

Figure CN122966499A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of printed circuit board technology, specifically relating to a method and apparatus for automatically aligning coordinate data with Gerber data. Background Technology
[0002] Gerber data is PCB design and manufacturing data containing essential information for manufacturing. While the layers are independent and lack interlayer relationships, exporting it often leads to pad coordinate offsets. This not only limits the intelligent program output of related equipment during PCB manufacturing but also causes deviations in manufacturing accuracy. In such cases, engineers at manufacturing companies typically import component coordinate data and merge it with Gerber data to ensure accuracy in subsequent design and manufacturing. However, in practice, inconsistencies between Gerber data and coordinate data can arise regarding component positions, making accurate coordinate positioning impossible. Currently, engineers align these two data sets manually, finding and merging selected reference points. However, manual alignment is difficult and time-consuming, resulting in low efficiency and consequently reduced PCB production quality. Summary of the Invention
[0003] To address the aforementioned problems in the prior art, this invention provides a method, apparatus, electronic device, and computer-readable storage medium for automatic alignment of coordinate data and Gerber data.
[0004] In a first aspect, embodiments of the present invention provide a method for automatically aligning coordinate data with Gerber data, the method comprising:
[0005] Obtain component coordinate data and Gerber data from the PCB data;
[0006] The component coordinate data is filtered and grouped to obtain the component angle groups;
[0007] A feature graph of the element's coordinate data is obtained by constructing a bounding box in the angle group of the element;
[0008] By constructing a ring in the pad layer of the Gerber data, the pattern that is the same as the feature pattern of the component coordinate data is selected, and thus the feature pattern of the Gerber data is obtained.
[0009] Calculate the angular deviation and initial center deviation between the feature graph of the component coordinate data and the feature graph of the Gerber data;
[0010] The component coordinate data is aligned with the Gerber data based on the angular deviation and the initial center deviation.
[0011] In one embodiment of the present invention, filtering and grouping the component coordinate data to obtain component angle groups includes:
[0012] In the component coordinate data, the components are grouped according to the device type to obtain multiple device type groups;
[0013] Within each device type group, components are grouped according to package name, and symmetrical grouping of packages is retained, resulting in multiple package groups under the corresponding device type group;
[0014] Within each package group, components are grouped according to their angles to obtain multiple angle groups for the components in the corresponding package group.
[0015] In one embodiment of the present invention, a feature graph of the element coordinate data is obtained by constructing a bounding box in the angle group of the element, including:
[0016] Among all angle groups, target angle groups that meet the requirements for the number of components and component angles are selected; and in the obtained target angle groups, triangles are obtained by constructing bounding boxes, and polygons with unique characteristics are obtained as feature graphics of the component coordinate data.
[0017] In one embodiment of the present invention, from all angle groups, a target angle group that meets the requirements for the number of components and the component angles is selected; and from the obtained target angle group, a polygon with unique characteristics is obtained as a feature graphic of the component coordinate data by constructing a bounding box to obtain triangles, including:
[0018] Among all angle groups, select the angle groups with 3 or more components and the component angles being the first and second angles, and use them as the target angle groups.
[0019] In each selected target angle group, the triangle with the largest area formed by the component coordinate points is obtained by constructing a bounding box;
[0020] Among the triangles with the largest area obtained from all target angle groups, the largest one is selected to obtain the feature graphic of the component coordinate data.
[0021] In one embodiment of the present invention, the step of obtaining the triangle with the largest area formed by the component coordinate points in each selected target angle group by constructing a bounding box includes:
[0022] For each selected target angle group, construct a corresponding bounding box with the outermost element edge as the boundary;
[0023] Within the bounding box, obtain the triangle with the largest area among the triangles formed by the component coordinate points by sequential search;
[0024] Among the triangles with the largest areas obtained from all target angle groups, the largest one is selected to obtain the feature image of the component coordinate data, including:
[0025] Select the largest triangle from all the target angle groups with the first angle to obtain the first triangle with the largest area; and select the largest triangle from all the target angle groups with the second angle to obtain the second triangle with the largest area.
[0026] If there is a unique maximum among the first and second largest area triangles, the unique maximum is used as the feature image of the component coordinate data; otherwise, the triangle with the smallest perimeter among the first and second largest area triangles is selected as the feature image of the component coordinate data.
[0027] In one embodiment of the present invention, the first angle is 0° and the second angle is 90°.
[0028] In one embodiment of the present invention, from all angle groups, a target angle group that meets the requirements for the number of components and the component angles is selected; and from the obtained target angle group, a polygon with unique characteristics is obtained as a feature graphic of the component coordinate data by constructing a bounding box to obtain triangles, including:
[0029] Among all angle groups, select the angle groups with 3 or more components and the component angle being the third angle, and use them as the target angle groups.
[0030] In each selected target angle group, all triangles formed by the component coordinate points are obtained by constructing a bounding box, and candidate triangles are obtained by excluding them.
[0031] Among all candidate triangles in the target angle group, the triangle with the largest perimeter is selected to obtain the feature image of the component coordinate data.
[0032] In one embodiment of the present invention, the step of obtaining all triangles composed of element coordinate points in each selected target angle group by constructing a bounding box and excluding candidate triangles includes:
[0033] For each selected target angle group, construct a corresponding bounding box with the outermost element edge as the boundary;
[0034] Within the bounding box, obtain all triangles formed by the coordinate points of the components, and exclude isosceles or equilateral triangles to obtain candidate triangles;
[0035] Among all candidate triangles in the target angle group, the triangle with the largest perimeter is selected to obtain the feature image of the component coordinate data, including:
[0036] If there is only one triangle with the largest perimeter among all candidate triangles, the selected triangle with the largest perimeter will be used as the feature image of the component coordinate data.
[0037] If there are two or more triangles with the largest perimeter among all candidate triangles, perform a polygon construction process, including: selecting an element from the angle group to which each triangle with the largest perimeter belongs, and forming a polygon with more than 3 sides with the element corresponding to the triangle with the largest perimeter; and determining whether there is a unique polygon with the largest perimeter among all the polygons obtained so far; if so, using the unique polygon with the largest perimeter as the feature image of the element coordinate data; if not, repeat the polygon construction process until a unique polygon with the largest perimeter is obtained as the feature image of the element coordinate data.
[0038] In one embodiment of the present invention, the third angle is 0° or 90°.
[0039] In one embodiment of the present invention, by constructing a ring in the pad layer of the Gerber data, patterns identical to the feature patterns of the component coordinate data are selected, thereby obtaining the feature patterns of the Gerber data, including:
[0040] In the pad layer of the Gerber data, multiple rings corresponding to the pad position coordinates are formed with each pad position coordinate as the center and the length of the line segment from any vertex to the other vertices in the feature graph of the obtained component coordinate data as the radius.
[0041] For each ring corresponding to the pad position coordinates, the range is expanded by the corresponding pad size to obtain the expanded area, thereby obtaining all the pads on the ring.
[0042] For all pads on the rings corresponding to the pad position coordinates, select the pattern that is the same as the feature pattern of the component coordinate data from the pattern formed by the pad corresponding to the center and the pads on multiple corresponding rings.
[0043] Based on the selected graphics, the feature graphics of the Gerber data are obtained.
[0044] In one embodiment of the present invention, obtaining the feature graphics of the Gerber data based on the selected graphics includes:
[0045] If there are two selected graphics, determine the corresponding vertices of the two selected graphics, and take the graphic formed by the midpoints of the lines connecting the corresponding vertices as the feature graphics of the Gerber data.
[0046] If at least three graphics are selected, determine the corresponding vertices of all the selected graphics, determine the midpoint of the graphics formed by each group of corresponding vertices, and use the graphics formed by all the midpoints as the feature graphics of the Gerber data.
[0047] In one embodiment of the present invention, aligning the component coordinate data with the Gerber data based on the angular deviation and the initial center deviation includes:
[0048] Based on the angle deviation and the initial center deviation, the Gerber data is subjected to a first offset process to obtain the Gerber data after the first offset.
[0049] Determine any available angle group in the package group corresponding to the feature pattern of the component coordinate data that does not belong to the same angle group as the feature pattern of the component coordinate data.
[0050] For the set of angles to be used, obtain the feature graph of the element coordinate data and the feature graph of the Gerber data after the first offset, and determine whether the coordinates of the corresponding vertices in the two are all the same.
[0051] If so, it confirms that the component coordinate data and the Gerber data are successfully aligned;
[0052] If not, the second center deviation is calculated using the angle deviation and the initial center deviation, and the Gerber data after the first offset is subjected to a second offset processing based on the second center deviation, so as to achieve the alignment of the component coordinate data with the Gerber data.
[0053] Secondly, embodiments of the present invention provide an apparatus for automatically aligning coordinate data with Gerber data, the apparatus comprising:
[0054] The data acquisition module is used to acquire component coordinate data and Gerber data from the PCB data.
[0055] The component grouping module is used to filter and group the component coordinate data to obtain the component angle groups;
[0056] The component coordinate data feature image acquisition module is used to acquire the feature image of the component coordinate data by constructing a bounding box in the angle group of the component.
[0057] The Gerber data feature image acquisition module is used to construct a ring in the pad layer of the Gerber data, filter out the feature images that are the same as the feature images of the component coordinate data, and thus obtain the feature images of the Gerber data.
[0058] The deviation calculation module is used to calculate the angular deviation and initial center deviation between the feature graphics of the component coordinate data and the feature graphics of the Gerber data.
[0059] The data alignment module is used to align the component coordinate data with the Gerber data based on the angle deviation and the initial center deviation.
[0060] Thirdly, embodiments of the present invention provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0061] The memory is used to store computer programs;
[0062] When the processor executes the program stored in the memory, it implements the steps of the automatic alignment method between coordinate data and Gerber data provided in the embodiments of the present invention.
[0063] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of the automatic alignment method between coordinate data and Gerber data provided in embodiments of the present invention.
[0064] The beneficial effects of this invention are:
[0065] The automatic alignment method and apparatus for coordinate data and Gerber data provided in this invention quickly and accurately determine the coordinate relationship between component coordinate data and Gerber data by finding characteristic patterns, calculating center deviation and angular deviation, thereby achieving alignment. Simultaneously, it selects devices with different angles within the same package for verification, effectively ensuring alignment accuracy. This invention can be implemented in software, thus greatly improving the efficiency and accuracy of component coordinate data and Gerber data alignment, effectively improving PCB production efficiency and quality, reducing material waste, and shortening product production cycles. Attached Figure Description
[0066] Figure 1This is a flowchart illustrating a method for automatically aligning coordinate data with Gerber data according to an embodiment of the present invention.
[0067] Figure 2 This is a partial data illustration of the component coordinate data;
[0068] Figure 3 This is a schematic diagram illustrating the process of constructing a bounding box to obtain the triangle with the largest area in an embodiment of the present invention.
[0069] Figure 4 This is a schematic diagram illustrating the construction of multiple rings and the expansion of the rings in the pad layer of Gerber data in an embodiment of the present invention.
[0070] Figure 5 This is a schematic diagram of the characteristic graphics of Gerber data obtained when two graphics are filtered out from the Gerber data in an embodiment of the present invention.
[0071] Figure 6 This is a schematic diagram illustrating the characteristic graphics of Gerber data obtained when at least three graphics are selected from the Gerber data in an embodiment of the present invention.
[0072] Figure 7 This is a schematic diagram showing the angular deviation and initial center deviation between the feature graph of the calculated element coordinate data and the feature graph of the Gerber data in an embodiment of the present invention.
[0073] Figure 8 This is a schematic diagram of the structure of an automatic alignment device for coordinate data and Gerber data provided in an embodiment of the present invention;
[0074] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0075] The present invention will be further described in detail below with reference to specific embodiments, but the implementation of the present invention is not limited thereto.
[0076] To achieve efficient alignment of coordinate data and Gerber data, embodiments of the present invention provide a method, apparatus, electronic device, and computer-readable storage medium for automatic alignment of coordinate data and Gerber data.
[0077] It should be noted that the execution entity of the automatic alignment method between coordinate data and Gerber data provided in this embodiment of the invention can be an automatic alignment device between coordinate data and Gerber data, which can run in an electronic device. This electronic device can be a server or a terminal device, but is not limited to these.
[0078] In a first aspect, embodiments of the present invention provide a method for automatically aligning coordinate data with Gerber data, such as... Figure 1 As shown, the method may include the following steps:
[0079] S1, obtain the component coordinate data and Gerber data of the PCB data;
[0080] Component coordinate data in PCB data refers to the coordinate data of components exported from PCB design software. It includes information such as component type, package name, coordinates, and angles. Gerber data includes information such as pad dimensions and coordinates.
[0081] S2, filter and group the component coordinate data to obtain the component angle group;
[0082] Chip devices or other multi-pin packaged symmetrical components are easily found in existing PCBs. Considering the symmetrical packaging characteristics of these devices, it is easy to quickly find graphic features with the same component coordinate data and Gerber data. By grouping, components that meet the conditions can be quickly located.
[0083] In one optional implementation, S2 may include the following steps:
[0084] S21, In the component coordinate data, the components are grouped according to the device type to obtain multiple device type groups;
[0085] In this step, the components are grouped according to the device type derived from the component name in the component coordinate data. Components of the same device type are grouped together. Component types include resistors, capacitors, inductors, diodes, etc., thereby obtaining multiple device type groups. Of course, there will also be device type groups for multi-pin devices.
[0086] S22, In each device type group, group the components according to the package name, and retain the symmetrical grouping of the packages to obtain multiple package groups under the corresponding device type group;
[0087] This step involves deriving the package name based on the shape information in the coordinates for each device type group, and then grouping the components again according to the package name. This means grouping components with the same package name together to obtain multiple component groups. Then, the component groups with symmetrical packages are retained to obtain multiple package groups under that device type group.
[0088] Please see Figure 2 As shown, Figure 2 This is a partial data set of component coordinates. The first column is the tag number, and the last column is the outline information. The outline information includes C0402 and ESD0402, from which the package name 0402 can be deduced.
[0089] The package name may include 0402, 0608, SOP-XX, QFN-XX, etc.
[0090] Symmetrical packaged components include chip devices and other multi-pin symmetrical packaged components; chip devices include chip resistors, capacitors, inductors (2 pins), etc.
[0091] S23, in each package group, group the components according to the component angle to obtain multiple angle groups of the components under the corresponding package group.
[0092] This step involves grouping components with the same angle into a group for each package group, based on the angle information in the coordinates, thereby obtaining multiple angle groups for the components in that package group.
[0093] The angles of the components include 0°, 45°, 90°, etc.
[0094] S3, by constructing a bounding box in the angle group of the element, a feature graphic of the element coordinate data is obtained;
[0095] In one optional implementation, S3 may include the following steps:
[0096] Among all angle groups, target angle groups that meet the requirements for the number of components and component angles are selected; and in the obtained target angle groups, triangles are obtained by constructing bounding boxes, and polygons with unique characteristics are obtained as feature graphics of the component coordinate data.
[0097] This invention, in its embodiments, obtains a polygon with distinctive features and uniqueness as a feature graphic representing the component coordinate data by constructing triangles within a selected group of target angles. The polygon serving as the feature graphic of the component coordinate data can have 3 sides (i.e., a triangle), or more than 3 sides (i.e., a quadrilateral, pentagon, etc.). Two optional implementation methods are given below.
[0098] (1) Implementation Method 1
[0099] From all angle groups, target angle groups that meet the requirements for both the number of components and their angles are selected. Then, within these target angle groups, bounding boxes are constructed to obtain triangles, and polygons with unique characteristics are acquired as feature graphics for the component coordinate data. These polygons include:
[0100] Step A1: Among all angle groups, select the angle groups with 3 or more components and the component angles being the first angle and the second angle, and use them as the target angle groups.
[0101] For a given angle group, a triangle can only be constructed using the coordinates of the elements if the number of elements is greater than or equal to 3. Hence, there is this limitation on the number of elements.
[0102] In a preferred embodiment, the first angle is 0° and the second angle is 90°. Due to the component characteristics of 0° and 90°, the accuracy of the offset values in the X or Y direction can be effectively guaranteed, and subsequent verification calculations are convenient. Of course, the first and second angles are not limited to 0° and 90°.
[0103] It is understandable that in the target angle group obtained in step A1, there may be multiple target angle groups for the first angle and multiple target angle groups for the second angle.
[0104] Step A2: In each selected target angle group, obtain the triangle with the largest area formed by the component coordinate points by constructing a bounding box;
[0105] By constructing bounding boxes, the amount of data can be effectively reduced, and components that are as dispersed as possible can be quickly located to form a triangle.
[0106] Step A2 specifically includes:
[0107] Step A21: For each selected target angle group, construct the corresponding bounding box with the outermost element edge as the boundary.
[0108] Please see Figure 3 Understand the constructed bounding box.
[0109] Step A22: Within the bounding box, obtain the triangle with the largest area among the triangles formed by the component coordinate points by sequential search.
[0110] Please see Figure 3 For any bounding box, within its boundaries, obtain the triangle with the largest area formed by the coordinates of the components, ordered by the vertices, edges, and points closest to the edges of the bounding box. See also... Figure 3 Taking the target angle group of elements at 0° as an example, when element R4 exists on the bounding box edge, the triangle with the largest area is formed by the coordinates of R1, R5, and R4; when there is no element on the bounding box edge, element R6 with the smallest distance d from the bounding box edge is obtained, and the triangle with the largest area is formed by the coordinates of R1, R5, and R6.
[0111] Using the above method, the triangle with the largest area can be found for each target angle group.
[0112] Step A3: Among the triangles with the largest area obtained from all target angle groups, the largest one is selected to obtain the feature graphic of the component coordinate data.
[0113] Step A3 specifically includes:
[0114] Step A31: Select the largest triangle from the largest triangles obtained from all the target angle groups of the first angle to obtain the first triangle with the largest area; and select the largest triangle from the largest triangles obtained from all the target angle groups of the second angle to obtain the second triangle with the largest area.
[0115] Taking the target angle groups of 0° and 90° as an example, among all the target angle groups of 0°, the triangle with the largest area is selected as the first triangle with the largest area, and among all the target angle groups of 90°, the triangle with the largest area is selected as the second triangle with the largest area.
[0116] Step A32: If there is a unique maximum among the first largest area triangle and the second largest area triangle, the unique maximum is used as the feature image of the component coordinate data; otherwise, the triangle with the smallest perimeter among the first largest area triangle and the second largest area triangle is selected as the feature image of the component coordinate data.
[0117] Using the above example, if the areas of the largest triangles selected from the 0° and 90° target angle groups are not equal, the triangle with the largest area is selected as the feature image of the component coordinate data; if the areas of the largest triangles selected from the 0° and 90° target angle groups are not equal, the triangle with the smallest perimeter is selected as the feature image of the component coordinate data.
[0118] In this embodiment of the invention, by selecting the shape with the largest area and the smallest perimeter as the feature shape of the component coordinate data, the selected components of the component coordinate data can be sufficiently dispersed, so that the feature shape formed is unique, thereby effectively ensuring the accuracy of calculating the center deviation and angle deviation.
[0119] (2) Implementation Method 2
[0120] From all angle groups, target angle groups that meet the requirements for both the number of components and their angles are selected. Then, within these target angle groups, bounding boxes are constructed to obtain triangles, and polygons with unique characteristics are acquired as feature graphics for the component coordinate data. These polygons include:
[0121] Step B1: Among all angle groups, select the angle group with 3 or more components and the component angle being the third angle, and use it as the target angle group.
[0122] In a preferred embodiment, the third angle is 0° or 90°.
[0123] For example, you can choose the 0° angle group as the target angle group. Understandably, there will be multiple target angle groups in this case.
[0124] Step B2: In each selected target angle group, obtain all triangles formed by the component coordinate points by constructing a bounding box, and exclude them to obtain candidate triangles;
[0125] Step B2 specifically includes:
[0126] Step B21: For each selected target angle group, construct the corresponding bounding box with the outermost element edge as the boundary.
[0127] Step B22: Within the bounding box, obtain all triangles formed by the coordinate points of the components, and exclude isosceles triangles or equilateral triangles to obtain candidate triangles;
[0128] Step B2 can yield multiple candidate triangles, and some target angle groups may yield more than one candidate triangle.
[0129] Step B3: Among all candidate triangles in the target angle group, the triangle with the largest perimeter is selected to obtain the feature image of the component coordinate data.
[0130] Step B3 specifically includes:
[0131] Step B31: If there is only one triangle with the largest perimeter among all candidate triangles, the selected triangle with the largest perimeter shall be used as the feature image of the component coordinate data.
[0132] Step B32: If there are more than two triangles with the largest perimeter among all candidate triangles, perform a polygon construction process, including: selecting an element from the angle group to which each triangle with the largest perimeter belongs, and forming a polygon with more than 3 sides with the element corresponding to the triangle with the largest perimeter; and determining whether there is a unique polygon with the largest perimeter among all the polygons obtained so far; if so, using the unique polygon with the largest perimeter as the feature image of the element coordinate data; if not, repeat the polygon construction process until a unique polygon with the largest perimeter is obtained as the feature image of the element coordinate data.
[0133] Specifically, when the triangle with the largest perimeter among all candidate triangles is unique, this unique triangle with the largest perimeter is used as the feature image of the component coordinate data. When the triangle with the largest perimeter among all candidate triangles is not unique, points are added to the triangle with the largest perimeter among the candidate triangles to form a polygon, and then the polygons are compared until the polygon with the largest perimeter is unique, which can then be used as the feature image of the component coordinate data.
[0134] S4, by constructing a ring in the pad layer of the Gerber data, the same pattern as the feature pattern of the component coordinate data is selected, and thus the feature pattern of the Gerber data is obtained;
[0135] In one optional implementation, S4 may include the following steps:
[0136] S41, in the pad layer of the Gerber data, with each pad position coordinate as the center and the length of the line segment from any vertex to the other vertices in the feature graphic of the obtained component coordinate data as the radius, multiple rings corresponding to the pad position coordinates are formed.
[0137] S42, for each ring corresponding to the pad position coordinate, expand the range with the corresponding pad size to obtain the expanded area, thereby obtaining all pads on the ring;
[0138] S43, for all pads on the rings corresponding to the pad position coordinates, select the pattern that is the same as the feature pattern of the component coordinate data from the pattern formed by the pad corresponding to the center and the pads on multiple corresponding rings.
[0139] S44. Based on the selected graphics, obtain the feature graphics of the Gerber data.
[0140] Please see Figure 4 In the Gerber data pad layer, each pad position coordinate is used as the center, and the length of the line segment from any vertex to the remaining vertices in the feature graph of the component coordinate data is used as the radius to form a corresponding ring, thus obtaining multiple rings with the same center.
[0141] For each corresponding ring, expand inwards and outwards within the range of the pad size to obtain the expanded area (e.g., Figure 4 As shown in the figure, all pads within the extended area are obtained, which are all pads on the corresponding ring. By expanding inward and outward, the range of pads on each ring can be expanded.
[0142] For all pads on multiple rings, patterns that match the feature patterns of the component coordinate data are selected from the patterns formed by the pad corresponding to the center and the pads on each ring. This involves iterating through the patterns formed by the pad corresponding to the center and the pads on each ring to obtain patterns that match the feature patterns of the component coordinate data.
[0143] Currently, experimental verification is being conducted based on actual production PCB files. Since there is a unique correspondence between pads and components, the feature graphics of Gerber data and the feature graphics of component coordinate data selected by the above method of this invention are in one-to-one correspondence, and there are basically no cases of non-correspondence.
[0144] The embodiments of the present invention obtain a graphic that is identical to the feature graphic of the component coordinate data by forming a ring, which can effectively reduce the amount of filtering and improve the filtering and search efficiency.
[0145] S44 includes two cases:
[0146] 1) If there are two selected graphics, determine the corresponding vertices of the two selected graphics, and take the graphic formed by the midpoints of the lines connecting the corresponding vertices as the feature graphics of the Gerber data.
[0147] When the feature pattern constituting the component coordinate data is a chip device, since it has a 2-pin pad, two patterns are selected from the Gerber data. The vertices corresponding to the two selected patterns are determined, and the pattern formed by the midpoints of the lines connecting the corresponding vertices is used as the feature pattern of the Gerber data. Figure 5 Taking triangles as an example, connecting the midpoints of the lines connecting the top vertices, the left vertices, and the right vertices of two triangles creates a dashed triangle, which is the feature graph of Gerber data.
[0148] 2) If there are at least 3 selected graphics, determine the corresponding vertices of all selected graphics, determine the midpoint of the graphics formed by each group of corresponding vertices, and take the graphics formed by all midpoints as the feature graphics of the Gerber data.
[0149] When the characteristic graphic of the component coordinate data is a multi-pin symmetrical package component, since it has multiple pins and pads, multiple graphics are selected from the Gerber data. The vertices corresponding to each other of these multiple selected graphics are determined, and the graphic enclosed by the center points of the graphic formed by the corresponding vertices is taken as the characteristic graphic of the Gerber data. Figure 6 Taking a multi-pin symmetrical packaged component as a 4-pin device, and the Gerber data filtering pattern as a triangle as an example, the top vertices of the four triangles are used to form a quadrilateral, and the center point of this quadrilateral is taken as the new top vertex; the left vertices of the four triangles are used to form a quadrilateral, and the center point of this quadrilateral is taken as the new left vertex; the right vertices of the four triangles are used to form a quadrilateral, and the center point of this quadrilateral is taken as the new right vertex. Then, the new top vertex, the new left vertex, and the new right vertex are connected to obtain a dashed triangle, which is the characteristic pattern of the Gerber data.
[0150] Through the processing in step S4 above, the feature graph of the obtained Gerber data is exactly the same as the feature graph of the component coordinate data.
[0151] S5, calculate the angular deviation and initial center deviation between the feature graph of the component coordinate data and the feature graph of the Gerber data;
[0152] The process of calculating the angle deviation includes:
[0153] 1) Determine a set of corresponding edges between the feature graph of the component coordinate data and the feature graph of the Gerber data;
[0154] by Figure 7 As an example, the feature graphs of the component coordinate data and the Gerber data are triangles. Assume the left triangle is the feature graph of the component coordinate data and the right triangle is the feature graph of the Gerber data, where AB = A1B1, AC = A1C1, and BC = B1C1. Side AB in the left triangle and side A1B1 in the right triangle can be selected as a pair of corresponding sides; however, the selection method is not limited to this.
[0155] 2) Calculate the angle between the vectors of each side in the selected set of corresponding sides, and use it as the angular deviation between the feature graph of the component coordinate data and the feature graph of the Gerber data;
[0156] As mentioned above Figure 7 For example, the angle between vectors AB and A1B1 can be calculated as the angular deviation between the feature graph of the element coordinate data and the feature graph of the Gerber data.
[0157] The process of calculating the initial center deviation includes:
[0158] 1) Calculate the centroid coordinates of the feature graphic of the component coordinate data based on the vertex coordinates of the feature graphic of the component coordinate data;
[0159] 2) Calculate the centroid coordinates of the feature graph of the Gerber data based on the vertex coordinates of the feature graph of the Gerber data;
[0160] For methods on calculating the centroid coordinates of a graphic, please refer to the relevant technical explanations; they will not be explained here.
[0161] 3) Calculate the initial center deviation between the feature graph of the component coordinate data and the feature graph of the Gerber data based on the centroid coordinates of the feature graph of the component coordinate data and the centroid coordinates of the feature graph of the Gerber data.
[0162] This step involves calculating the initial center deviation (ΔX0, ΔY0) between the feature graph of the component coordinate data and the feature graph of the Gerber data based on the difference between the two centroid coordinates.
[0163] S6, Align the component coordinate data with the Gerber data according to the angle deviation and the initial center deviation.
[0164] In one optional implementation, S6 includes the following steps:
[0165] S61, Based on the angle deviation and the initial center deviation, the Gerber data is subjected to a first offset process to obtain the Gerber data after the first offset;
[0166] This step involves using the angular deviation and the initial center deviation to perform a first offset on the Gerber data to achieve error compensation, resulting in compensated Gerber data as the Gerber data after the first offset.
[0167] The first offset process can be as follows: Add the angle deviation and the initial center deviation to the Gerber data to ensure that a set of corresponding edges of the feature graph of the adjusted Gerber data and the feature graph of the component coordinate data coincide. Then, determine whether the remaining set of vertices coincides. If they coincide, the adjusted Gerber data at this point is the Gerber data after the first offset. If they do not coincide, adjust the feature graph of the adjusted Gerber data by rotating it 180 degrees and mirroring it to ensure that the remaining set of vertices coincides. Then, use this Gerber data as the Gerber data after the first offset. The 180-degree rotation and mirroring processes are not performed in any particular order.
[0168] S62, determine any available angle group in the package group corresponding to the feature pattern of the component coordinate data that does not belong to the same angle group as the feature pattern of the component coordinate data.
[0169] It is understandable that when determining the feature pattern of the component coordinate data, it is possible to determine its package group or its angle group. In this case, within the same package group, any different angle group can be selected as the angle group to be used.
[0170] S63, for the group of angles to be used, obtain the feature graph of the element coordinate data and the feature graph of the Gerber data after the first offset, and determine whether the coordinates of the corresponding vertices in the two are all the same.
[0171] If so, it confirms that the component coordinate data and the Gerber data are successfully aligned;
[0172] If not, the second center deviation is calculated using the angle deviation and the initial center deviation, and the Gerber data after the first offset is subjected to a second offset processing based on the second center deviation, so as to achieve the alignment of the component coordinate data with the Gerber data.
[0173] In S63, the same method is used to obtain the feature patterns of the component coordinate data and the feature patterns of the Gerber data after the first offset for the devices in the group of angles to be used. The coordinates of the corresponding vertices of these two feature patterns are compared. When the coordinates of the corresponding vertices are all equal, it indicates that the component coordinate data and the Gerber data are successfully aligned. If the coordinates of the corresponding vertices of these two feature patterns are not all equal, the second center deviation is calculated according to the following formula:
[0174]
[0175] Where Dx and Dy represent the initial center deviation; A represents the angular deviation; and dx and dy represent the second center deviation.
[0176] After obtaining the second center deviation, the second center deviation is added to the Gerber data after the first offset to realize the second offset processing of the Gerber data. At this time, the alignment of the component coordinate data and the Gerber data is finally achieved.
[0177] The automatic alignment method for coordinate data and Gerber data provided in this invention quickly and accurately determines the coordinate relationship between component coordinate data and Gerber data by finding characteristic patterns, calculating center deviation and angular deviation, thereby achieving alignment. Simultaneously, it selects devices at different angles within the same package for verification, effectively ensuring alignment accuracy. This invention can be implemented in software, thus greatly improving the efficiency and accuracy of component coordinate data and Gerber data alignment, effectively improving PCB production efficiency and quality, reducing material waste, and shortening product production cycles.
[0178] Secondly, corresponding to the above method embodiments, this invention also provides a device for automatically aligning coordinate data with Gerber data, such as... Figure 8 As shown, the device includes:
[0179] The data acquisition module is used to acquire component coordinate data and Gerber data from the PCB data.
[0180] The component grouping module is used to filter and group the component coordinate data to obtain the component angle groups;
[0181] The component coordinate data feature image acquisition module is used to acquire the feature image of the component coordinate data by constructing a bounding box in the angle group of the component.
[0182] The Gerber data feature image acquisition module is used to construct a ring in the pad layer of the Gerber data, filter out the feature images that are the same as the feature images of the component coordinate data, and thus obtain the feature images of the Gerber data.
[0183] The deviation calculation module is used to calculate the angular deviation and initial center deviation between the feature graphics of the component coordinate data and the feature graphics of the Gerber data.
[0184] The data alignment module is used to align the component coordinate data with the Gerber data based on the angle deviation and the initial center deviation.
[0185] For details on the specific processing procedures of each module of the device, please refer to the relevant content in the first section, which will not be repeated here.
[0186] Thirdly, embodiments of the present invention also provide an electronic device, such as... Figure 9 As shown, it includes a processor 901, a communication interface 902, a memory 903, and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904;
[0187] The memory is used to store computer programs;
[0188] When the processor executes the program stored in the memory, it implements the step of the automatic alignment method between any coordinate data and Gerber data provided in the first aspect of the present invention.
[0189] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0190] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0191] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0192] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0193] The method provided in this invention can be applied to electronic devices. Specifically, the electronic device can be a desktop computer, a portable computer, a smart mobile terminal, a server, etc. No limitation is made herein; any electronic device that can implement this invention falls within the protection scope of this invention.
[0194] Fourthly, corresponding to the automatic alignment method of coordinate data and Gerber data provided in the first aspect, this embodiment of the invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the automatic alignment method of any coordinate data and Gerber data provided in the first aspect of this embodiment of the invention.
[0195] For the embodiments of the device / electronic device / storage medium, since they are basically similar to the method embodiments, the description is relatively simple, and relevant parts can be referred to in the description of the method embodiments.
[0196] It should be noted that, in the description of this invention, the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," and "counterclockwise," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0197] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0198] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. In addition, those skilled in the art can combine and integrate the different embodiments or examples described in this specification.
[0199] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A method for automatically aligning coordinate data with Gerber data, characterized in that, include: Obtain component coordinate data and Gerber data from the PCB data; The component coordinate data is filtered and grouped to obtain the component angle groups; A feature graph of the element's coordinate data is obtained by constructing a bounding box in the angle group of the element; By constructing a ring in the pad layer of the Gerber data, the pattern that is the same as the feature pattern of the component coordinate data is selected, and thus the feature pattern of the Gerber data is obtained. Calculate the angular deviation and initial center deviation between the feature graph of the component coordinate data and the feature graph of the Gerber data; The component coordinate data is aligned with the Gerber data based on the angular deviation and the initial center deviation.
2. The method for automatically aligning coordinate data with Gerber data according to claim 1, characterized in that, The component coordinate data is filtered and grouped to obtain component angle groups, including: In the component coordinate data, the components are grouped according to their device type to obtain multiple device type groups; Within each device type group, components are grouped according to package name, and symmetrical grouping of packages is retained, resulting in multiple package groups under the corresponding device type group; Within each package group, components are grouped according to their angles to obtain multiple angle groups for the components in the corresponding package group.
3. The method for automatically aligning coordinate data with Gerber data according to claim 2, characterized in that, By constructing a bounding box within the angle group of the element, a feature graph of the element's coordinate data is obtained, including: Among all angle groups, target angle groups that meet the requirements for the number of components and component angles are selected; and in the obtained target angle groups, triangles are obtained by constructing bounding boxes, and polygons with unique characteristics are obtained as feature graphics of the component coordinate data.
4. The method for automatically aligning coordinate data with Gerber data according to claim 3, characterized in that, From all angle groups, target angle groups that meet the requirements for both the number of components and their angles are selected. Then, within these target angle groups, bounding boxes are constructed to obtain triangles, and polygons with unique characteristics are acquired as feature graphics for the component coordinate data. These polygons include: Among all angle groups, select the angle groups with 3 or more components and the component angles being the first and second angles, and use them as the target angle groups. In each selected target angle group, the triangle with the largest area formed by the component coordinate points is obtained by constructing a bounding box; Among the triangles with the largest area obtained from all target angle groups, the largest one is selected to obtain the feature graphic of the component coordinate data.
5. The method for automatically aligning coordinate data with Gerber data according to claim 4, characterized in that, In each selected target angle group, the triangle with the largest area formed by the component coordinate points is obtained by constructing a bounding box, including: For each selected target angle group, construct a corresponding bounding box with the outermost element edge as the boundary; Within the bounding box, obtain the triangle with the largest area among the triangles formed by the component coordinate points by sequential search; Among the triangles with the largest areas obtained from all target angle groups, the largest one is selected to obtain the feature image of the component coordinate data, including: Select the largest triangle from all the target angle groups with the first angle to obtain the first triangle with the largest area; and select the largest triangle from all the target angle groups with the second angle to obtain the second triangle with the largest area. If there is a unique maximum among the first and second largest area triangles, the unique maximum is used as the feature image of the component coordinate data; otherwise, the triangle with the smallest perimeter among the first and second largest area triangles is selected as the feature image of the component coordinate data.
6. The method for automatically aligning coordinate data with Gerber data according to claim 4, characterized in that, The first angle is 0°, and the second angle is 90°.
7. The method for automatically aligning coordinate data with Gerber data according to claim 3, characterized in that, From all angle groups, target angle groups that meet the requirements for both the number of components and their angles are selected. Then, within these target angle groups, bounding boxes are constructed to obtain triangles, and polygons with unique characteristics are acquired as feature graphics for the component coordinate data. These polygons include: Among all angle groups, select the angle groups with 3 or more components and the component angle being the third angle, and use them as the target angle groups. In each selected target angle group, all triangles formed by the component coordinate points are obtained by constructing a bounding box, and candidate triangles are obtained by excluding them. Among all candidate triangles in the target angle group, the triangle with the largest perimeter is selected to obtain the feature image of the component coordinate data.
8. The method for automatically aligning coordinate data with Gerber data according to claim 7, characterized in that, In each selected target angle group, all triangles formed by the component coordinate points are obtained by constructing a bounding box, and candidate triangles are obtained by excluding the remaining triangles, including: For each selected target angle group, construct a corresponding bounding box with the outermost element edge as the boundary; Within the bounding box, obtain all triangles formed by the coordinate points of the components, and exclude isosceles or equilateral triangles to obtain candidate triangles; Among all candidate triangles in the target angle group, the triangle with the largest perimeter is selected to obtain the feature image of the component coordinate data, including: If there is only one triangle with the largest perimeter among all candidate triangles, the selected triangle with the largest perimeter will be used as the feature image of the component coordinate data. If there are two or more triangles with the largest perimeter among all candidate triangles, perform a polygon construction process, including: selecting an element from the angle group to which each triangle with the largest perimeter belongs, and forming a polygon with more than 3 sides with the element corresponding to the triangle with the largest perimeter; and determining whether there is a unique polygon with the largest perimeter among all the polygons obtained so far; if so, using the unique polygon with the largest perimeter as the feature image of the element coordinate data; if not, repeat the polygon construction process until a unique polygon with the largest perimeter is obtained as the feature image of the element coordinate data.
9. The method for automatically aligning coordinate data with Gerber data according to claim 7, characterized in that, The third angle is 0° or 90°.
10. The method for automatically aligning coordinate data with Gerber data according to claim 5 or 8, characterized in that, By constructing a ring in the pad layer of the Gerber data, patterns identical to the feature patterns of the component coordinate data are selected, thereby obtaining the feature patterns of the Gerber data, including: In the pad layer of the Gerber data, multiple rings corresponding to the pad position coordinates are formed with each pad position coordinate as the center and the length of the line segment from any vertex to the other vertices in the feature graph of the obtained component coordinate data as the radius. For each ring corresponding to the pad position coordinates, the range is expanded by the corresponding pad size to obtain the expanded area, thereby obtaining all the pads on the ring. For all pads on the rings corresponding to the pad position coordinates, select the pattern that is the same as the feature pattern of the component coordinate data from the pattern formed by the pad corresponding to the center and the pads on multiple corresponding rings. Based on the selected graphics, the feature graphics of the Gerber data are obtained.
11. The method for automatically aligning coordinate data with Gerber data according to claim 10, characterized in that, The step of obtaining the feature graphics of the Gerber data based on the selected graphics includes: If there are two selected graphics, determine the corresponding vertices of the two selected graphics, and take the graphic formed by the midpoints of the lines connecting the corresponding vertices as the feature graphics of the Gerber data. If at least three graphics are selected, determine the corresponding vertices of all the selected graphics, determine the midpoint of the graphics formed by each group of corresponding vertices, and use the graphics formed by all the midpoints as the feature graphics of the Gerber data.
12. The method for automatically aligning coordinate data with Gerber data according to claim 11, characterized in that, Aligning the component coordinate data with the Gerber data based on the angular deviation and the initial center deviation includes: Based on the angle deviation and the initial center deviation, the Gerber data is subjected to a first offset process to obtain the Gerber data after the first offset. Determine any available angle group in the package group corresponding to the feature pattern of the component coordinate data that does not belong to the same angle group as the feature pattern of the component coordinate data. For the set of angles to be used, obtain the feature graph of the element coordinate data and the feature graph of the Gerber data after the first offset, and determine whether the coordinates of the corresponding vertices in the two are all the same. If so, it confirms that the component coordinate data and the Gerber data are successfully aligned; If not, the second center deviation is calculated using the angle deviation and the initial center deviation, and the Gerber data after the first offset is subjected to a second offset processing based on the second center deviation, so as to achieve the alignment of the component coordinate data with the Gerber data.
13. A device for automatically aligning coordinate data with Gerber data, characterized in that, include: The data acquisition module is used to acquire component coordinate data and Gerber data from the PCB data. The component grouping module is used to filter and group the component coordinate data to obtain the component angle groups; The component coordinate data feature image acquisition module is used to acquire the feature image of the component coordinate data by constructing a bounding box in the angle group of the component. The Gerber data feature image acquisition module is used to construct a ring in the pad layer of the Gerber data, filter out the feature images that are the same as the feature images of the component coordinate data, and thus obtain the feature images of the Gerber data. The deviation calculation module is used to calculate the angular deviation and initial center deviation between the feature graphics of the component coordinate data and the feature graphics of the Gerber data. The data alignment module is used to align the component coordinate data with the Gerber data based on the angle deviation and the initial center deviation.
14. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store computer programs; When the processor executes the program stored in the memory, it implements the steps of the method according to any one of claims 1-12.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-12.