Part measurement method, measurement equipment and storage medium
By automatically extracting geometric and annotation elements from part design drawings to generate measurement programs, the problem of low efficiency in manual programming of image measurement systems is solved, and high-precision and high-efficiency part measurement is achieved.
Patent Information
- Application Number
- CN202511520331.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2026-02-03
AI Technical Summary
The programming of existing image measurement systems relies heavily on manual programming, resulting in low programming efficiency and easy operational errors, which affect measurement accuracy and batch consistency, making it difficult to meet the high-precision and high-efficiency quality inspection needs of modern manufacturing.
By extracting geometric and annotation elements from part design drawings, a part measurement program is generated to automate part measurement and avoid errors caused by manual editing.
It improves the measurement accuracy and programming efficiency of the part measurement program, ensuring the accuracy and consistency of the measurement results.
Smart Images

Figure CN121452977A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of metrology testing, in particular to a part measurement method, a measurement device and a storage medium. BACKGROUND
[0002] In the field of two-dimensional image measurement and flash measurement, the geometric parameters of precision parts (such as electronic components, mechanical parts, hardware stamping parts, etc.) are usually measured by means of an image measurement system. At present, the programming of the image measurement system highly depends on manual programming mode. The technician needs to strictly refer to the part design drawing or paper drawing provided by the customer, and manually selects, coordinates edits and parameter configures the geometric elements (such as straight line profile, circular aperture, angle slot, etc.) of the part one by one, and inputs the upper and lower tolerance values of each size item by item, and finally generates an executable measurement program.
[0003] This manual programming mode in the face of batch detection scene, repeated manual operation not only leads to low programming efficiency (single complex part programming time can reach several hours), more prone to human error, such as parameter input error, element feature recognition deviation, etc. It directly causes the fluctuation of the measurement accuracy of the image measurement system and the reduction of batch consistency, which is difficult to meet the demand of modern manufacturing industry for high precision and high efficiency quality detection. SUMMARY
[0004] In view of the above, it is necessary to propose a part measurement method, a measurement device and a storage medium to solve the technical problem of reduced measurement accuracy of the image measurement system caused by manual programming in the prior art.
[0005] In a first aspect, the present application provides a part measurement method, which comprises: acquiring a part design drawing and extracting geometric elements and labeled elements from the part design drawing; extracting associated elements of the labeled elements from the geometric elements, and adding the labeled elements and the associated elements to a preset associated data list; generating a part measurement program based on each labeled element and the corresponding associated element in the associated data list; and calling the part measurement program to measure a part to be measured.
[0006] The part measurement method described above can optionally comprise: acquiring the labeled type of the labeled element; selecting the candidate elements of the labeled element from the geometric elements according to the labeled type and the end points of the guide line of the labeled element; and extracting the associated elements of the labeled element from the candidate elements according to the labeled value of the labeled element.
[0007] Optionally, in the above-described part measurement method, generating a part measurement program based on each annotation element and its corresponding association element in the associated data list includes: constructing a program object and a tool object based on each annotation element and its corresponding association element; constructing a program list based on the program object and a tool list based on the tool object; establishing an association relationship between the program object in the program list and the tool object in the tool list; and generating the part measurement program based on the program object in the program list that has an association relationship with the tool object.
[0008] Optionally, after extracting geometric elements and annotation elements from the part design drawing, the above-described part measurement method further includes: generating a computer-aided design (CAD) image based on the geometric elements; and calculating a transformation model matrix between the CAD image and the preset physical image based on the CAD image and the physical image, wherein the transformation model matrix is used to spatially align the part drawing of the part to be measured with the CAD image.
[0009] Optionally, in the above-mentioned part measurement method, generating a computer-aided design (CAD) image based on the geometric elements includes: converting the distance coordinates of the geometric elements to obtain corresponding pixel coordinates; connecting the pixel coordinates to form a contour combination containing multiple contours; and filling the contour combination to obtain the CAD image.
[0010] Optionally, in the above-described part measurement method, filling the closed contour to obtain the CAD image includes: determining a region to be filled from the contour combination, and determining a target filling region from the region to be filled, wherein the region to be filled is the blank area between the contours in the contour combination; filling the target filling region to obtain the CAD image.
[0011] Optionally, the part measurement method described above may determine the target filling area from the area to be filled, including: determining a target point from the area to be filled; constructing a ray along the target direction based on the target point, and recording the number of intersections between the ray and the contour boundary line; determining whether the number of intersections is odd; and if the number of intersections is odd, determining the area to be filled as the target filling area.
[0012] Optionally, the above-described part measurement method may extract geometric elements and annotation elements from the part design drawing, including: verifying the validity of the part design drawing, wherein the validity issues include one or more of the following: file corruption, abnormal file structure, and file incompatibility; if the part design drawing does not have any validity issues, obtaining the header information of the part design drawing and parsing the configuration parameters of the part design drawing from the header information; and based on the configuration parameters, reading the entity data of the part design drawing to obtain the geometric elements and annotation elements.
[0013] Secondly, this application provides a measuring device, the measuring device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the part measurement method described in any one of the above.
[0014] Thirdly, this application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the part measurement method described in any one of the above claims.
[0015] The aforementioned part measurement method involves acquiring a part design drawing and extracting geometric and annotation elements from it; extracting associated elements of the annotation elements from the geometric elements and adding the annotation elements and associated elements to a preset associated data list; generating a part measurement program based on each annotation element and its corresponding associated element in the associated data list; and then calling the part measurement program to measure the part. As can be seen, this application directly extracts geometric and annotation elements from the part design drawing, extracts associated elements of the annotation elements from the geometric elements, and automatically generates a part measurement program based on each annotation element and its corresponding associated element. This avoids operational deviations caused by manually editing the part measurement program and effectively improves the measurement accuracy of the part measurement program.
[0016] Understandably, the measuring device of the second aspect and the computer-readable storage medium of the third aspect provided above correspond to the part measuring method of the first aspect. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding part measuring methods provided above, and will not be repeated here. Attached Figure Description
[0017] Figure 1 This is a schematic diagram illustrating an application scenario of the part measurement method provided in an embodiment of this application.
[0018] Figure 2 This is a schematic flowchart of a part measurement method provided in an embodiment of this application.
[0019] Figure 3 yes Figure 2 The detailed flowchart of step S202 in the part measurement method shown.
[0020] Figure 4 This is a schematic diagram of a part structure including guide lines provided in an embodiment of this application.
[0021] Figure 5 yes Figure 2 A detailed flowchart of step S203 in the part measurement method shown.
[0022] Figure 6 This is a schematic flowchart illustrating the calculation of the transformation model matrix provided in one embodiment of this application.
[0023] Figure 7 yes Figure 6 A detailed flowchart of step S601 in the part measurement method shown.
[0024] Figure 8 This is a schematic diagram of a contour combination provided in an embodiment of this application.
[0025] Figure 9 This is a schematic diagram of the filled contour combination provided in one embodiment of this application.
[0026] Figure 10 This is a schematic diagram of the process of determining a closed contour from the region to be filled in one embodiment of this application.
[0027] Figure 11 yes Figure 2 The detailed flowchart of step S201 in the part measurement method shown.
[0028] Component Symbol Explanation Measuring equipment 10 Memory 11 Processor 12 The following detailed description, in conjunction with the accompanying drawings, will further illustrate this application. Detailed Implementation
[0029] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0030] In the embodiments of this application, it should be noted that, unless otherwise expressly specified and limited, the word "for example" is used to indicate an example, illustration, or description. Any embodiment or design scheme described as "for example" in the embodiments of this application should not be construed as being better or more advantageous than other embodiments or design schemes. Specifically, the use of the word "for example" is intended to present the relevant concepts in a specific manner.
[0031] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection, an electrical connection, or a connection that allows communication between them; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication between two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0032] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, 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. Therefore, features defined as "first" or "second" may explicitly or implicitly include one or more features. Furthermore, in the description of this application, "multiple" means two or more, unless otherwise expressly and specifically limited.
[0033] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.
[0034] Please see Figure 1 This is a schematic diagram illustrating an application scenario of the part measurement method provided in an embodiment of this application.
[0035] This application provides a part measurement method that can be applied to one or more measuring devices 10. The measuring device 10 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc. For example, the measuring device 10 includes, but is not limited to, any one of coordinate measuring machines and image measuring instruments, etc., but this embodiment does not impose any limitation.
[0036] Specifically, the measuring device 10 is used to: extract annotation elements and geometric elements from the part design drawing, extract associated elements of the annotation elements from the geometric elements, generate a part measurement program based on the annotation elements and associated elements, and call the part measurement program to measure the part to be measured. This realizes the automatic generation of the part measurement program, avoids the operational deviation caused by manually editing the part measurement program, and effectively improves the measurement accuracy of the part measurement program.
[0037] In some embodiments of this application, the measuring device 10 can be communicatively connected to devices such as desktop computers, laptops, handheld computers, and cloud servers.
[0038] In some embodiments of this application, the measuring device 10 can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control device.
[0039] In some embodiments of this application, the measuring device 10 may further include network devices and / or client devices. These network devices include, but are not limited to, a single network server, a server group consisting of multiple network servers, or a cloud server based on cloud computing, consisting of a large number of hosts or network servers.
[0040] In some embodiments of this application, the network where the measuring device 10 is located includes, but is not limited to, the Internet, wide area network, metropolitan area network, local area network, virtual private network (VPN), etc.
[0041] Please see Figure 2 This is a schematic diagram illustrating the steps of a part measurement method provided in an embodiment of this application. The part measurement method of this embodiment is applied to... Figure 1The measuring device 10 is shown. Specifically, the part measurement method includes the following steps. Depending on different requirements, the order of some steps in this flowchart can be changed, and some steps can be omitted.
[0042] S201: Obtain the part design drawing and extract geometric elements and annotation elements from the part design drawing.
[0043] In some embodiments of this application, the part design drawing may refer to a computer-aided design (CAD) drawing of the part, and the part design drawing may exist in the form of a CAD design file. For example, the measuring device 10 can obtain the part design drawing when acquiring a CAD design file.
[0044] Specifically, in some embodiments of this application, the part design drawing can be obtained by reading it from a specified storage location or by receiving it from other electronic devices (such as a server). After obtaining the part design drawing, all geometric elements and annotation elements of the part can be extracted from it by parsing the part design drawing. Geometric elements include any one or more of the following: points (such as center, endpoints, and intersections), lines (such as straight lines, arcs, circles, ellipses, and splines), surfaces (such as polygons, circular surfaces, and curved surfaces), and solids (such as cubes, spheres, extruded solids, and solids of revolution). Annotation elements include the specific values corresponding to parameters such as length, angle, diameter, radius, and distance of the geometric elements.
[0045] S202: Extract the associated elements of the annotation elements from the geometric elements, and add the annotation elements and associated elements to the preset associated data list.
[0046] In some embodiments of this application, after extracting the associated elements of the annotation elements from the geometric elements, the annotation elements and associated elements are added to a preset associated data list to establish a binding relationship between the annotation elements and associated elements in the associated data list. Geometric elements are the descriptive objects of annotation elements, and annotation elements are explicit explanations of information such as dimensions and technical requirements of geometric elements. Therefore, binding annotation elements and associated elements can form a dependency relationship between "being described" and "describing".
[0047] Specifically, in this embodiment, a binding relationship can be established based on the identifier of the annotation element and the identifier of the associated element. The following information is stored based on the identifier of the annotation element and the identifier of the associated element: annotation element identifier, annotation type (such as linear dimension / radius), annotation content, associated geometric element identifier (unique identifier), associated geometric type (such as circle / arc / straight line), associated feature point (such as center coordinates / endpoint coordinates), and association method (such as parametric binding / spatial alignment), etc., thereby forming a list of associated data of annotation elements and associated elements.
[0048] S203: Generate a part measurement program based on each annotation element and its corresponding associated element in the associated data list.
[0049] In some embodiments of this application, the part measurement program can instruct the detection path and judgment logic that the measuring device can execute. Therefore, it is necessary to combine the device type of the measuring device and convert each labeled element and the corresponding associated element in the associated data list into a part measurement program that the measuring device can execute.
[0050] S204: Call the part measurement program to measure the part to be measured.
[0051] In some embodiments of this application, after generating a part measurement program, the measuring device calls the part measurement program to measure the part to be measured placed on the measuring device.
[0052] For example, taking an image measuring instrument as the measuring device, after calling the part measurement program, the image measuring instrument acquires the part image to be measured, and then performs the measurement of the part based on the part image. Specifically, the image measuring instrument can extract the geometric and dimensional features of the part from the part image, and then compare the geometric and dimensional features of the part with the annotation elements and related elements of the part design drawing. When the difference between the geometric and dimensional features of the part and the annotation elements and related elements of the part design drawing is greater than a preset difference threshold, the part to be measured is determined to be unqualified; when the difference between the geometric and dimensional features of the part and the annotation elements and related elements of the part design drawing is less than or equal to the difference threshold, the part to be measured is determined to be qualified.
[0053] Based on the above embodiments, the part measurement method acquires a part design drawing and extracts geometric elements and annotation elements from the part design drawing; extracts associated elements of the annotation elements from the geometric elements and adds the annotation elements and associated elements to a preset associated data list; generates a part measurement program based on each annotation element and its corresponding associated element in the associated data list; and calls the part measurement program to measure the part to be measured. It is evident that this application, by directly extracting geometric elements and annotation elements from the part design drawing and extracting associated elements of the annotation elements from the geometric elements, and then automatically generating a part measurement program based on each annotation element and its corresponding associated element, avoids operational deviations caused by manually editing the part measurement program and effectively improves the measurement accuracy of the part measurement program.
[0054] Please see Figure 3 ,for Figure 2 A detailed flowchart of step S201 in the part measurement method shown.
[0055] This embodiment is a detailed explanation of step S202 in the foregoing embodiment, further illustrating the extraction of associated elements from geometric elements of labeled elements. Specifically, it includes the following steps: S301: Get the annotation type and annotation value of the annotation element.
[0056] In some embodiments of this application, annotation elements are elements used to add annotations, dimensions and other explanatory information to graphics, and have view specificity. Annotation elements include annotation types and annotation values corresponding to the annotation types. Annotation types include, but are not limited to, any one of types such as length, angle, diameter, radius, and distance.
[0057] For example, taking the annotation type of the annotation element as length, the annotation value of the annotation element can be 10mm. Thus, the annotation type and annotation value can be obtained from the annotation element.
[0058] S302: Select candidate elements for annotation elements from geometric elements based on the annotation type and the endpoints of the guide lines of the annotation elements.
[0059] In some embodiments of this application, the guide line of the annotation element connects the geometric elements and annotation elements in the part design drawing. The guide line can indicate the pointing relationship between the annotation element and the geometric element. In the part design drawing (CAD design file), the guide line exists in the form of a structured graphic object.
[0060] Specifically, in this embodiment, all geometric elements at the endpoints of the guide lines of the annotation elements can be obtained first. Then, based on the annotation type, candidate elements for the annotation elements are filtered from the geometric elements. This process is repeated until all candidate elements corresponding to the annotation elements are obtained. (Refer to...) Figure 4The diagram shown is a schematic of the component structure including the guide line in this embodiment. Φ is the diameter symbol, and Φ2.3 indicates that the diameter of the circular outline pointed to by the guide line is 2.3. R is the radius symbol, and R0.5 indicates that the radius of the arc pointed to by the guide line is 0.5. ° is the angle symbol, and 120° indicates that the angle of the sector is 120 degrees. The unit of length is not limited in this embodiment.
[0061] For example, taking diameter as the annotation type, diameter is a unique parameter of circles and arcs. Therefore, after obtaining all the geometric elements of the leader line endpoints, all circles and arcs are selected as candidate elements.
[0062] For example, taking the annotation type as angle, the angle is the parameter of the angle formed by the intersection of two straight lines. Therefore, after obtaining all the geometric elements of the endpoints of the guide line, all straight lines are selected as candidate elements.
[0063] S303: Extract the associated elements of the labeled elements from the candidate elements based on the labeled values.
[0064] In some embodiments of this application, the candidate element that is closest to the labeled value can be identified as the associated element.
[0065] For example, taking the annotation type of the annotation element as diameter and the annotation value as 10mm, if there are candidate elements: a circle with a diameter of 8mm, a circle with a diameter of 10mm, and a circle with a diameter of 15mm, then the circle with a diameter of 10mm among the candidate elements can be identified as the associated element of the annotation element.
[0066] For example, taking the annotation type of the annotation element as the angle and the annotation value as 60°, if there are candidate elements: line 1, line 2 and line 3, where the angle between line 1 and line 2 is 30°, the angle between line 1 and line 3 is 60°, and the angle between line 2 and line 3 is 90°, then line 1 and line 3 among the candidate elements will be determined as the associated elements of the annotation element.
[0067] Based on the above embodiments, the geometric elements of the endpoints of the guide lines of the annotation elements are first obtained. Then, based on the annotation type and annotation value of the annotation elements, the geometric elements are double-filtered to finally determine the associated elements of the annotation elements. This avoids the operational deviation problem caused by manually selecting associated elements and can effectively improve the programming efficiency of the part measurement program.
[0068] Please see Figure 5 ,for Figure 2 A detailed flowchart of step S203 in the part measurement method shown.
[0069] This embodiment is a detailed explanation of step S203 in the foregoing embodiment, further illustrating the extraction of geometric elements and annotation elements from the part design drawing. Specifically, it includes the following steps: S501: Based on each annotation element and its corresponding associated element, construct program objects and tool objects respectively, and construct a program list based on the program objects, and a tool list based on the tool objects.
[0070] In some embodiments of this application, constructing a corresponding tool object based on each annotation element and its corresponding associated element includes: matching the corresponding measurement tool based on the annotation type of the annotation element, then obtaining the hardware parameters and calibration results of the measurement tool, such as the probe length compensation value and lens pixel calibration coefficient, and finally constructing the tool object based on the hardware parameters and calibration results of the measurement tool. The probe length compensation value is a preset calibration parameter used to correct the physical structural offset of the contact probe of the contact coordinate measuring machine. The lens pixel calibration coefficient is a conversion parameter between the "image pixel size" and the "actual physical size of the part" in the image measuring instrument.
[0071] For example, if the annotation element is labeled as diameter, the annotation value is 10mm, and the associated element is circle, then a contact probe tool object is constructed, and the hardware parameters of the probe tool are entered: diameter 10mm, trigger force 0.1N, etc.
[0072] For example, taking a contact probe tool as an example, if the probe length compensation value is 2.0mm, the hardware parameters of the probe tool are entered as follows: probe length compensation value is 2.0mm.
[0073] In some embodiments of this application, after obtaining the annotation type and annotation value of a new annotation element, it is determined whether the annotation type and annotation value are the same as those of annotation elements of previously constructed tool objects. If they are the same, there is no need to construct a new tool object; the previously constructed tool object can be used. In other words, the same tool object can be called by different program objects, thus avoiding the need to construct multiple identical tool objects. This avoids the repeated construction of tool objects and helps improve the generation efficiency of the measurement program.
[0074] In some embodiments of this application, constructing a corresponding program object based on each annotation element and its associated elements includes: determining the measurement target, the number of measurement points, and the reference coordinates based on the annotation type, annotation value, and associated elements of the annotation element; and then generating a measurement step sequence based on the measurement target, the number of measurement points, and the reference coordinates. The measurement target can be a circle, line segment, or angle, etc.; the number of measurement points is the number of points that need to be measured, such as six points for a circle; and the coordinate system reference is a plane and its origin. Based on the measurement target, the number of measurement points, and the coordinate system reference, the measurement program can be decomposed into a measurement step sequence, and then a program object can be generated step by step based on the measurement step sequence. The measurement step sequence may include: establishing a coordinate system → moving tools → collecting data → calculating results → determining tolerances.
[0075] For example, taking a circular hole as an example, the measurement steps for a circular hole are as follows: move the probe above the circular hole → lower the probe to collect 6 circumferential points → fit the circle to calculate the diameter → compare the tolerance ±0.01mm. It should be noted that the above measurement step sequence is merely an illustrative example in this embodiment and does not constitute any limitation on the measurement step sequence in this embodiment.
[0076] S502: Establish the association between program objects in the program list and tool objects in the tool list.
[0077] In practical implementation, a program object refers to a specific, operable, and definable element (such as geometric elements and / or annotation elements) in a measurement program. It is the basic processing unit in the program logic, used to describe various objectives, parameters, operations, or states in the measurement task. In this embodiment, a mapping relationship can be established between the identifiers of program objects and the identifiers of tool objects, thereby establishing the association between program objects in the program list and tool objects in the tool list.
[0078] S503: Generate a part measurement program based on the program object that is associated with the tool object in the program list.
[0079] In some embodiments of this application, when generating a part measurement program, it is necessary to first construct a corresponding main program framework based on all program objects in the program list according to the process rules. Then, the program objects in the program list are filled into the main program framework, and the main program framework filled with program objects is converted into instructions that the measuring device can recognize to generate the part measurement program. The process rules include, but are not limited to, initialization priority rules, which are not limited in this embodiment. Initialization priority refers to the priority order of geometric elements and / or annotation elements.
[0080] For example, taking a coordinate measuring machine (CMM) as the measuring device, the Dimensional Measuring Interface Specification (DMIS) used by the CMM is used to convert the main program framework filled with program objects into instructions that the CMM can recognize.
[0081] In summary, this embodiment constructs a program list and a tool list based on each annotation element and its corresponding associated element, and establishes an association between the program list and the tool list, thus binding tool objects with program objects. Based on the program objects in the program list that are associated with tool objects, a main program framework is constructed. After the program objects are filled into the main program framework, the main program framework filled with program objects is converted into instructions that the measuring device can recognize, thereby obtaining the part measurement program. This achieves automatic generation of part measurement programs and improves the generation efficiency of part measurement programs.
[0082] Please see Figure 6 The part measurement method in this embodiment may further include the following steps: S601: Generate computer-aided design CAD images based on geometric elements.
[0083] In some embodiments of this application, when generating a computer-aided design CAD image based on geometric elements, it is necessary to first convert the distance coordinates of the geometric elements into pixel coordinates. Pixel coordinates refer to the pixel coordinates on the display screen. After converting the distance coordinates of the geometric elements into pixel coordinates, the computer-aided design CAD image is drawn based on the pixel position corresponding to the pixel coordinates on the display screen.
[0084] S602: Based on the CAD image and the preset physical image, calculate the transformation model matrix between the CAD image and the physical image. The transformation model matrix is used to spatially align the part drawing of the part to be measured with the CAD image.
[0085] The preset physical image refers to the image obtained by the measuring device taking pictures of the part placed at the measuring position.
[0086] Specifically, in this embodiment, a feature point extraction algorithm is first used to extract unique and stable feature points from both the physical image and the CAD image, such as corners, edge intersections, and inflection points. Then, a feature descriptor is calculated based on each feature point. Based on these descriptors, the feature points in the physical and CAD images are matched to find the most matching feature point pairs. The translation and rotation relationships between the physical and CAD images are then determined based on these feature point pairs, and a corresponding transformation model matrix is constructed. The transformation model matrix describes and calculates the translation, rotation, and scaling relationships between the two images. Therefore, by performing translation, rotation, and scaling on the physical image based on the transformation model matrix, spatial alignment between the part drawing and the CAD image of the part to be measured can be achieved.
[0087] Based on the feature descriptors of feature points in the real object image, feature similarity is calculated sequentially with the feature descriptors of feature points in the CAD image. The feature point with the highest feature similarity in the CAD image is selected to construct a feature point pair with the feature point in the real object image. The feature descriptor is a quantized encoding of the neighborhood information of a feature point. Its core function is to transform the visual attributes of feature points (such as grayscale, gradient, and texture) into machine-recognizable vectors or matrices, thereby distinguishing different feature points and achieving interference-resistant matching between feature points.
[0088] Please see Figure 7 ,for Figure 6 A detailed flowchart of step S601 in the part measurement method shown.
[0089] This embodiment is a detailed description of step S601 in the foregoing embodiment, further illustrating how to generate computer-aided design (CAD) images based on geometric elements. Specifically, it includes the following steps: S701: Based on the distance coordinates of geometric elements, the corresponding pixel coordinates are obtained.
[0090] In this specific implementation, the distance coordinates of the geometric elements in this embodiment can be key points within the geometric elements, such as the two endpoints of a line segment, the three vertices of a triangle, and the three key points of a circle. The ratio of the geometric elements is adjusted to 1:1 to make the ratio of the geometric elements the same as that of the actual object. Then, based on the camera's calibration parameters, the distance coordinates of the geometric elements are converted into pixel coordinates. The camera's calibration parameters include extrinsic and intrinsic parameters. Intrinsic parameters refer to fixed parameters describing the camera's optical characteristics (such as focal length, pixel size, and principal point coordinates), while extrinsic parameters refer to dynamic parameters describing the camera's "attitude and position" in the physical world (such as the camera's rotation angle and translation distance relative to the product). By converting the distance coordinates of the geometric elements using the camera's extrinsic and intrinsic parameters, the pixel coordinates of the geometric elements are obtained.
[0091] S702: Connect pixel coordinate points to form a contour combination containing multiple contours.
[0092] In this specific implementation, contour combination refers to the combination of multiple contour elements as required. The distance coordinates of key points in the geometric elements are converted into pixel coordinates. Then, the pixel coordinates are displayed on the screen of the electronic device, and the pixel coordinates are connected to form a contour. Multiple contours form a contour combination. (Refer to...) Figure 8 As shown, this is a schematic diagram of a contour combination in this embodiment, where 1 is the outer contour, 2 to 11 are different inner contours, the inner contours and the outer contours form a contour combination, and 12 is the area inside the outer contour excluding the inner contours.
[0093] For example, taking a triangle as an example, the three vertices of the triangle are pixel coordinate points. The three pixel coordinate points are displayed on the screen, and the pixel coordinate points are connected to obtain the outline of a triangle. Taking a rectangle as an example, the four vertices of the rectangle are pixel coordinate points. The pixel coordinate points are displayed on the screen, and the pixel coordinate points are connected to obtain the outline of a rectangle. At the same time, the triangle outline and the rectangle outline form an outline combination containing two outlines.
[0094] S703: Fill the contour combination to obtain the CAD image.
[0095] In some embodiments of this application, the methods for filling the contour combination include, but are not limited to, color filling, line filling, etc., and are not limited in this embodiment.
[0096] In some embodiments of this application, reference is made to Figure 8 As shown, filling the contour combination refers to filling the area inside the outer contour, excluding the area inside the inner contour, specifically area 12, to obtain the CAD image. (Reference) Figure 9The diagram shown is a schematic of the filled contour combination in this embodiment.
[0097] In some embodiments, the step in this embodiment is to fill the closed contours in the contour combination with color to obtain a CAD image. Specifically, this includes the following steps: determining the area to be filled from the contour combination, and determining the target filling area from the area to be filled, wherein the area to be filled is the blank area between the contours in the contour combination; filling the target filling area to obtain a CAD image.
[0098] In this specific implementation, any blank area in the contour combination can be used as the area to be filled. Then, it is determined whether each area to be filled is a closed contour. If the area to be filled is a closed contour, each closed contour is filled. If the area to be filled is an open contour, the next blank area is selected as the area to be filled. This process continues until all blank areas are traversed and each determined closed contour is filled, thus obtaining the CAD image.
[0099] Please see Figure 10 The steps in the aforementioned embodiments, namely determining the target filling area from the area to be filled, can be implemented through the following steps: S1001: Determine a target point from the area to be filled.
[0100] In this specific implementation, a point can be randomly selected as the target point in the area to be filled, or the geometric center point of the area to be filled can be selected as the target point. In this embodiment, there is no limitation on the method of selecting the target point.
[0101] S1002: Construct a ray along the target direction based on the target point, and record the number of intersections between the ray and the contour boundary line.
[0102] In some embodiments of this application, the target direction may be the positive direction of the X-axis of the coordinate system, the positive direction of the Y-axis of the coordinate system, etc. In this embodiment, the specific direction of the target direction is not limited.
[0103] Specifically, when a ray constructed based on the target point along the target direction crosses a contour boundary line, the number of intersection points is recorded as 1. When the ray crosses another contour boundary line, the number of intersection points is recorded as 2, and so on, until the ray no longer crosses the contour boundary line, thus obtaining the final number of intersection points.
[0104] S1003: Determine if the number of intersection points is odd.
[0105] In some embodiments of this application, it can be determined whether the area to be filled is the target area by judging whether the number of intersection points is odd. If the number of intersection points is odd, the area to be filled is determined to be the target area and the target area needs to be filled. If the number of intersection points is even, the area to be filled is determined not to be the target area, that is, the area to be filled does not need to be filled.
[0106] For example, taking a rectangular outline as the area to be filled, a target point is determined within the rectangular outline, and then a ray is constructed based on the target point. The ray can only pass through one outline boundary line of the rectangular outline, and the number of intersection points is 1 (an odd number). Therefore, the rectangular outline is determined as the target filling area.
[0107] S1004: If the number of intersections is odd, determine the area to be filled as the target area to be filled.
[0108] In some embodiments of this application, there may be one or more regions to be filled. It is necessary to traverse each region to be filled and determine whether each region to be filled is a target region. When it is determined that the region to be filled is a target region, the target region is filled, and the filling of the contour combination is finally completed.
[0109] In summary, this embodiment determines the target filling area from the area to be filled by identifying the target point in the area to be filled, which can effectively improve the selection efficiency of the target filling area compared to manually selecting the target filling area.
[0110] Please see Figure 11 ,for Figure 2 A detailed flowchart of step S201 in the part measurement method shown.
[0111] This embodiment is a detailed explanation of step S201 in the foregoing embodiment, further illustrating how to extract geometric elements and annotation elements from the part design drawing. Specifically, it includes the following steps: S1101: Verify the validity of part design drawings. Validity issues include one or more of the following: corrupted files, abnormal file structure, and incompatible files.
[0112] When a part design image has at least one of the above validity issues, it will result in the inability to extract geometric elements and annotation elements or the extraction of geometric elements and annotation elements being incomplete. In order to ensure the successful extraction of geometric elements and annotation elements, it is necessary to first verify the validity of the part design image. Only after the part design image has been verified can the extraction of geometric elements and annotation elements be performed.
[0113] In some embodiments of this application, file corruption is usually caused by disk errors, transmission interruptions, virus attacks, etc., and is usually manifested as the file being unable to be opened, or the content being garbled / missing after opening. Therefore, the part design drawing can be opened by design software to determine whether the file is corrupted. If the file cannot be opened, or the content is garbled / missing after opening, the part design drawing can be further verified by hash value verification or file size comparison. If the hash value verification fails, or the file size does not match the actual size, it means that the part design drawing is corrupted and the part design drawing needs to be downloaded again or repaired.
[0114] In some embodiments of this application, abnormal file structure usually means that the internal logical structure of the file does not conform to the format specification, such as the layer table of a CAD file being damaged. Therefore, the file can be repaired by the graphic repair tool of the drawing software, such as the graphic repair manager (RECOVER) of computer-aided design CAD.
[0115] S1102: If there are no validity issues with the part design drawing, obtain the header information of the part design drawing and parse the configuration parameters of the part design drawing from the header information.
[0116] Part design drawings typically include a header, classes, tables, blocks, and entities. The header contains file-level information such as file version, configuration parameters, and drawing limits. Classes describe the class of graphic objects and their attributes. Tables define configuration information for layers, linetypes, views, viewports, user coordinate systems (UCS), etc. Blocks define reusable graphic parts that can be inserted into the drawing. Entities contain the actual graphic data, such as lines, circles, and text. The end marker is the end-of-file marker.
[0117] The configuration parameters in this embodiment include basic drawing settings, such as unit system, precision, and drawing limits. This information is crucial for the correct parsing and display of the drawing. For example, knowing whether the drawing's unit system is millimeters or inches allows the parser to correctly convert and understand the coordinate values of geometric elements, ensuring the accuracy of the drawing's size and position.
[0118] S1103: Based on configuration parameters, read the entity data of the part design drawing to obtain geometric elements and annotation elements.
[0119] In practical implementations, the header configuration information may also contain pointers or indexes to other key parts, such as a pointer to the first tile, which contains all the graphic and non-graphical data in the file. The parser can quickly locate the positions of geometric elements and annotation elements based on these pointers, and parse them in the correct order and manner. Thus, based on the configuration parameters, geometric elements and annotation elements can be extracted quickly.
[0120] Combination Figure 1 As shown, in some embodiments of this application, the measuring device 10 includes, but is not limited to, a memory 11, a processor 12, and a computer program stored in the memory 11 and executable on the processor 12, such as a part measuring program. When the computer program is executed by the processor, it implements the configuration parameter method as described in the above embodiments.
[0121] Figure 1 Only the measuring device 10, which has a memory 11 and a processor 12, is shown. Those skilled in the art will understand that... Figure 1 The structure shown does not constitute a limitation on the measuring device 10, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0122] The memory 11 in the measuring device 10 stores multiple computer-readable instructions to implement a configuration parameter method. The processor 12 can execute multiple instructions to: extract annotation elements and geometric elements from the part design drawing, extract the associated elements of the annotation elements from the geometric elements, generate a part measurement program based on the annotation elements and associated elements, and call the part measurement program to measure the part to be measured. This realizes the automatic generation of the part measurement program, avoids the operational deviation caused by manually editing the part measurement program, and effectively improves the measurement accuracy of the part measurement program.
[0123] Specifically, the processor 12's implementation method for the above instructions can be found in [reference needed]. Figure 2 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.
[0124] Those skilled in the art will understand that the schematic diagram is merely an example of the measuring device 10 and does not constitute a limitation on the measuring device 10. The measuring device 10 can be a bus-type structure or a star-type structure. The measuring device 10 may also include more or fewer other hardware or software than shown in the diagram, or different component arrangements. For example, the measuring device 10 may also include input / output devices, network access devices, etc.
[0125] It should be noted that the measuring device 10 includes, but is not limited to, any one of the following: coordinate measuring machine and image measuring instrument. Other existing or future measuring devices that are suitable for this application should also be included within the scope of protection of this application and are incorporated herein by reference.
[0126] The memory 11 includes at least one type of computer-readable storage medium, which can be non-volatile or volatile. Computer-readable storage media include flash memory, portable hard drives, multimedia cards, card-type memories (e.g., SD memory, DX memory, etc.), magnetic storage, magnetic disks, optical disks, etc. In some embodiments, the memory 11 can be an internal storage unit of the measuring device 10, such as the portable hard drive of the measuring device 10. In other embodiments, the memory 11 can also be an external storage device of the measuring device 10, such as a plug-in portable hard drive, smart media card (SMC), secure digital card (SD) card, flash card, etc., equipped on the measuring device 10. The memory 11 can be used not only to store application software and various types of data installed on the measuring device 10, such as the code of a part measurement program, but also to temporarily store data that has been output or will be output.
[0127] In some embodiments, the processor 12 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits packaged with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 12 is the control unit of the measuring device 10, connecting various components of the measuring device 10 via various interfaces and lines. It executes programs or modules stored in the memory 11 (e.g., executing a part measurement program) and calls data stored in the memory 11 to perform various functions of the measuring device 10 and process data.
[0128] The processor 12 executes the operating system of the measuring device 10 and various installed applications. The processor 12 executes these applications to implement the steps described in each of the above-described embodiments of a part measurement method, for example... Figure 2 The steps are shown.
[0129] For example, a computer program may be divided into one or more modules / units, one or more of which are stored in memory 11 and executed by processor 12 to complete this application. One or more modules / units may be a series of computer-readable instruction segments capable of performing a specific function, which describe the execution process of the computer program in measuring device 10. For example, the computer program may be divided into an acquisition module 110, a determination module 120, and a compensation module 130.
[0130] The integrated unit implemented as a software functional module described above can be stored in a computer-readable storage medium. This software functional module, stored in a storage medium, includes several instructions to cause a computer device (which may be a personal computer, computer equipment, or network device, etc.) or processor to execute a portion of a part measurement method according to various embodiments of this application.
[0131] If the modules / units integrated into the measuring device 10 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware devices. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above.
[0132] Computer programs include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. Computer-readable media can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory, and other types of memory.
[0133] Furthermore, the computer-readable storage medium may primarily include a stored program area and a stored data area, wherein the stored program area may store the operating system, an application program required for at least one function, etc.; and the stored data area may store data created based on the use of blockchain nodes, etc.
[0134] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, in... Figure 1The symbol is represented by only one arrow, but this does not mean that there is only one bus or one type of bus. The bus is configured to implement communication between memory 11 and at least one processor 12, etc.
[0135] This application also provides a computer-readable storage medium (not shown), which stores computer-readable instructions. These computer-readable instructions are executed by a processor in a measuring device to implement a part measurement method according to any of the above embodiments.
[0136] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0137] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0138] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0139] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices described in the specification may also be implemented by a single unit or device through software or hardware. Terms such as "first," "second," etc., are used to indicate names and do not indicate any specific order.
[0140] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application.
Claims
1. A method for measuring a part, characterized in that, The method includes: Obtain the part design drawing and extract geometric elements and annotation elements from the part design drawing; Extract the associated elements of the labeled elements from the geometric elements, and add the labeled elements and the associated elements to a preset associated data list; Based on each labeled element and its corresponding associated element in the associated data list, a part measurement program is generated. The part measurement program is invoked to measure the part to be measured.
2. The part measurement method as described in claim 1, characterized in that, The step of extracting the associated elements of the labeled elements from the geometric elements includes: Obtain the annotation type of the annotation element; Based on the annotation type and the endpoints of the guide lines of the annotation element, candidate elements for the annotation element are selected from the geometric elements; Based on the annotation value of the annotation element, extract the associated elements of the annotation element from the candidate elements.
3. The part measurement method as described in claim 1, characterized in that, The step of generating a part measurement program based on each labeled element and its corresponding associated element in the associated data list includes: Based on each labeled element and its corresponding associated element, a program object and a tool object are constructed respectively, and a program list is constructed based on the program object, and a tool list is constructed based on the tool object; Establish the association between the program object in the program list and the tool object in the tool list; The part measurement program is generated based on the program objects that are associated with the tool object in the program list.
4. The part measurement method as described in claim 1, characterized in that, After extracting geometric elements and annotation elements from the part design drawing, the method further includes: Computer-aided design (CAD) images are generated based on the geometric elements; Based on the CAD image and the preset physical image, a transformation model matrix between the CAD image and the physical image is calculated. The transformation model matrix is used to spatially align the part drawing of the part to be measured with the CAD image.
5. The part measurement method as described in claim 4, characterized in that, The process of generating computer-aided design (CAD) images based on the geometric elements includes: Based on the distance coordinates of the geometric elements, the corresponding pixel coordinates are obtained; Connect the pixel coordinate points to form a contour combination containing multiple contours; The contour combination is filled to obtain the CAD image.
6. The part measurement method as described in claim 5, characterized in that, The process of filling the contour combination to obtain the CAD image includes: The region to be filled is determined from the contour combination, and the target filling region is determined from the region to be filled, wherein the region to be filled is the blank area between the contours in the contour combination; The target area is filled to obtain the CAD image.
7. The part measurement method as described in claim 6, characterized in that, Determining the target filling region from the region to be filled includes: Determine a target point from the region to be filled; Based on the target point, construct a ray along the target direction and record the number of intersections between the ray and the contour boundary line; Determine whether the number of intersection points is odd; If the number of intersections is odd, the area to be filled is determined to be the target filling area.
8. The part measurement method as described in claim 1, characterized in that, Extracting geometric elements and annotation elements from the part design drawing includes: Verify the validity of the part design drawing, including one or more issues such as file corruption, abnormal file structure, and file incompatibility; If the part design drawing does not have any validity issues, obtain the header information of the part design drawing, and parse the configuration parameters of the part design drawing from the header information; Based on the configuration parameters, the entity data of the part design drawing is read to obtain the geometric elements and the annotation elements.
9. A measuring device, characterized in that, The measuring device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the part measurement method as described in any one of claims 1 to 8.
10. 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 part measurement method as described in any one of claims 1 to 8.