A Method for Synchronous Scaling and Quick Positioning of Components in Gerber Files

Through the synchronous scaling and fast positioning methods of Gerber files, the problem of mismatch in positioning after scaling of Gerber files is solved, and the rapid and accurate identification of target components and similar components is achieved, improving processing efficiency and accuracy.

CN118278354BActive Publication Date: 2025-07-04SUZHOU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410488096.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-23
Publication Date
2025-07-04
Estimated Expiration
2044-04-23

Smart Images

  • Figure CN118278354B_ABST
    Figure CN118278354B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of Gerber file processing, and in particular to a method for synchronous scaling and rapid positioning of components in a Gerber file, comprising the following steps: obtaining the image size of the Gerber file and the four-corner coordinates of the selected area; obtaining the scaling ratio and converting the four-corner coordinates of the selected area to synchronously scale with the Gerber file; obtaining the number of connected regions and the connected area in the selected area, and selecting effective components; performing a bounding box selection on the selected effective components and obtaining the center coordinates; comparing with the center coordinates of each component in the parameter table to determine the target component and generating a selection box; generating selection boxes for all components of the same type; and converting the four-corner coordinates of the selection box to synchronously scale with the Gerber file. Through the synchronous scaling mechanism, the present invention ensures that when the user arbitrarily scales the Gerber file, the selection box and coordinates of the target component can be accurately matched, solving the problem of mismatch between view scaling and component positioning in the traditional method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Gerber file processing, and in particular to a method for synchronous scaling and rapid positioning of components in a Gerber file. Background Art

[0002] With the continuous progress of electronic technology, electronic products are developing towards the trends of miniaturization, small size and multi-functionality, making the design requirements for printed circuit boards (PCBs) of electronic products more and more complex. The development trends of high density, high complexity and high performance of printed circuit boards continuously challenge the potential development and application strategies of printed circuit board products. Users or enterprise design departments often only want to provide the Gerber files of printed circuit board products to the production and manufacturing departments for various considerations. According to the description of the Gerber files, the production and manufacturing departments draw raster images containing the appearance optical information of printed circuit board products and put them into subsequent production. By selecting components in the Gerber files of printed circuit board products, relevant information and parameters of the components can be obtained.

[0003] After obtaining the Gerber files of printed circuit board products, the production and manufacturing departments usually use the mouse to zoom in on the Gerber files to observe clearer detailed information of the components. However, the zoomed Gerber files often cannot match the positioning information of the mouse when dragging out the target component area, that is, the two cannot be synchronously scaled. It is difficult for users to select the target component by accurately dragging out the target component area with the mouse, which seriously affects the selection efficiency of the target component. At the same time, after dragging the target component area with the mouse, the positions of the components that the user is interested in can be obtained. However, the current method is difficult to quickly locate other components of the same type as the target component in the complete Gerber file. If the production and manufacturing departments want to know the positions of all components of the same type as the target component in the complete Gerber file, they can only identify them by screening one by one, which has problems such as large subjectivity, poor reliability and low efficiency. Summary of the Invention

[0004] Therefore, the technical problem to be solved by the present invention is to overcome the problems that when using the mouse to zoom in on the Gerber file in the prior art, the zoomed Gerber file cannot match the positioning information of the mouse when dragging out the target component area, and it is difficult to quickly locate other components of the same type as the target component in the complete Gerber file.

[0005] To solve the above technical problems, the present invention provides a method for synchronous scaling and rapid positioning of components in a Gerber file, including the following steps:

[0006] S1: Generate the Gerber file of the printed circuit board, obtain the image size of the Gerber file and the four corner coordinates of the selected area;

[0007] S2: Obtain the scaling ratio by comparing the image sizes of the Gerber files before and after scaling, and convert the four corner coordinates of the selected area based on the scaling ratio to synchronously scale the selected area with the Gerber file;

[0008] S3: Obtain the number of connected regions and the connected area in the selected area; if the number of connected regions is 1, select the only connected region as the effective component; if the number of connected regions is greater than 1, select the connected region with the largest connected area as the effective component; frame the area of the selected effective component, and obtain the center coordinates of the framed area;

[0009] S4: Compare the center coordinates of the framed area with the center coordinates of each component in the component parameter table of the Gerber file; if there are the same center coordinates, determine the effective component as the target component and generate a selection box; if there are no same center coordinates, select the component with the smallest Euclidean distance between the center coordinates of each component in the component parameter table of the Gerber file and the center coordinates of the framed area as the target component and generate a selection box;

[0010] S5: Based on the center coordinates of the same type of target components in the component parameter table, paste the selection box onto all the same type of components;

[0011] S6: Obtain the four corner coordinates of the selection box, and synchronously scale the four corner coordinates of the selection box according to the scaling ratio.

[0012] In an embodiment of the present invention, in S1, it further includes preprocessing the Gerber file to highlight the image features of the connected regions therein.

[0013] In an embodiment of the present invention, the preprocessing includes channel selection of the Gerber file, increasing the image contrast, and removing the blank area outside the component area.

[0014] In an embodiment of the present invention, the image size of the Gerber file is X×Y×b, where X is the horizontal length of the Gerber file, Y is the vertical length of the Gerber file, and b is the number of channels of the Gerber file; the four corner coordinates of the selected area are (x1, y1), (x2, y1), (x1, y2), (x2, y2); in the channel selection of the preprocessing, select the first channel of the Gerber file, that is, convert the Gerber file with the size of X×Y×b into a Gerber file with the size of X×Y.

[0015] In an embodiment of the present invention, in S2, the method for converting the four corner coordinates of the selected area based on the scaling ratio is as follows: If the four corner coordinates of the selected area are (x1, y1), (x2, y1), (x1, y2), and (x2, y2), then the scaling conversion formula for the four corner coordinates of the selected area is as follows:

[0016] x1 = abs(x1 × σ)

[0017] x2 = abs(x2 × σ)

[0018] y1 = abs(y1 × σ)

[0019] y2 = abs(y2 × σ)

[0020] Wherein, abs() is the absolute value function, and σ is the scaling ratio.

[0021] In an embodiment of the present invention, in S4, before generating the selection box, it further includes: comparing whether the area where the selected target component is located in the component parameter table of the Gerber file matches the area corresponding to the current monitoring coefficient. If it matches, the verification passes; if it does not match, the verification fails; wherein, the method for obtaining the current monitoring coefficient is: first obtain the center line coordinates of the Gerber file, then divide the Gerber file into a first area and a second area, respectively set the monitoring coefficient when the selected area is located in the first area and the monitoring coefficient when the selected area is located in the second area, and obtain the current monitoring coefficient by comparing the center line coordinates of the Gerber file with the four corner coordinates of the selected area.

[0022] In an embodiment of the present invention, the center line coordinates of the Gerber file are λ, and the four corner coordinates of the selected area are (x1, y1), (x2, y1), (x1, y2), and (x2, y2); when both x1 and x2 in the four corner coordinates are less than λ, the selected area is located in the first area, and at this time, the monitoring coefficient α = 1 is set; when both x1 and x2 in the four corner coordinates are greater than λ, the selected area is located in the second area, and at this time, the monitoring coefficient α = 2 is set; when the monitoring coefficient α = 1, it is determined whether the target component is located in the first area in the component parameter table of the Gerber file; when the monitoring coefficient α = 2, it is determined whether the target component is located in the second area in the component parameter table of the Gerber file.

[0023] In an embodiment of the present invention, in S3, if the number of connected components is 1, then select the only connected area as the effective component, and obtain the minimum value of the horizontal axis of the effective component and the maximum value the minimum value of the vertical axis and the maximum value Selectively enclose the effective components. The four corner coordinates of the selection are Obtain the center coordinates of the selected area where If the number of connected regions is greater than 1, sort all connected regions in descending order according to their connected areas, select the connected region with the largest connected area as the effective component, remove other components with smaller connected areas, and then obtain the minimum value of the horizontal axis of the effective component and the maximum value the minimum value of the vertical axis and the maximum value Selectively enclose the effective components. The four corner coordinates of the selection are Obtain the center coordinates of the selected area where

[0024]

[0025] In an embodiment of the present invention, in S5, after pasting the selection box onto all components of the same type, continue to determine the number of connected regions in the pasted selection box. If the number of connected regions is equal to 1, the pasting of the selection box is correct; if the number of connected regions is greater than 1, rotate the selection box clockwise by 90° with the center coordinates of the selection box as the center.

[0026] In an embodiment of the present invention, in S6, the four corner coordinates of the selection box are (a1, b1), (a2, b1), (a1, b2), (a2, b2). The scaling transformation formula for the four corner coordinates of the selection box is as follows:

[0027] a1 = abs(a1 / σ)

[0028] a2 = abs(a2 / σ)

[0029] b1 = abs(b1 / σ)

[0030] b2 = abs(b2 / σ)

[0031] where abs() is the absolute value function and σ is the scaling ratio.

[0032] The above technical solutions of the present invention have the following beneficial effects compared with the prior art:

[0033] (1) Through the synchronous scaling mechanism, the present invention ensures that when the user zooms in or out of the Gerber file arbitrarily, the selection box and coordinates of the target component can be accurately matched, solves the problem of mismatch between view scaling and component positioning in traditional methods, greatly improves the efficiency and accuracy of Gerber file review, and at the same time provides a more friendly and intuitive operation experience for users.

[0034] (2) Through the automated rapid positioning mechanism of the present invention, users can quickly locate the target component and its similar components by simple operations such as dragging and selecting a region with the mouse, significantly improving the processing speed, reducing the operation difficulty, minimizing the time consumption of manual positioning and the risk of misidentification, and enhancing the accuracy and efficiency of positioning.

[0035] (3) By means of a preprocessing method, the present invention improves the image quality of the Gerber file and highlights the image features, not only enhancing the image clarity and contrast for easy visual observation by users, but also reducing the computational burden of subsequent processing steps, accelerating the component recognition and positioning process, and improving the efficiency and flexibility of the entire processing flow.

[0036] (4) Based on the number of connected components and the connected area in the connected region, the present invention identifies valid components, accurately differentiates the components selected by the user's intention, maintains the recognition accuracy even in a high-density layout, avoids the failure of selection caused by accidentally selecting the background or partial structures of other components, simplifies the operation difficulty for users, and improves the accuracy and efficiency of selection.

[0037] (5) After obtaining the relevant information of the target component, the present invention determines the position information and parameter information of other similar components from the component library through information comparison and region verification, thereby quickly locating all components of the same type as the target component in the complete Gerber file and reducing the risk of errors or omissions. Description of the Drawings

[0038] In order to make the content of the present invention easier to be clearly understood, the following further details the present invention according to specific embodiments of the present invention in conjunction with the drawings, where

[0039] Figure 1 is the flowchart of the method for synchronous scaling and rapid positioning of components in the Gerber file of the present invention;

[0040] Figure 2 is the reference Gerber file diagram of the selected region boxed by the user in the second embodiment of the present invention;

[0041] Figure 3 is the reference diagram of the positioning result of the target component in the second embodiment of the present invention;

[0042] Figure 4 is the reference Gerber file diagram of the selected region boxed by the user in the third embodiment of the present invention;

[0043] Figure 5 is the reference diagram of the positioning result of the target component in the third embodiment of the present invention. Detailed Embodiments

[0044] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, so that those skilled in the art can better understand the present invention and be able to implement it, but the embodiments cited do not limit the present invention.

[0045] Embodiment 1

[0046] Referring to Figure 1 As shown, the present invention provides a method for synchronous scaling and rapid positioning of components in a Gerber file, including the following steps:

[0047] S1: Generate the Gerber file of the printed circuit board, and obtain the image size of the Gerber file and the four-corner coordinates of the selected area;

[0048] S2: Obtain the scaling ratio by comparing the image sizes of the Gerber files before and after scaling, and convert the four-corner coordinates of the selected area based on the scaling ratio to synchronously scale the selected area with the Gerber file;

[0049] S3: Obtain the number of connected regions and the connected area in the selected area; if the number of connected regions is 1, select the only connected region as the effective component; if the number of connected regions is greater than 1, select the connected region with the largest connected area as the effective component; frame the area of the selected effective component, and obtain the center coordinates of the framed area;

[0050] S4: Compare the center coordinates of the framed area with the center coordinates of each component in the component parameter table of the Gerber file; if there are the same center coordinates, determine the effective component as the target component and generate a selection box; if there are no same center coordinates, select the component with the smallest Euclidean distance between the center coordinates of each component in the component parameter table of the Gerber file and the center coordinates of the framed area as the target component and generate a selection box;

[0051] S5: Based on the center coordinates of the same type of target components in the component parameter table, paste the selection box onto all the same type of components;

[0052] S6: Obtain the four-corner coordinates of the selection box, and synchronously scale the four-corner coordinates of the selection box according to the scaling ratio.

[0053] In S1, generate the Gerber file of the printed circuit board according to the application requirements. The obtained Gerber file has an initial certain image size, and the Gerber file usually has multiple channels. Obtain the four corner coordinates of the selected area through user operations. Among them, user operations usually adopt an intuitive interaction method, such as using a mouse drag action to determine an area. The selected area is the general area where the user selects the components to be analyzed or recognized. After the user makes a selection, the system obtains the coordinates of the four corners of this determined selected area and records them as (x1, y1), (x2, y1), (x1, y2), (x2, y2).

[0054] In S2, by comparing the image size of the scaled Gerber file with the initial image size of the Gerber file before scaling, the scaling ratio can be obtained. This scaling ratio guides the scaling of the four corner coordinates of the subsequent selected area and the four corner coordinates of the selection box to ensure the consistency and accuracy of image scaling.

[0055] In S3, the connected area is a continuous and unbroken image area (after preprocessing, it should also have a high contrast). The system can obtain the number of connections (the number of components in the selected area) and the connected area (the area of each component) in the connected area. When the number of connections is one, it means that there is exactly one effective component in the selected area, and this connected area is the effective component. When the number of connections is more than one, then select the connected area with the largest connected area as the effective component (which conforms to the general operation logic of the user. When the user wants to select a component, they usually try to frame it as closely as possible. At this time, the other components existing in the user's framed area are often smaller or incomplete, so the area of other components is often smaller than the area of the user's target component). After completing the selection of the effective component, the system frames this effective component. This framing usually uses a rectangular frame, and the center coordinates of this rectangular framed area are obtained.

[0056] In S4, correct the offset of the center coordinates by comparing the center coordinates of the framed area with the center coordinates of each component in the component parameter table of the Gerber file to ensure that the selected target component matches the actual component. Among them, the calculation of the Euclidean distance is to determine the straight-line distance between two center coordinate points. After the target component is determined, generate a tightly fitting selection box for it. Tightly fitting means that the upper, lower, left, and right boundaries of the selection box are all in contact with the target component.

[0057] In S5, by querying the major type number of the target component in the parameter table, the type of the target component is determined, and the parameter table is used to retrieve other target components of the same type as the target component in the Gerber file of the complete printed circuit board product, and the center coordinates of the target components of the same type are determined; based on the center coordinates of the target components of the same type obtained above, the selection box obtained in S4 is pasted onto the target components of the same type, and during the pasting process, the center point of the selection box coincides with the center point of the target components of the same type.

[0058] In S6, the system obtains the four-corner coordinates of all current selection boxes and performs synchronous scaling, and transmits the four-corner coordinates of the converted selection box back to the client, and thus the synchronous scaling and rapid positioning of the target component and its like-components can be completed.

[0059] Generally speaking, first, the user operates to box-select a selected area; then, the system determines the valid components based on the connected areas in the selected area; then, the valid components are compared with the parameter table to obtain the target component; then, a selection box is generated for the target component; then, with reference to the parameter table, selection boxes are generated for all target components of the same type; finally, all the selection boxes are synchronously scaled.

[0060] In some embodiments, in S1, it further includes preprocessing the Gerber file to highlight the image features of the connected areas therein. The preprocessing includes channel selection of the Gerber file, enhancing the image contrast, and removing the blank areas outside the component areas. By preprocessing the Gerber file, the amount of data to be processed can be reduced, the complexity of subsequent steps can be lowered, and thus the accuracy and execution efficiency of subsequent steps can be improved; wherein, the Gerber file usually contains multiple channel layers, each layer representing different printed circuit board features, such as conductive paths, insulating layers, etc., and the channel selection usually selects the first channel of the Gerber file; enhancing the image contrast and removing the blank areas outside the component areas (connected areas) can highlight the image features of the components (connected areas) and facilitate subsequent processing.

[0061] In a specific embodiment, the image size of the Gerber file is X×Y×b, where X is the horizontal length of the Gerber file, Y is the vertical length of the Gerber file, and b is the number of channels of the Gerber file; the four-corner coordinates of the selected area are (x1, y1), (x2, y1), (x1, y2), (x2, y2); in the channel selection of the preprocessing, the first channel of the Gerber file is selected, that is, the Gerber file with a size of X×Y×b is converted into a Gerber file with a size of X×Y, and at the same time, the image contrast of the Gerber file is enhanced, and the blank areas outside the component areas (connected areas) in the Gerber file are removed.

[0062] In a specific embodiment, in S2, the method for converting the four corner coordinates of the selected area based on the scaling ratio is as follows: If the four corner coordinates of the selected area are (x1, y1), (x2, y1), (x1, y2), and (x2, y2), then the scaling conversion formula for the four corner coordinates of the selected area is as follows:

[0063] x1 = abs(x1 × σ)

[0064] x2 = abs(x2 × σ)

[0065] y1 = abs(y1 × σ)

[0066] y2 = abs(y2 × σ)

[0067] Wherein, abs() is the absolute value function, and σ is the scaling ratio. Based on the above scaling conversion formula, synchronous adjustment of the four corner coordinates of the selected area is achieved, and thus synchronous scaling is realized.

[0068] In some embodiments, in S4, before generating the selection box, it further includes: comparing whether the area where the selected target component is located in the component parameter table of the Gerber file matches the area corresponding to the current monitoring coefficient. If they match, the verification passes; if not, the verification fails. The method for obtaining the current monitoring coefficient is as follows: First, obtain the center line coordinates of the Gerber file, then divide the Gerber file into a first area and a second area, respectively set the monitoring coefficient when the selected area is located in the first area and the monitoring coefficient when the selected area is located in the second area, and obtain the current monitoring coefficient by comparing the center line coordinates of the Gerber file with the four corner coordinates of the selected area. In this step, a verification method for the positioning accuracy of components is introduced. Among them, the Gerber file is divided into a first area and a second area (usually divided into a left area and a right area along the vertical middle), and different monitoring coefficients are assigned to the selected area when it is in the first area or the second area. The system records the monitoring coefficient corresponding to the user's selected area this time. Thus, when the selection of the target component is completed subsequently, if the selected area is located in the first area (left area), the system records the first monitoring coefficient, then the selected target component should also be located in the left area in the component parameter table of the Gerber file; if the selected area is located in the second area (right area), the system records the second monitoring coefficient, then the selected target component should also be located in the right area in the component parameter table of the Gerber file. The accuracy of the target component selection result can be verified through the above verification process.

[0069] In a specific embodiment, the center line coordinates of the Gerber file are λ, and the four corner coordinates of the selected area are (x1, y1), (x2, y1), (x1, y2), and (x2, y2); when both x1 and x2 in the four corner coordinates are less than λ, the selected area is located in the first area, and at this time, the monitoring coefficient α is set to 1; when both x1 and x2 in the four corner coordinates are greater than λ, the selected area is located in the second area, and at this time, the monitoring coefficient α is set to 2; when the monitoring coefficient α = 1, it is judged whether the target component is located in the first area in the component parameter table of the Gerber file; when the monitoring coefficient α = 2, it is judged whether the target component is located in the second area in the component parameter table of the Gerber file. In this embodiment, the abscissa of the selected area is used to judge whether the selected area is located in the first area or the second area.

[0070] In a specific embodiment, in S3, if the number of connected components is 1, the only connected area is selected as the effective component, and the minimum value of the horizontal axis of the effective component is obtained and the maximum value the minimum value of the vertical axis and the maximum value The effective component is framed, and the four corner coordinates of the frame are The center coordinates of the framed area are obtained where If the number of connected components is greater than 1, all connected areas are sorted in descending order according to the connected area, the connected area with the largest connected area is selected as the effective component, and other components with smaller connected areas are removed. Then, the minimum value of the horizontal axis of the effective component is obtained and the maximum value the minimum value of the vertical axis and the maximum value The effective component is framed, and the four corner coordinates of the frame are The center coordinates of the framed area are obtained where This embodiment provides a method for determining the boundary of the effective component area, as well as a calculation method for determining the four corner coordinates and the center coordinates of the frame based on this boundary.

[0071] In a specific embodiment, in S5, after pasting the selection box onto all components of the same type, continue to judge the number of connected components in the connected area in the pasted selection box. If the number of connected components is equal to 1, the pasting of the selection box is correct; if the number of connected components is greater than 1, the selection box is rotated clockwise by 90° with the center coordinates of the selection box as the center. The purpose of this embodiment is to optimize the pasting of the selection box. Since the components in the Gerber file are mostly placed horizontally and vertically relative to the horizontal plane, after judging the number of connected components, a 90-degree rotation based on the center coordinates can complete the correct framing of the target components in all two placement methods.

[0072] In a specific embodiment, in S6, the four corner coordinates of the selection box are (a1, b1), (a2, b1), (a1, b2), (a2, b2), and the scaling transformation formula for the four corner coordinates of the selection box is as follows:

[0073] a1 = abs(a1 / σ)

[0074] a2 = abs(a2 / σ)

[0075] b1 = abs(b1 / σ)

[0076] b2 = abs(b2 / σ)

[0077] Among them, abs() is the absolute value function, and σ is the scaling ratio. Based on the above scaling transformation formula, synchronous adjustment of the four corner coordinates of the selection box is realized, and thus synchronous scaling of all target components is realized.

[0078] Embodiment 2

[0079] Refer to Figure 2 As shown, in this embodiment, the selected area selected by the user is located in the first area:

[0080] (1) The input of this embodiment

[0081] Input the Gerber file of the printed circuit board product.

[0082] Parameter setting: The scaling ratio is 3.78, and the four corner coordinates of the selected area generated by dragging the mouse are (36.58, 15.95), (36.58, 23.56), (42.11, 15.95), (42.11, 23.56).

[0083] (2) Realize synchronous scaling and rapid positioning of the components of the printed circuit board product Gerber file

[0084] Preprocess the Gerber file to achieve synchronous scaling of the four-corner coordinates, and obtain the scaled four-corner coordinates as (138.28, 60.28), (138.28, 89.06), (159.16, 60.28), (159.16, 89.06) respectively. Obtain the center line coordinate as 381.5. Since 159.16 is less than 381.5, it is determined that the target component is located in the left area. Calculate the number of connected components as 1, that is, there is only one component in the selected area. Obtain the four-corner coordinates of the target component as (141.28, 64.28), (141.28, 88.28), (157.28, 64.28), (157.28, 88.28) respectively, and obtain the center coordinate of the target component as (149.28, 76.28). Use the component parameter table to determine that the large type number of the target component is U, the specific number is AC-11-01-10655-G, and the center coordinate is (149, 76.25), etc. Finally, quickly locate the target component and its similar components.

[0085] (3) Results of this embodiment

[0086] The specific reference for the selected area generated by the user dragging the mouse Figure 2 As shown, after the processing of the component synchronous scaling and rapid positioning method in the Gerber file of the present invention, the obtained target component positioning result is referred to Figure 3 As shown.

[0087] Among them, the target component and its similar components are all tightly boxed with a red box. It can be seen that compared with the traditional manual identification one by one, this method can quickly and accurately locate the target component and its similar components, and has good application value and algorithm advantages.

[0088] Embodiment III

[0089] Refer to Figure 4 As shown, the selected area boxed by the user is located in the second area, and the number of connected components in the selected area is greater than 1:

[0090] (1) Input of this embodiment

[0091] Input the Gerber file of the printed circuit board product.

[0092] Parameter setting: The scaling ratio is 3.78, and the four-corner coordinates of the selected area generated by dragging the mouse are (141.58, 15.95), (141.58, 23.56), (148.10, 15.95), (148.10, 23.56).

[0093] (2) Realize the synchronous scaling and rapid positioning of components in the Gerber file of printed circuit board products

[0094] Preprocess the Gerber file to achieve synchronous scaling of the four-corner coordinates. After scaling transformation, the four-corner coordinates are respectively (535.18, 60.28), (535.18, 89.06), (559.84, 60.28), (559.84, 89.06). Obtain the center line coordinate as 381.5. Since 559.84 is greater than 381.5, it is determined that the target component is in the right area. Calculate the number of connected components as 2, that is, there are 2 components in the selected area. Select the component with the larger connected area as the target component. Obtain the four-corner coordinates of this target component as (538.68, 66.28), (538.68, 85.28), (553.68, 66.28), (553.68, 85.28). Get the center coordinate of the target component as (546.18, 75.78). Use the component parameter table to determine that the large type number of this target component is C, the specific number is AC-04-01-00158-G, and the center coordinate is (546.1, 75.75), etc. Finally, quickly locate the target component and its similar components.

[0095] (3) Results of this embodiment

[0096] The specific reference for the selected area generated by the user dragging the mouse Figure 4 As shown, after being processed by the method of synchronous scaling and rapid positioning of components in the Gerber file of the present invention, the obtained component positioning results are referred to Figure 5 As shown. Among them, the target component and its similar components are tightly boxed with red rectangles.

[0097] Obviously, the above embodiments are only examples for clear illustration and are not limitations on the implementation manners. For those of ordinary skill in the art, other different forms of changes or variations can be made based on the above description. It is not necessary and impossible to list all the implementation manners here. And the obvious changes or variations derived therefrom are still within the protection scope of the present invention.

Claims

1. A method for synchronous scaling and rapid positioning of components in Gerber files, characterized in that, Including the following steps: S1: Generate the Gerber file of the printed circuit board, obtain the image size of the Gerber file and the four corner coordinates of the selected area; S2: Obtain the scaling ratio by comparing the image sizes of the Gerber files before and after scaling, and convert the four corner coordinates of the selected area based on the scaling ratio to synchronously scale the selected area with the Gerber file; S3: Obtain the number of connected components and the connected area of the connected area in the selected area; If the number of connected components is 1, select the only connected area as the effective component; if the number of connected components is greater than 1, select the connected area with the largest connected area as the effective component; frame the area of the selected effective component, and obtain the center coordinates of the framed area; S4: Compare the center coordinates of the framed area with the center coordinates of each component in the component parameter table of the Gerber file; if there are the same center coordinates, determine the effective component as the target component and generate a selection box; if there are no same center coordinates, select the component with the smallest Euclidean distance between the center coordinates of each component in the component parameter table of the Gerber file and the center coordinates of the framed area as the target component and generate a selection box; S5: Based on the center coordinates of the target components of the same type in the component parameter table, paste the selection box onto all components of the same type; S6: Obtain the four corner coordinates of the selection box, and synchronously scale the four corner coordinates of the selection box according to the scaling ratio.

2. A method for synchronous scaling and rapid positioning of components in a Gerber file according to claim 1, characterized in that, In S1, it also includes preprocessing the Gerber file to highlight the image features of the connected area therein.

3. A method for synchronous scaling and rapid positioning of components in a Gerber file according to claim 2, characterized in that, The preprocessing includes channel selection of the Gerber file, improving the image contrast, and removing the blank area outside the component area.

4. A method for synchronous scaling and rapid positioning of components in a Gerber file according to claim 3, characterized in that, The image size of the Gerber file is X×Y×b, where X is the horizontal length of the Gerber file, Y is the vertical length of the Gerber file, and b is the number of channels of the Gerber file; the four corner coordinates of the selected area are (x1, y1), (x2, y1), (x1, y2), (x2, y2); in the channel selection of the preprocessing, select the first channel of the Gerber file, that is, convert the Gerber file with the size of X×Y×b into a Gerber file with the size of X×Y.

5. A method for synchronous scaling and rapid positioning of components in a Gerber file according to claim 1, characterized in that In S2, the method for converting the four corner coordinates of the selected area based on the scaling ratio is: if the four corner coordinates of the selected area are (x1, y1), (x2, y1), (x1, y2), (x2, y2), then the scaling conversion formula for the four corner coordinates of the selected area is as follows: x1 = abs(x1×σ) x2 = abs(x2×σ) y1 = abs(y1×σ) y2 = abs(y2×σ) where abs() is the absolute value function and σ is the scaling ratio.

6. A method for synchronous scaling and rapid positioning of components in a Gerber file according to claim 1, characterized in that, In S4, before generating the selection box, it further includes: comparing whether the area where the selected target component is located in the component parameter table of the Gerber file matches the area corresponding to the current monitoring coefficient. If they match, the verification passes; if not, the verification fails. The method for obtaining the current monitoring coefficient is as follows: first obtain the center line coordinates of the Gerber file, then divide the Gerber file into a first area and a second area, respectively set the monitoring coefficient when the selected area is in the first area and the monitoring coefficient when the selected area is in the second area, and obtain the current monitoring coefficient by comparing the center line coordinates of the Gerber file with the four corner coordinates of the selected area.

7. A method for synchronous scaling and rapid positioning of components in a Gerber file according to claim 6, characterized in that, The center line coordinates of the Gerber file are λ, and the four corner coordinates of the selected area are (x1, y1), (x2, y1), (x1, y2), (x2, y2). When both x1 and x2 in the four corner coordinates are less than λ, the selected area is in the first area, and at this time, the monitoring coefficient α = 1 is set. When both x1 and x2 in the four corner coordinates are greater than λ, the selected area is in the second area, and at this time, the monitoring coefficient α = 2 is set. When the monitoring coefficient α = 1, determine whether the target component is in the first area in the component parameter table of the Gerber file. When the monitoring coefficient α = 2, determine whether the target component is in the second area in the component parameter table of the Gerber file.

8. A method for synchronous scaling and rapid positioning of components in a Gerber file according to claim 1, characterized in that, In S3, if the number of connected components is 1, select the only connected region as the effective component, and obtain the minimum value of the horizontal axis of the effective component and the maximum value the minimum value of the vertical axis and the maximum value Perform a bounding box selection on the effective component. The four corner coordinates of the bounding box are Obtain the center coordinates of the bounding box region where If the number of connected components is greater than 1, then sort all connected regions in descending order according to the connected area, select the connected region with the largest connected area as the effective component, remove other components with smaller connected areas, and then obtain the minimum value of the horizontal axis of the effective component and the maximum value the minimum value of the vertical axis and the maximum value Perform a bounding box selection on the effective component. The four corner coordinates of the bounding box are Obtain the center coordinates of the bounding box region where 9. A method for synchronous scaling and rapid positioning of components in a Gerber file according to claim 1, characterized in that In S5, after pasting the selection box onto all components of the same type, continue to determine the number of connected regions in the pasted selection box. If the number of connected regions is equal to 1, the selection box is pasted correctly. If the number of connected regions is greater than 1, rotate the selection box clockwise by 90° with the center coordinates of the selection box as the center.

10. A method for synchronous scaling and rapid positioning of components in a Gerber file according to claim 1, characterized in that, In S6, the four corner coordinates of the selection box are (a1, b1), (a2, b1), (a1, b2), (a2, b2), and the scaling conversion formula for the four corner coordinates of the selection box is as follows: a1 = abs(a1 / σ) a2 = abs(a2 / σ) b1 = abs(b1 / σ) b2 = abs(b2 / σ) Where abs() is the absolute value function, and σ is the scaling ratio.

Citation Information

Patent Citations

  • Control editing method and system

    CN107870751A

  • Method and user interface for capturing an input by means of pointing gestures

    CN112074801A