Automatic construction method, device and equipment of parts library of engineering drawing and storage medium

By standardizing the closed outer contours in engineering drawings and comparing their shape fingerprints, combined with text annotations and part number information, parts of the same shape are automatically identified and merged, solving the problem of low efficiency in parts management in engineering drawings and achieving accurate parts library construction and statistics.

CN123158818APending Publication Date: 2026-11-24SHENZHEN LIDE ROBOT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611673649.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-28
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

In the existing technology, the management and reuse efficiency of parts in engineering drawings is low. Parts of the same shape are scattered in various parts of the drawing due to different part numbers, making it difficult to identify their shape reuse relationship. Manual comparison is difficult to accurately determine parts of the same shape. There is a lack of automatic means to associate text annotations with geometric contours, resulting in frequent duplicate database creation and statistical omissions.

Method used

By extracting the closed outer contour from the engineering drawings, performing normalization processing to generate shape fingerprints, and constructing multiple pose variants, based on shape fingerprint comparison similarity, combined with text annotations and part number information, the same shape is automatically identified and merged into the same library entry, and the part number alias and occurrence frequency are recorded.

Benefits of technology

It improves the accuracy of parts library construction and the efficiency of reuse statistics, reduces misjudgment of similar shapes and errors in manual association, and realizes the unified merging of parts of the same shape and the automatic statistics of their occurrence.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123158818A_ABST
    Figure CN123158818A_ABST
Patent Text Reader

Abstract

This application relates to an automatic construction method, apparatus, device, and storage medium for a parts library of engineering drawings. By acquiring engineering drawing data containing geometric entities and text annotations, the closed outer contours of parts extracted from the geometric entities are normalized to generate normalized shape fingerprints. The similarity of any two closed outer contours is compared under multiple pose variants constructed based on these fingerprints to determine whether they belong to the same shape. Based on the spatial relationship between the text annotations and the closed outer contours, combined with part number information, the part number corresponding to the closed outer contour is determined. Multiple closed outer contours determined to be of the same shape are merged into the same library entry. The different part numbers among the multiple closed outer contours are recorded as aliases for the library entry, and the frequency of occurrence of the same shape in the engineering drawing data is counted. A parts library containing the library entry is output. The technical solution of this application can improve the accuracy of engineering drawing parts library construction and the efficiency of reuse statistics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of computer-aided design and computer-aided manufacturing data preprocessing, and in particular to a method, apparatus, equipment and storage medium for automatically constructing a parts library of engineering drawings. Background Technology

[0002] Engineering drawings contain numerous geometric entities and textual annotations of parts. Parts with the same shape often appear repeatedly in different locations due to design continuity, minor specification adjustments, or drawing habits, and are assigned distinct part numbers. Currently, the management and reuse of these parts mainly rely on manual retrieval, classification, and statistics based on part numbers. When the same shape is scattered throughout the drawings with different part numbers, it is difficult for humans to identify the shape reuse relationship across part numbers, resulting in low efficiency in building the parts library, frequent duplication of library creation, and statistical omissions.

[0003] Even when attempting to automatically compare the shapes of parts using computers, the closed outer contours of parts are stored in the drawing data as a series of points. The starting point and main axis direction of these points can vary arbitrarily depending on the drawing method. The same shape can present a point sequence with vastly different values ​​at the data level, making direct comparison impossible to determine whether they are identical. At the same time, flat parts remain the same entity after rotation or mirroring, and conventional comparison methods cannot identify such differences in posture, causing identical parts to be misjudged as different parts.

[0004] Furthermore, text annotations and geometric contours in drawings belong to different data objects. There is a lack of reliable means to automatically associate text annotations with the correct contours and map them to the corresponding part numbers based on their spatial relationship. For multiple contours that are determined to be the same shape, how to merge their corresponding different part numbers into a unified record and accurately count the number of times the shape appears in the whole drawing still relies on manual annotation, which is prone to errors and difficult to scale. Summary of the Invention

[0005] This application provides a method, apparatus, equipment, and storage medium for automatically constructing a parts library for engineering drawings, which can improve the accuracy of parts library construction and the efficiency of reuse statistics.

[0006] In a first aspect, this application provides an automatic method for constructing a parts library from engineering drawings, comprising: acquiring engineering drawing data containing geometric entities and text annotations; extracting closed outer contours of parts from the geometric entities; performing normalization processing on the closed outer contours to generate normalized shape fingerprints; constructing multiple pose variants based on the normalized shape fingerprints; comparing the similarity of any two closed outer contours under the multiple pose variants to determine whether the two closed outer contours belong to the same shape; determining the part number corresponding to the closed outer contour based on the spatial positional relationship between the text annotations and the closed outer contours, combined with part number information; merging multiple closed outer contours determined to be of the same shape into the same library entry; recording the different part numbers among the part numbers corresponding to the multiple closed outer contours as aliases of the library entry; and counting the number of times the same shape appears in the engineering drawing data; and outputting a parts library containing the library entry.

[0007] In one possible implementation, extracting the closed outer contour of the part from the geometric entity specifically includes: rendering the curve entity in the geometric entity as a point sequence, wherein the curve entity includes at least one of polylines, straight lines, splines, arcs, and circles; merging adjacent points in the rendered point sequence whose distance is less than a preset deduplication threshold; forming candidate closed loops from the point sequences corresponding to the rendered closed curve entities, and forming candidate closed loops from the point sequences whose distance between the first and last points is less than a preset closure determination threshold; taking the point sequences corresponding to the rendered unclosed curve entities as segments to be reconstructed, rounding the coordinates of the first and last endpoints of each segment to be reconstructed according to a preset precision to generate corresponding endpoint keys, and grouping the segments to be reconstructed with the same endpoint keys using a disjoint-set data structure; for each group of segments to be reconstructed, starting from any segment to be reconstructed as the current chain, and... The tail endpoint key of the current chain is used as the tail endpoint key of the current chain. In the unused segments to be reconstructed, a target segment to be reconstructed with the same head endpoint key or tail endpoint key as the tail endpoint key of the current chain is searched. Based on the position of the endpoint in the target segment to be reconstructed that has the same tail endpoint key as the current chain, the target segment to be reconstructed is determined to be connected to the current chain in either the forward or reverse direction to extend the current chain and update the tail endpoint key. This search, connection, and update process is repeated until no further connection is possible or a preset chain extension step limit is reached, resulting in a candidate chain. When the head endpoint key and tail endpoint key of the candidate chain are the same, and the distance between the head and tail points of the candidate chain meets a preset closure tolerance, the candidate chain is used as a candidate closed loop. The candidate closed loop is filtered according to area and side length conditions to obtain the closed outer contour.

[0008] In one possible implementation, the normalization process of the closed outer contour to generate a normalized shape fingerprint specifically includes: uniformly interpolating points along the total perimeter of the closed outer contour by a preset fixed number of points to obtain a resampled point sequence; calculating the centroid of the resampled point sequence, subtracting the coordinates of the centroid from the coordinates of each point in the resampled point sequence to obtain a translated point sequence; calculating the covariance components based on the translated point sequence, and determining the principal axis direction of the translated point sequence by the covariance components; rotating the translated point sequence until the principal axis direction is aligned with a preset coordinate axis to obtain an aligned point sequence; when the number of points in the aligned point sequence exceeds a preset downsampling threshold, performing intermittent downsampling on the aligned point sequence to obtain a normalized shape fingerprint.

[0009] In one possible implementation, the step of constructing multiple pose variants based on the normalized shape fingerprint and comparing the similarity of any two closed outer contours under the multiple pose variants to determine whether the two closed outer contours belong to the same shape specifically includes: for any two closed outer contours, designating one of the closed outer contours as the first closed outer contour and the other as the second closed outer contour; constructing four pose variants for the shape fingerprint of the second closed outer contour, the four pose variants being an identity variant, a variant rotated 180° around the origin, a variant mirrored along a first coordinate axis, and a variant mirrored along a second coordinate axis, wherein the first coordinate axis is a coordinate axis in the coordinate system where the closed outer contour is located, and the second coordinate axis is another coordinate axis perpendicular to the first coordinate axis; for each pose variant of the second closed outer contour, the similarity of the shape fingerprint of the first closed outer contour is compared to the shape fingerprint of the second closed outer contour. The shape fingerprint of the first closed outer contour is used as the first point set, and the current pose variant of the second closed outer contour is used as the second point set. The point set with fewer points in the first and second point sets is taken as the reference set, and the point set with more points in the first and second point sets is taken as the target set. The average nearest Euclidean distance from each point in the reference set to the target set is calculated as the average nearest distance between the first closed outer contour and the current pose variant. The minimum of the four average nearest distances between the first closed outer contour and the four pose variants is taken as the similarity between the two closed outer contours. When the similarity is less than a preset distance threshold, and the relative difference in area between the two closed outer contours is not greater than a preset area tolerance, and the relative difference in perimeter between the two closed outer contours is not greater than a preset perimeter tolerance, the two closed outer contours are determined to belong to the same shape; otherwise, the two closed outer contours are determined not to belong to the same shape.

[0010] In one possible implementation, the part number information includes a material list, which contains a correspondence between serial numbers and part numbers. The step of determining the part number corresponding to the closed outer contour based on the spatial relationship between the text annotation and the closed outer contour, combined with the part number information, specifically includes: identifying text annotations conforming to a preset part label format as part labels, the part labels containing serial numbers, and recording the position of the part labels in the engineering drawing data; for each closed outer contour, when the position of the part label is located within the area where the outer rectangle of the closed outer contour expands outward according to a preset first spatial tolerance, or when the distance between the position of the part label and the centroid of the closed outer contour does not exceed a preset second spatial tolerance, associating the part label with the closed outer contour; and mapping the serial number of the part label associated with the closed outer contour to the part number corresponding to the closed outer contour according to the correspondence.

[0011] In one possible implementation, the step of merging multiple closed outer contours determined to be of the same shape into the same library entry, using the distinct component numbers corresponding to the multiple closed outer contours as aliases for the library entry, and counting the occurrences of the same shape in the engineering drawing data, specifically includes: merging multiple closed outer contours determined to be of the same shape into the same library entry; removing the suffixes from the component numbers corresponding to the multiple closed outer contours merged into the same library entry to obtain the base family name to which each component number belongs; when there are multiple base family names, determining the family of the library entry based on the occurrence counts of each of the multiple base family names; generating an entry number for the library entry according to the order of entries within the family; using the distinct component numbers corresponding to the multiple closed outer contours merged into the same library entry as aliases for the library entry; counting the number of closed outer contours merged into the same library entry in the engineering drawing data as the occurrence count of the library entry; and recording the family, entry number, alias, and occurrence count of the library entry.

[0012] In one possible implementation, the output includes a parts library containing the library entries, and further includes: acquiring newly added engineering drawing data; extracting newly added closed outer contours and their corresponding part numbers from the newly added engineering drawing data; generating shape fingerprints of the newly added closed outer contours; setting a representative fingerprint set, which is initially empty; selecting any unprocessed newly added closed outer contour from all the extracted newly added closed outer contours as the current newly added closed outer contour; comparing the shape fingerprint of the current newly added closed outer contour with each representative fingerprint in the representative fingerprint set; if the shape fingerprint of the current newly added closed outer contour matches a target representative fingerprint in the representative fingerprint set, incrementing the occurrence count of the library entry corresponding to the target representative fingerprint by one, and merging the part number corresponding to the current newly added closed outer contour into the alias of the library entry corresponding to the target representative fingerprint; if the shape fingerprint of the current newly added closed outer contour matches a target representative fingerprint in the representative fingerprint set, then... If the shape fingerprint of the newly added closed outer contour does not match any of the representative fingerprints in the representative fingerprint set, then the shape fingerprint of the newly added closed outer contour is compared with the library entries stored in the parts library before this incremental merging. If the shape fingerprint of the newly added closed outer contour matches any of the target library entries in the stored library entries, then the occurrence count of the target library entry is incremented by one, and the part number corresponding to the newly added closed outer contour is merged into the alias of the target library entry. If the shape fingerprint of the newly added closed outer contour does not match any of the stored library entries, then the shape fingerprint of the newly added closed outer contour is added to the representative fingerprint set as a new representative fingerprint, and a library entry corresponding to the new representative fingerprint is created. The above steps are repeated until all newly added closed outer contours have been processed. The library entries corresponding to each representative fingerprint in the representative fingerprint set are added to the parts library. The parts library is then updated and saved.

[0013] Secondly, this application provides an automatic parts library construction device for engineering drawings, comprising: a closed outer contour extraction module, a closed outer contour shape determination module, a part number determination module, a closed outer contour merging module, and a parts library output module; wherein, the closed outer contour extraction module is used to acquire engineering drawing data containing geometric entities and text annotations, and extract the closed outer contour of the parts from the geometric entities; the closed outer contour shape determination module is used to perform normalization processing on the closed outer contour, generate a normalized shape fingerprint, and construct multiple pose variants based on the normalized shape fingerprint, and compare any two of the closed outer contours under the multiple pose variants. The similarity of the outer contours determines whether two closed outer contours belong to the same shape; the component number determination module is used to determine the component number corresponding to the closed outer contour based on the spatial positional relationship between the text annotation and the closed outer contour, combined with the component number information; the closed outer contour merging module is used to merge multiple closed outer contours determined to be of the same shape into the same library entry, and to record the component numbers that are different among the component numbers corresponding to the multiple closed outer contours as aliases of the library entry, and to count the number of times the same shape appears in the engineering drawing data; the parts library output module is used to output a parts library containing the library entries.

[0014] Thirdly, embodiments of this application also provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described method.

[0015] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the above-described method.

[0016] This application provides a method, apparatus, device, and storage medium for automatically constructing a parts library for engineering drawings, which has the following advantages compared with the prior art: By standardizing the closed outer contours extracted from engineering drawing data and generating standardized shape fingerprints, and constructing multiple pose variants based on these standardized shape fingerprints, the similarity of any two closed outer contours under multiple pose variants can be compared, reducing misjudgments of similar shapes caused by differences in contour poses and improving the accuracy of identifying similar parts. By determining the part number based on the spatial positional relationship between text annotations and closed outer contours and combining it with part number information, the correspondence between geometric contours and part numbers in engineering drawing data can be automatically established, reducing omissions and errors caused by manual one-by-one association. By merging multiple closed outer contours determined to be of the same shape into the same library entry, and recording the different part numbers as aliases for the library entry, and counting the occurrence frequency of the same shape, parts of the same shape can be uniformly merged and their multiple part number information can be retained, realizing automatic counting of occurrence frequency, reducing manual retrieval, classification and statistical omissions, and finally outputting a parts library that is easy for downstream reuse. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0020] Figure 1 This is a flowchart illustrating one embodiment of the automatic construction method for a parts library of engineering drawings provided in this application; Figure 2 This is a schematic diagram of a structural embodiment of an automatic parts library construction device for engineering drawings provided in this application; Figure 3 This is a schematic diagram of the structure of a computer device provided in this application. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0022] The following disclosure provides numerous different embodiments or examples for implementing various structures of this application. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of this application. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0023] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0024] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0025] It should also be further understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0026] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."

[0027] Example 1, see Figure 1 , Figure 1 This is a flowchart illustrating one embodiment of the automatic construction method for a parts library of engineering drawings provided in this application, as shown below. Figure 1 As shown, the method includes steps 101-105, as detailed below: Step 101: Obtain engineering drawing data containing geometric entities and text annotations, and extract the closed outer contour of the part from the geometric entities.

[0028] In one embodiment, engineering drawing data is received from an upstream design institute; the engineering drawing data is ship / steel structure engineering drawings, including at least one of nesting drawings, part drawings, and summary drawings; wherein, the nesting drawing is a CNC cutting layout drawing, including the actual outline of the part after unfolding and the blanking list; the part drawing is a drawing in which only a single part is arranged in a DWG; the summary drawing is a drawing in which multiple parts are arranged in a grid in a DWG.

[0029] Specifically, the primary format of the engineering drawing data is DXF R2010 / R2013 / R2018, corresponding to version identifiers AC1027 / AC1028 / AC1032 respectively; the compatible format is DWG. The unit of the engineering drawing data is millimeters (mm), and the drawing scale is 1:1; the page width of A3 drawing size is 420×29.36 units, used for page positioning.

[0030] Specifically, when the obtained engineering drawing data is in DWG format, it is first converted to DXF text using LibreDWG dwg2dxf; the DXF text is a line stream consisting of 0 groups + entity name + group code value pairs.

[0031] Specifically, after obtaining the DXF text, idempotent repair of the SORTENTSTABLE group code stream is performed on the DXF text. This includes: scanning the DXF text line by line, reading the next line as the entity name when encountering 0 groups; setting the sorting table flag to true only when the entity name equals SORTENTSTABLE; starting the check only after 100 groups / AcDbSortentsTable; within the SORTENTSTABLE scope, if consecutive group code values ​​of 331 are followed by another group code value of 331, then adding a group code value of 50 in the middle; if consecutive group code values ​​of 5 are followed by another group code value of 5, then adding a group code value of 3310 in the middle; counting the number of replenished entries, and writing the repaired line stream back to the file only when the number of replenished entries is greater than zero; if the number of replenished entries is equal to zero, then not writing back to the file. The repaired DXF text can be read by downstream DXF parsing libraries.

[0032] Specifically, the engineering drawing data includes geometric entities and text annotations. The geometric entities include at least one of lightweight polylines, straight lines, splines, arcs, circles, and legacy polylines. Lightweight polylines are lightweight polyline entities in DXF, which may contain convex arc segments; the convexity of the convex arc segment is the arc convexity value between adjacent vertices of the polyline, satisfying ang = 4·atan(bulge), where ang is the central angle and bulge is the convexity; legacy polylines are legacy polyline entities in DXF; and text annotations are text entities in the drawing model space.

[0033] Specifically, the engineering drawing data also includes a material list, which contains a correspondence between serial numbers and component numbers. The parsing result is a correspondence between drawing page / serial number and component number.

[0034] Specifically, the text annotation processing may include page positioning, plate thickness extraction, part label recognition, and mapping of serial number to part number.

[0035] Specifically, for page positioning and plate thickness extraction: Drawing pages are divided according to the horizontal coordinate of the insertion point of the A3 drawing frame, with a page width of 420 × 29.36 units. Each text entity is assigned to its corresponding drawing page; plate thickness is extracted from the text, with the thickness specification being a number. number The format is numerical, excluding text containing the phrase "material specifications"; for part label recognition: text markings conforming to a preset part label format are recognized as part labels, where the preset part label format is ^\d+([AZ]{1,3})\ ?$ or ^\d+-\d+([AZ]{1,3})\ The part label record is {label, seq, x, y, sheet}, where label is the label text, seq is the sequence number, x and y are the horizontal and vertical coordinates of the label in the drawing, and sheet is the drawing page to which it belongs. Regarding the mapping between sequence number and part number: the engineering drawing data also includes a material list, which contains the correspondence between sequence number and part number. Its parsing result is drawing page / sequence number - part number. The material list is used to map the sequence number of the part label to the part number. For example, sequence number 1 in label 1PS is mapped to part number S206PS-114FA21-0.

[0036] Based on the above, the obtained engineering drawing data includes geometric entities, text annotations, and material lists, which are used for subsequent extraction of the closed outer contour of parts from geometric entities, generation of standardized shape fingerprints, identification of the same shape, determination of part numbers, and construction of a parts library.

[0037] In one embodiment, extracting the closed outer contour of a part from the geometric entity specifically includes: rendering the curved entities in the geometric entity as a point series, wherein the curved entities include at least one of polylines, straight lines, splines, arcs, and circles; merging adjacent points in the rendered point series whose distance is less than a preset deduplication threshold; forming candidate closed loops from the point series corresponding to the rendered closed curved entities, and forming candidate closed loops from the point series whose distance between the first and last points is less than a preset closure determination threshold; taking the point series corresponding to the rendered unclosed curved entities as segments to be reconstructed, rounding the coordinates of the first and last endpoints of each segment to be reconstructed according to a preset precision to generate corresponding endpoint keys, and grouping the segments to be reconstructed with the same endpoint keys using a disjoint-set data structure; for each group of segments to be reconstructed, starting from any segment to be reconstructed as the current chain, and... The tail endpoint key of the chain is used as the current chain tail endpoint key. In the unused segments to be reconstructed, a target segment to be reconstructed with the same head endpoint key or tail endpoint key as the current chain tail endpoint key is searched. Based on the position of the endpoint in the target segment to be reconstructed that is the same as the current chain tail endpoint key, it is determined whether the target segment to be reconstructed is connected to the current chain in a forward or reverse direction to extend the current chain and update the current chain tail endpoint key. This search, connection, and update process is repeated until it is impossible to continue connecting or a preset chain extension step limit is reached, resulting in a candidate chain. When the head endpoint key and tail endpoint key of the candidate chain are the same, and the distance between the head and tail points of the candidate chain meets a preset closure tolerance, the candidate chain is used as a candidate closed loop. The candidate closed loop is filtered according to area and side length conditions to obtain the closed outer contour.

[0038] Specifically, the polyline includes, but is not limited to, lightweight polylines and legacy polylines. The lightweight polyline is an LWPOLYLINE entity in DXF, and the legacy polyline is a POLYLINE entity in DXF, which may contain convex arc segments. For lightweight polylines, a precise discretization method is used to render them as point sequences: For each pair of convex vertices, the central angle is calculated using the formula ang = 4·atan(bulge), where ang is the central angle and bulge is the convexity; the radius is calculated from the chord length and the central angle, and the center is calculated from the perpendicular direction of the midpoint. Sampling is performed at a ratio of 80 points per full circle to obtain the point sequence corresponding to the lightweight polyline; for non-convex segments in the lightweight polyline, the two endpoints are directly taken as the corresponding point sequence; for older polylines, their vertex entities are read sequentially as point sequences. If adjacent vertices contain convexity, they are discretized in the same way as lightweight polylines; if they do not contain convexity, the vertices are directly taken as point sequences; for spline curves, a flattening (step) sampling method is used to obtain the corresponding point sequence; for arcs and circles, sampling is performed uniformly by angle to obtain the corresponding point sequence; for straight lines, only the two endpoints are retained if the length is not less than 30mm.

[0039] Specifically, adjacent points in the rendered point array whose distance to each other is less than a preset deduplication threshold are merged. The preset deduplication threshold is preferably 1e-4mm.

[0040] Specifically, when the closure attribute of the curve entity is true, or when the distance between the first and last points in the point sequence corresponding to the curve entity is less than the preset closure judgment threshold, a candidate closed loop is directly formed; the preset closure judgment threshold is preferably 5mm.

[0041] Specifically, the preset precision is preferably 0.01mm, and the endpoint key is a hash key with coordinates rounded to 0.01mm, i.e., endpoint key = (round(x,2),round(y,2)); each segment to be reconstructed uses the endpoint keys of its two ends to perform a union operation, and segments to be reconstructed that share endpoints are grouped into the same group.

[0042] Specifically, if the start endpoint key of the target segment to be rebuilt is the same as the end endpoint key of the current chain, the target segment to be rebuilt is connected to the current chain in the forward direction; if the end endpoint key of the target segment to be rebuilt is the same as the end endpoint key of the current chain, the target segment to be rebuilt is connected to the current chain in the reverse direction; the upper limit of the preset extension chain step is preferably 4000.

[0043] Specifically, the chain is extended until the first end point key and the last end point key are equal, and the distance between the first and last points is not greater than the preset closure tolerance, when the closure is considered successful; the preset closure tolerance is preferably 1e-2mm.

[0044] Preferably, if a group of segments to be reconstructed cannot be closed, i.e., no connecting segment can be found or the beginning and end do not coincide, then the group of segments to be reconstructed is discarded; if there are no candidate closed loops after filtering, then an empty library is output.

[0045] Specifically, when filtering the candidate closed loops based on area and side length conditions, candidate closed loops with an area less than 8000mm², a short side less than 80mm, and a long side greater than 9000mm are removed to eliminate interference from annotations, drawing frames, and nesting plate outlines. For example, for a nesting plate with dimensions of approximately 12331×8719, its outline is removed. The candidate closed loops retained after the above filtering are the closed outer contours. The closed outer contours include a point array, a bounding box, an area, a perimeter, and a centroid. The bounding box refers to the smallest axis-aligned rectangle that can completely enclose all points of the closed outer contour.

[0046] Step 102: Normalize the closed outer contour to generate a normalized shape fingerprint, and construct multiple pose variants based on the normalized shape fingerprint. Compare the similarity of any two closed outer contours under the multiple pose variants to determine whether the two closed outer contours belong to the same shape.

[0047] In one embodiment, the closed outer contour is normalized to generate a normalized shape fingerprint. Specifically, this includes: uniformly interpolating points along the total perimeter of the closed outer contour at a preset fixed number of points to obtain a resampled point sequence; calculating the centroid of the resampled point sequence, subtracting the coordinates of the centroid from the coordinates of each point in the resampled point sequence to obtain a translated point sequence; calculating the covariance components based on the translated point sequence, and determining the principal axis direction of the translated point sequence using the covariance components; rotating the translated point sequence until the principal axis direction is aligned with a preset coordinate axis to obtain an aligned point sequence; and when the number of points in the aligned point sequence exceeds a preset downsampling threshold, performing intermittent downsampling on the aligned point sequence to obtain a normalized shape fingerprint.

[0048] Specifically, the total perimeter of the closed outer contour is calculated, and the total perimeter is divided by the preset fixed number of points to obtain the sampling step size. Points are then interpolated segment by segment along the closed outer contour to obtain the resampled point sequence. By resampling the arc length, the influence of uneven vertex density and the drawing start position of the closed outer contour can be eliminated, making the subsequently generated normalized shape fingerprint insensitive to the drawing start point.

[0049] Preferably, the preset number of fixed points is 64 points.

[0050] Specifically, let the coordinates of each point in the resampled point sequence be (x, y) and the coordinates of the centroid be (cx, cy). Then, by subtracting the coordinates of the centroid from the coordinates of each point, the translated point sequence is obtained, so that the centroid of the translated point sequence is located at the origin.

[0051] Specifically, the covariance components include a, b, and c, where, The angle of the main axis direction The translated point array is rotated until its principal axis is aligned with a preset coordinate axis, resulting in an aligned point array. The preset coordinate axis is preferably the X-axis; that is, the major axis of the translated point array is aligned with the X-axis through rotation. Alignment via principal component analysis eliminates rotational attitude differences in the closed outer contour, making the subsequently generated normalized shape fingerprint insensitive to rotation.

[0052] Preferably, the preset downsampling threshold is 300 points.

[0053] Specifically, when the number of points in the aligned point column exceeds 300, every other point is taken to reduce the number of points and improve the speed of subsequent similarity comparison; when the number of points in the aligned point column does not exceed 300, the aligned point column is directly used as the normalized shape fingerprint. The normalized shape fingerprint is used to subsequently construct multiple pose variants, and the similarity of any two closed outer contours is compared under the multiple pose variants to determine whether the two closed outer contours belong to the same shape.

[0054] In one embodiment, the step of constructing multiple pose variants based on the normalized shape fingerprint and comparing the similarity of any two closed outer contours under the multiple pose variants to determine whether the two closed outer contours belong to the same shape specifically includes: for any two closed outer contours, designating one of the closed outer contours as the first closed outer contour and the other as the second closed outer contour; constructing four pose variants for the shape fingerprint of the second closed outer contour, the four pose variants being an identity variant, a variant rotated 180° around the origin, a variant mirrored along a first coordinate axis, and a variant mirrored along a second coordinate axis, wherein the first coordinate axis is a coordinate axis in the coordinate system where the closed outer contour is located, and the second coordinate axis is another coordinate axis perpendicular to the first coordinate axis; for the comparison between the shape fingerprint of the first closed outer contour and each pose variant of the second closed outer contour, the first closed outer contour is designated as the first pose variant. The shape fingerprint of the outer contour is used as the first point set, and the current pose variant of the second closed outer contour is used as the second point set. The point set with fewer points in the first and second point sets is taken as the reference set, and the point set with more points in the first and second point sets is taken as the target set. The average nearest Euclidean distance from each point in the reference set to the target set is calculated as the average nearest distance between the first closed outer contour and the current pose variant. The minimum of the four average nearest distances between the first closed outer contour and the four pose variants is taken as the similarity between the two closed outer contours. When the similarity is less than a preset distance threshold, and the relative difference in area between the two closed outer contours is not greater than a preset area tolerance, and the relative difference in perimeter between the two closed outer contours is not greater than a preset perimeter tolerance, the two closed outer contours are determined to belong to the same shape; otherwise, the two closed outer contours are determined not to belong to the same shape.

[0055] Preferably, the first coordinate axis can be the X-axis, and the second coordinate axis can be the Y-axis.

[0056] Specifically, since the normalization process has aligned the principal axis of the closed outer contour to the preset coordinate axis, the remaining orientation ambiguity after alignment includes a 180° rotation around the principal axis and a mirror image along the two principal axes. The above four posture variants constitute all four elements of the dihedral group D2, which can cover all the remaining ambiguities after normalization alignment.

[0057] Specifically, the average nearest distance satisfies the formula:

[0058] in, Q1 represents the normalized shape fingerprint of the first closed outer contour, Q2 represents the current pose variant of the second closed outer contour; S represents the reference set, T represents the target set; |S| represents the number of points in the reference set; This represents the Euclidean distance between point x and point y.

[0059] Specifically, the average nearest distance is a directed distance. The set with fewer points is taken as the reference set, and the set with more points is taken as the target set. The average nearest distance is the average of the nearest distances from each point in the set with fewer points S to the set with more points T, with the direction being S→T. Therefore, d(Q1,Q2) and d(Q2,Q1) are generally not equal (unless the two point sets have the same number of points and the distance structure is symmetrical), and the calculation direction can be kept consistent by taking the set with fewer points as S.

[0060] Specifically, the similarity between the two closed outer contours satisfies:

[0061] in, This represents the i-th pose variant among the four pose variants.

[0062] Preferably, the preset distance threshold is 5mm, the preset area tolerance is 1%, and the preset perimeter tolerance is 1%.

[0063] Specifically, the relative difference in area is The relative difference in perimeter is Where area1 and area2 represent the areas of the two closed outer contours, and perim1 and perim2 represent the perimeters of the two closed outer contours, respectively.

[0064] It should be noted that the above four attitude variants include mirror variants. Therefore, this solution also determines that closed outer contours that are mirror images of each other are the same shape. The basis for this is that: mirroring the contour of a flat plate cut part in a plane is equivalent to flipping the plate along the in-plane axis. After flipping, it is still the same entity. Therefore, mirror merging does not cause confusion between left and right-hand parts. Moreover, shipyard drawings often only draw one side and mark it as "symmetrical on the opposite side". Mirror merging conforms to the drawing convention.

[0065] In one specific implementation, if the mirror axis forms an arbitrary angle with the main axis of the part, the four posture variants may not cover each other. In this case, the mirror copy is not determined to be the same shape, which is a conservative failure and no erroneous merging occurs.

[0066] It should be noted that neither holes nor thickness are involved in the isomorphism determination. The hole rings within the closed outer contour do not establish a relationship with the outer contour, and the hole field of the library entry is empty; thickness is not involved in deduplication, and the library entry stores a single-value thickness. The joint hole determination and thickness list are proposed improvements and will be further defined after implementation and manual review.

[0067] Step 103: Based on the spatial relationship between the text annotation and the closed outer contour, and in conjunction with the component number information, determine the component number corresponding to the closed outer contour.

[0068] In one embodiment, the part number information includes a material list, which contains a correspondence between serial numbers and part numbers.

[0069] In one embodiment, determining the part number corresponding to the closed outer contour based on the spatial positional relationship between the text annotation and the closed outer contour, combined with the part number information, specifically includes: identifying text annotations in the text annotation that conform to a preset part label format as part labels, the part labels containing a serial number, and recording the position of the part labels in the engineering drawing data; for each closed outer contour, when the position of the part label is located within the area of ​​the outer rectangle of the closed outer contour that expands outward according to a preset first spatial tolerance, or when the distance between the position of the part label and the centroid of the closed outer contour does not exceed a preset second spatial tolerance, associating the part label with the closed outer contour; and mapping the serial number of the part label associated with the closed outer contour to the part number corresponding to the closed outer contour according to the correspondence.

[0070] Specifically, the engineering drawing data is positioned on a page and plate thickness is extracted; drawing pages are divided according to the x-coordinate of the insertion point of the INSERT block reference entity in the A3 size of the engineering drawing data, with a page width of, for example, 420 × 29.36 units; each text annotation is assigned to its corresponding drawing page; and plate thickness information is extracted from the text annotations, for example, by matching "number". number The specifications are displayed in numerical form, excluding any text containing the words "material specifications," thus yielding the plate thickness corresponding to each drawing page.

[0071] Text annotations conforming to a preset part label format are identified as part labels. The preset part label format is, for example, ^\d+([AZ]{1,3})\ ?$ or ^\d+-\d+([AZ]{1,3})\ The identified part label contains a serial number, and records the label text, serial number, x-coordinate, y-coordinate, and sheet number of the label in the drawing, i.e., recorded as {label,seq,x,y,sheet}.

[0072] Specifically, the circumscribed rectangle of the closed outer contour is expanded outwards by a preset first spatial tolerance, preferably 60mm. If the coordinates of the part label fall within the expanded area, or if the distance between the part label and the centroid of the closed outer contour does not exceed a preset second spatial tolerance, preferably 500mm, then the part label is associated with the closed outer contour, and the part label is recorded in the label text, source, and serial number of the closed outer contour. It should be noted that, due to the OR relationship of the above association conditions, a part label may be associated with multiple adjacent or overlapping closed outer contours simultaneously. In another embodiment, each part label can be associated only with the closed outer contour that meets the above conditions and has the closest centroid distance, to eliminate the aliasing problem of the same part number being classified into multiple entries with different shapes.

[0073] Preferably, the bounding rectangle of the closed outer contour is its corresponding bounding box.

[0074] Specifically, for a closed outer contour that is not associated with any part label, the nearest part label within a preset third space tolerance is selected as a clue label and recorded in the closed outer contour. The preset third space tolerance is preferably 600mm. A "?" suffix is ​​added after the part label as a clue. This clue label is only used for manual verification and does not participate in the part number mapping.

[0075] Specifically, after associating the part labels with the closed outer contour, the material list in the engineering drawing data is parsed to obtain the correspondence between the serial number and the part number; the serial number of the part label associated with the closed outer contour is mapped to the part number according to the correspondence, such as the serial number 1 in part label 1PS being mapped to the part number S206PS-114FA21-0 according to the correspondence, thus obtaining the part number corresponding to the closed outer contour.

[0076] Specifically, the mode of the plate thickness of all source labels on the drawing page containing the closed outer contour is taken as the thickness of the closed outer contour. Furthermore, closed outer contours with the same shape but different part numbers have their part numbers merged into the alias of the same library entry, achieving cross-part number reuse for the same shape of outer contour.

[0077] Preferably, to avoid alias contamination, the above spatial association can be tightened to a one-to-one nearest association between the label and the closed outer contour: for each part label, it is only associated with a closed outer contour whose "circumscribed rectangular extension area contains the part label and whose centroid distance is closest", so that a part label is associated with only one closed outer contour.

[0078] Step 104: Merge multiple closed outer contours that are determined to be of the same shape into the same library entry, record the different part numbers among the part numbers corresponding to the multiple closed outer contours as aliases of the library entry, and count the number of times the same shape appears in the engineering drawing data.

[0079] In one embodiment, multiple closed outer contours determined to be of the same shape are merged into the same library entry; the suffixes of the part numbers corresponding to the multiple closed outer contours merged into the same library entry are removed to obtain the base family name to which each part number belongs; when there are multiple base family names, the family of the library entry is determined based on the occurrence count of each of the multiple base family names; an entry number is generated for the library entry according to the order of entries within the family; the different part numbers among the part numbers corresponding to the multiple closed outer contours merged into the same library entry are recorded as aliases of the library entry; the number of closed outer contours merged into the same library entry in the engineering drawing data is counted as the occurrence count of the library entry; the family, entry number, alias, and occurrence count of the library entry are recorded.

[0080] Specifically, among multiple closed outer contours that are determined to be of the same shape by shape fingerprint comparison, only one is retained to represent the closed outer contour, and the multiple closed outer contours are merged into the same library entry.

[0081] Specifically, the part number is obtained by mapping the serial number of the part label associated with the closed outer contour through the bill of materials; the numbers at the end of the part number and the optional suffix P or S are removed, i.e., removed by the regular expression \d+[PS]?$, to obtain the base family name to which the part number belongs. For example, the base family name 114FB21 is obtained by removing the "21" at the end of the part number; the base family name PA1 is obtained by removing the "1" at the end of the part number PA.

[0082] Specifically, when there are multiple base family names, the frequency of each base family name in the part numbers corresponding to multiple closed outer contours merged into the same library entry is counted; the base family name with the most occurrences is determined as the family of the library entry; if the frequency is the same, the family of the library entry is determined according to lexicographical order. For example, if the base family name 114FA appears 30 times and 110FA appears 12 times in the part number, then 114FA is determined as the family of the library entry.

[0083] Specifically, the entry number is {family or 'X'}-{seq: 03d}, where family is the family of the library entry; if the library entry has no family, it is replaced by "X"; seq is the sequentially increasing sequence number within the same family, represented by three digits. For example, when the family is 114FA, the entry number can be 114FA-001, 114FA-002, etc.

[0084] Specifically, if multiple closed outer contours have the same part number, it is recorded only once; if different part numbers exist, they are all recorded as aliases for the library entry. For example, aliases for library entry 114FA-001 may include different part numbers such as 110FA22, 110FB21, 110FC23, 110FC24, 110FC25, 114FA22, 114FB21, 114FB23, 117JB25, 119FC30, PA25, and PB24.

[0085] It should be noted that the aliases are obtained through spatial association and may include part numbers that are only spatially adjacent but not identical in shape, that is, the aliases are not strictly one-to-one mappings; preferably, the alias association can be tightened by using a one-to-one relationship between the label and the nearest associated outer contour.

[0086] Specifically, the occurrence count refers to the cumulative number of times the same shape appears in the engineering drawing data, and is incremented by one for each duplicate match. For example, the number of occurrences of library entry 114FA-001 can be 30.

[0087] Specifically, the family, entry number, alias, and number of occurrences of the library entry are written into the library entry.

[0088] Specifically, when generating the library entry, the point sequence representing the closed outer contour is normalized to have the smallest angle of the circumscribed rectangle as the origin, and stored as the library entry's outer contour. The area, perimeter, bounding box, dimensions, span, hole field, thickness, and source information of the library entry are recorded, where the hole field is currently always empty, and the thickness is currently a single value. Further, when generating the library entry, it is identified whether the closed outer contour corresponding to the library entry belongs to a preset standard shape; if it belongs to the preset standard shape, the library entry is used as a standard shape entry, and template parameters are recorded for the standard shape entry. The template parameters include a reference length and feature widths at both ends along the length direction.

[0089] Step 105: Output the parts library containing the library entries.

[0090] In one embodiment, after generating the library entries, an entry number is generated for each library entry in the manner described above; the library entry is written into an entry file with the entry number as the filename, and the entry file contains at least one of the following: the library entry's family, entry number, alias, occurrence count, library entry outline, area, perimeter, bounding box, size, span, hole field, thickness, and source information; the library entry outline is converted into an outline preview polygon, and written into a preview file with the entry number as the filename; an index file is generated, and the index file contains a version number, update time, total number of library entries, a list of entry numbers, and a family index, wherein the family index records the correspondence between family names and the list of entry numbers belonging to that family; the entry file, the preview file, and the index file are saved to the parts library directory to obtain a parts library containing the library entries.

[0091] In one embodiment, when outputting the parts library, statistical results can also be output, including the number of extracted closed outer contours, the number of new entries, the number of duplicates removed in this round, the number of entries matched in the existing library, and the total number of processes. The parts library can be consumed by downstream modeling, process matching, or weight estimation modules by family, standard shape type, or size.

[0092] In one embodiment, for standard shape entries in the parts library, template stretching can also be performed according to template parameters: when aligning the standard shape entries to the target length, the left and right end segments of the library entry's outer contour along the length direction, whose coordinates do not exceed the corresponding feature width, are kept unchanged. The right end segment is translated as a whole so that the library entry's outer contour aligns with the target length along the length direction. The middle segment between the two end segments is linearly scaled according to the ratio of the length of the middle segment after stretching to the length of the middle segment before stretching. When the template parameters also include a reference height and a target height is given, all height direction coordinates of the library entry's outer contour are scaled proportionally according to the ratio of the target height to the reference height. When the length of the middle segment before and after stretching does not meet the minimum stretchable length, the original library entry's outer contour is output.

[0093] In one embodiment, newly added engineering drawing data is acquired; newly added closed outer contours and their corresponding part numbers are extracted from the newly added engineering drawing data, and a shape fingerprint of the newly added closed outer contour is generated; a representative fingerprint set is set, which is initially empty; any unprocessed newly added closed outer contour is selected from all the extracted newly added closed outer contours as the current newly added closed outer contour; the shape fingerprint of the current newly added closed outer contour is compared with each representative fingerprint in the representative fingerprint set; if the shape fingerprint of the current newly added closed outer contour matches the target representative fingerprint in the representative fingerprint set, the occurrence count of the library entry corresponding to the target representative fingerprint is incremented by one, and the part number corresponding to the current newly added closed outer contour is merged into the alias of the library entry corresponding to the target representative fingerprint; if the shape fingerprint of the current newly added closed outer contour matches the target representative fingerprint in the representative fingerprint set... If none of the representative fingerprints match, the shape fingerprint of the newly added closed outer contour is compared with the library entries stored in the parts library before this incremental merging. If the shape fingerprint of the newly added closed outer contour matches the target library entry in the stored library entries, the occurrence count of the target library entry is incremented by one, and the part number corresponding to the newly added closed outer contour is merged into the alias of the target library entry. If the shape fingerprint of the newly added closed outer contour does not match any of the stored library entries, the shape fingerprint of the newly added closed outer contour is added as a new representative fingerprint to the representative fingerprint set, and a library entry corresponding to the new representative fingerprint is created. The above steps are repeated until all newly added closed outer contours have been processed. The library entries corresponding to each representative fingerprint in the representative fingerprint set are added to the parts library. The parts library is updated and saved.

[0094] Specifically, the process involves acquiring new engineering drawing data, extracting the new closed outer contour and its corresponding part number from the new engineering drawing data, and generating the shape fingerprint of the new closed outer contour according to the method described above. The extraction method of the new closed outer contour, the determination method of the part number, and the generation method of the shape fingerprint are all the same as those described above for engineering drawing data, and will not be repeated here.

[0095] Specifically, the representative fingerprint set is used to record the representative fingerprints formed during this incremental merging process.

[0096] Specifically, any unprocessed newly added closed outer contour is selected from all extracted newly added closed outer contours as the current newly added closed outer contour. The shape fingerprint of the current newly added closed outer contour is compared with each representative fingerprint in the representative fingerprint set. The comparison adopts the same method as the aforementioned homomorphic determination, that is, when the similarity between the shape fingerprint of the current newly added closed outer contour and a certain representative fingerprint is less than a preset distance threshold, the relative difference in area is not greater than a preset area tolerance, and the relative difference in perimeter is not greater than a preset perimeter tolerance, it is determined that the two are a match. The preset distance threshold is preferably 5mm, the preset area tolerance is preferably 1%, and the preset perimeter tolerance is preferably 1%. The similarity is the minimum of the four average nearest distances between the shape fingerprint of the current newly added closed outer contour and the four pose variants constructed based on the representative fingerprints.

[0097] Specifically, repeat the above steps of selecting the newly added closed outer contour and subsequent steps until all newly added closed outer contours have been processed. After all newly added closed outer contours have been processed, add the library entries corresponding to each representative fingerprint in the representative fingerprint set to the parts library, update and save the parts library.

[0098] In one embodiment, after incremental merging is completed, statistical results can be output, which can be represented as {loops, added, deduped, matched_existing, total}, where loops represents the number of extracted closed outer contours, added represents the number of newly added entries, deduped represents the number of duplicates removed in this round, matched_existing represents the number of entries matched in the repository, and total represents the total number of processes.

[0099] In one embodiment, when repeatedly performing library creation or incremental merging, after adding a new library entry to the parts library, the total number of library entries, update time, and entry number list in the index file are updated, and the entry file and preview file corresponding to the new library entry are written to the parts library directory. The total number of library entries in the index file represents the number of library entries in the parts library; the number of occurrences in the library entries represents the cumulative number of times the same shape appears in the engineering drawing data.

[0100] Example 2, see Figure 2 , Figure 2This is a schematic diagram of an embodiment of an automatic parts library construction device for engineering drawings provided in this application. Corresponding to the above-described automatic parts library construction method for engineering drawings, this application also provides an automatic parts library construction device for engineering drawings. This automatic parts library construction device for engineering drawings includes modules for executing the above-described automatic parts library construction method for engineering drawings. This automatic parts library construction device for engineering drawings can be configured in terminals such as desktop computers, tablet computers, and laptops. Specifically, the automatic parts library construction device for engineering drawings includes a closed outer contour extraction module 201, a closed outer contour shape determination module 202, a part number determination module 203, a closed outer contour merging module 204, and a parts library output module 205.

[0101] The closed outer contour extraction module 201 is used to acquire engineering drawing data containing geometric entities and text annotations, and extract the closed outer contour of the part from the geometric entities.

[0102] The closed outer contour shape determination module 202 is used to perform normalization processing on the closed outer contour, generate a normalized shape fingerprint, construct multiple pose variants based on the normalized shape fingerprint, and compare the similarity of any two closed outer contours under the multiple pose variants to determine whether the two closed outer contours belong to the same shape.

[0103] The component number determination module 203 is used to determine the component number corresponding to the closed outer contour based on the spatial positional relationship between the text annotation and the closed outer contour, combined with the component number information.

[0104] The closed outer contour merging module 204 is used to merge multiple closed outer contours that are determined to be of the same shape into the same library entry, record the different part numbers among the part numbers corresponding to the multiple closed outer contours as aliases of the library entry, and count the number of times the same shape appears in the engineering drawing data.

[0105] The parts library output module 205 is used to output a parts library containing the library entries.

[0106] In one embodiment, the closed outer contour extraction module 201 is used to extract the closed outer contour of a part from the geometric entity, specifically including: rendering the curve entity in the geometric entity as a point series, wherein the curve entity includes at least one of polylines, straight lines, splines, arcs, and circles; merging adjacent points in the rendered point series whose distance is less than a preset deduplication threshold; forming candidate closed loops from the point series corresponding to the rendered closed curve entities, and forming candidate closed loops from the point series whose distance between the first and last points is less than a preset closure determination threshold; taking the point series corresponding to the rendered unclosed curve entities as segments to be reconstructed, rounding the coordinates of the first and last endpoints of each segment to be reconstructed according to a preset precision to generate corresponding endpoint keys, and grouping the segments to be reconstructed with the same endpoint keys using a disjoint-set data structure; for each group of segments to be reconstructed, starting from any segment to be reconstructed as... The current chain is used as the tail endpoint key. In the unused segments to be reconstructed, a target segment with the same head endpoint key or tail endpoint key as the current chain's tail endpoint key is searched. Based on the position of the endpoint in the target segment that shares the same tail endpoint key, the target segment is determined to be connected to the current chain in either the forward or reverse direction to extend the current chain and update its tail endpoint key. This search, connection, and update process is repeated until no further connection is possible or a preset chain extension step limit is reached, resulting in a candidate chain. When the head endpoint key and tail endpoint key of a candidate chain are the same, and the distance between the head and tail points of the candidate chain meets a preset closure tolerance, the candidate chain is designated as a candidate closed loop. The candidate closed loop is then filtered according to area and side length conditions to obtain the closed outer contour.

[0107] In one embodiment, the closed outer contour shape determination module 202 is used to normalize the closed outer contour and generate a normalized shape fingerprint. Specifically, it includes: uniformly interpolating points along the total perimeter of the closed outer contour according to a preset fixed number of points to obtain a resampled point sequence; calculating the centroid of the resampled point sequence, subtracting the coordinates of the centroid from the coordinates of each point in the resampled point sequence to obtain a translated point sequence; calculating the covariance components based on the translated point sequence, and determining the principal axis direction of the translated point sequence by the covariance components; rotating the translated point sequence until the principal axis direction is aligned with a preset coordinate axis to obtain an aligned point sequence; when the number of points in the aligned point sequence exceeds a preset downsampling threshold, performing intermittent downsampling on the aligned point sequence to obtain a normalized shape fingerprint.

[0108] In one embodiment, the closed outer contour shape determination module 202 is used to construct multiple pose variants based on the normalized shape fingerprint, and compare the similarity of any two closed outer contours under the multiple pose variants to determine whether the two closed outer contours belong to the same shape. Specifically, it includes: for any two closed outer contours, taking one of the closed outer contours as the first closed outer contour and the other as the second closed outer contour; constructing four pose variants for the shape fingerprint of the second closed outer contour, the four pose variants being an identity variant, a variant rotated 180° around the origin, a variant mirrored along a first coordinate axis, and a variant mirrored along a second coordinate axis, wherein the first coordinate axis is a coordinate axis in the coordinate system where the closed outer contour is located, and the second coordinate axis is another coordinate axis perpendicular to the first coordinate axis; and comparing the shape fingerprint of the first closed outer contour with each pose variant of the second closed outer contour. The comparison involves using the shape fingerprint of the first closed outer contour as the first point set, the current pose variant of the second closed outer contour as the second point set, and selecting the point set with fewer points from the first and second point sets as the reference set. The point set with more points from the first and second point sets is selected as the target set. The average nearest Euclidean distance from each point in the reference set to the target set is calculated as the average nearest distance between the first closed outer contour and the current pose variant. The minimum of the four average nearest distances between the first closed outer contour and the four pose variants is taken as the similarity between the two closed outer contours. When the similarity is less than a preset distance threshold, and the relative difference in area between the two closed outer contours is not greater than a preset area tolerance, and the relative difference in perimeter between the two closed outer contours is not greater than a preset perimeter tolerance, the two closed outer contours are determined to belong to the same shape; otherwise, the two closed outer contours are determined not to belong to the same shape.

[0109] In one embodiment, the part number information includes a material list, which contains a correspondence between serial numbers and part numbers; the part number determination module 203 is used to determine the part number corresponding to the closed outer contour based on the spatial positional relationship between the text annotation and the closed outer contour, combined with the part number information, specifically including: identifying text annotations in the text annotation that conform to a preset part label format as part labels, the part labels containing serial numbers, and recording the position of the part labels in the engineering drawing data; for each closed outer contour, when the position of the part label is located within the area of ​​the outer rectangle of the closed outer contour that expands outward according to a preset first spatial tolerance, or when the distance between the position of the part label and the centroid of the closed outer contour does not exceed a preset second spatial tolerance, the part label is associated with the closed outer contour; according to the correspondence, the serial number of the part label associated with the closed outer contour is mapped to the part number corresponding to the closed outer contour.

[0110] In one embodiment, the closed outer contour merging module 204 is used to merge multiple closed outer contours determined to be of the same shape into the same library entry, record the different component numbers among the component numbers corresponding to the multiple closed outer contours as aliases of the library entry, and count the number of times the same shape appears in the engineering drawing data. Specifically, it includes: merging multiple closed outer contours determined to be of the same shape into the same library entry; removing the suffixes of the component numbers corresponding to the multiple closed outer contours merged into the same library entry to obtain the base family name to which each component number belongs; when there are multiple base family names, determining the family of the library entry based on the number of times each of the multiple base family names appears; generating an entry number for the library entry according to the order of entries within the family; recording the different component numbers among the component numbers corresponding to the multiple closed outer contours merged into the same library entry as aliases of the library entry; counting the number of closed outer contours merged into the same library entry in the engineering drawing data as the number of times the library entry appears; and recording the family, entry number, alias, and number of times the library entry appears.

[0111] In one embodiment, the automatic parts library construction device for engineering drawings provided in this application further includes an incremental merging module.

[0112] In one embodiment, the incremental merging module is used to acquire newly added engineering drawing data, extract newly added closed outer contours and their corresponding part numbers from the newly added engineering drawing data, and generate shape fingerprints of the newly added closed outer contours; set a representative fingerprint set, which is initially empty; select any unprocessed newly added closed outer contour from all the extracted newly added closed outer contours as the current newly added closed outer contour; compare the shape fingerprint of the current newly added closed outer contour with each representative fingerprint in the representative fingerprint set; if the shape fingerprint of the current newly added closed outer contour matches the target representative fingerprint in the representative fingerprint set, then increment the occurrence count of the library entry corresponding to the target representative fingerprint by one, and merge the part number corresponding to the current newly added closed outer contour into the alias of the library entry corresponding to the target representative fingerprint ... If none of the representative fingerprints in the fingerprint set are matched, the shape fingerprint of the newly added closed outer contour is compared with the library entries stored in the parts library before this incremental merging. If the shape fingerprint of the newly added closed outer contour matches the target library entry in the stored library entries, the occurrence count of the target library entry is incremented by one, and the part number corresponding to the newly added closed outer contour is merged into the alias of the target library entry. If the shape fingerprint of the newly added closed outer contour does not match any of the stored library entries, the shape fingerprint of the newly added closed outer contour is added to the representative fingerprint set as a new representative fingerprint, and a library entry corresponding to the new representative fingerprint is created. The above steps are repeated until all newly added closed outer contours have been processed. The library entries corresponding to each representative fingerprint in the representative fingerprint set are added to the parts library. The parts library is updated and saved.

[0113] The above-described automatic parts library construction device for engineering drawings can implement the automatic parts library construction method for engineering drawings described in the above method embodiments. The options described in the above method embodiments are also applicable to this embodiment, and will not be detailed here.

[0114] like Figure 3 As shown, Figure 3 This is a schematic diagram of the structure of a computer device provided in this application; it includes a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112 and the memory 113 communicate with each other through the communication bus 114, and the memory 113 is used to store computer programs.

[0115] In one embodiment of this application, the processor 111, when executing the program stored in the memory 113, implements the automatic construction method of the parts library of engineering drawings provided in any of the foregoing method embodiments.

[0116] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program may be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.

[0117] Therefore, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the steps of the automatic construction method for a parts library of engineering drawings as provided in any of the foregoing method embodiments.

[0118] The storage medium is a physical, non-transient storage medium, such as a USB flash drive, external hard drive, read-only memory (ROM), magnetic disk, or optical disk, or any other physical storage medium capable of storing program code. The computer-readable storage medium can be non-volatile or volatile.

[0119] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.

[0120] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0121] The steps in the methods of this application embodiment can be adjusted, merged, or deleted according to actual needs. The units in the apparatus of this application embodiment can be merged, divided, or deleted according to actual needs. Furthermore, the functional units 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.

[0122] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.

[0123] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0124] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Since these modifications and variations fall within the scope of the claims and their equivalents, this application also intends to include these modifications and variations.

[0125] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for automatically constructing a parts library from engineering drawings, characterized in that, include: Obtain engineering drawing data containing geometric entities and text annotations, and extract the closed outer contour of the part from the geometric entities; The closed outer contour is normalized to generate a normalized shape fingerprint. Based on the normalized shape fingerprint, multiple pose variants are constructed. The similarity of any two closed outer contours is compared under the multiple pose variants to determine whether the two closed outer contours belong to the same shape. Based on the spatial relationship between the text annotation and the closed outer contour, and in conjunction with the component number information, determine the component number corresponding to the closed outer contour; Multiple closed outer contours that are determined to be of the same shape are merged into the same library entry. The different part numbers among the part numbers corresponding to the multiple closed outer contours are recorded as aliases of the library entry, and the number of times the same shape appears in the engineering drawing data is counted. Output a parts library containing the library entries.

2. The method according to claim 1, characterized in that, Extracting the closed outer contour of the part from the geometric entity specifically includes: The curved entities in the geometric entity are rendered as a point column, and the curved entities include at least one of polylines, straight lines, splines, arcs and circles; Merge adjacent points in the rendered point column whose distance to each other is less than a preset deduplication threshold. The points corresponding to the closed curve entities after rendering are formed into candidate closed loops, and the points whose distance between the first and last points is less than the preset closure judgment threshold are formed into candidate closed loops. The point sequence corresponding to the unclosed curve entity after rendering is taken as the segment to be reconstructed. The coordinates of the first and last endpoints of each segment to be reconstructed are rounded according to the preset precision to generate the corresponding endpoint keys. The segments to be reconstructed with the same endpoint keys are grouped into a disjoint set. For each group of segments to be reconstructed, start from any segment to be reconstructed as the current chain, and use the tail endpoint key of the current chain as the tail endpoint key of the current chain. In the unused segments to be reconstructed, search for a target segment to be reconstructed whose head endpoint key or tail endpoint key is the same as the tail endpoint key of the current chain. Based on the position of the endpoint in the target segment to be reconstructed that is the same as the tail endpoint key of the current chain, determine whether to connect the target segment to the current chain in the forward or reverse direction to extend the current chain and update the tail endpoint key of the current chain. Repeat the above search, connection and update until it is impossible to continue to connect or the preset chain extension step limit is reached to obtain a candidate chain. When the first endpoint key and the last endpoint key of the candidate chain are the same, and the distance between the first and last points of the candidate chain meets the preset closure tolerance, the candidate chain is regarded as a candidate closed loop. The candidate closed loops are filtered according to area and side length conditions to obtain the closed outer contour.

3. The method according to claim 1, characterized in that, The process of normalizing the closed outer contour to generate a normalized shape fingerprint specifically includes: Points are uniformly interpolated along the total perimeter of the closed outer contour according to a preset fixed number of points to obtain a resampling point column; Calculate the centroid of the resampled point sequence, and subtract the coordinates of the centroid from the coordinates of each point in the resampled point sequence to obtain the translated point sequence; The covariance components are calculated based on the translated point sequence, and the principal axis direction of the translated point sequence is determined by the covariance components. The translated point array is rotated until the principal axis direction is aligned with the preset coordinate axis to obtain the aligned point array; When the number of points in the aligned point column exceeds a preset downsampling threshold, the aligned point column is downsampled at intervals to obtain a normalized shape fingerprint.

4. The method according to claim 1, characterized in that, The step of constructing multiple pose variants based on the normalized shape fingerprint, and comparing the similarity of any two closed outer contours under the multiple pose variants to determine whether the two closed outer contours belong to the same shape, specifically includes: For any two closed outer contours, one of the closed outer contours is designated as the first closed outer contour, and the other closed outer contour is designated as the second closed outer contour. Four pose variants are constructed for the shape fingerprint of the second closed outer contour. The four pose variants are the identity variant, the variant rotated 180° around the origin, the variant mirrored along the first coordinate axis, and the variant mirrored along the second coordinate axis. The first coordinate axis is a coordinate axis in the coordinate system in which the closed outer contour is located, and the second coordinate axis is another coordinate axis perpendicular to the first coordinate axis. For the comparison between the shape fingerprint of the first closed outer contour and each pose variant of the second closed outer contour, the shape fingerprint of the first closed outer contour is used as the first point set, the current pose variant of the second closed outer contour is used as the second point set, the point set with fewer points in the first point set and the second point set is used as the reference set, and the point set with more points in the first point set and the second point set is used as the target set. The average value of the nearest Euclidean distance from each point in the reference set to the target set is calculated as the average nearest distance between the first closed outer contour and the current pose variant. The minimum of the four average nearest distances between the first closed outer contour and the four pose variants is taken as the similarity between the two closed outer contours. When the similarity is less than a preset distance threshold, and the relative difference in area between the two closed outer contours is not greater than a preset area tolerance, and the relative difference in perimeter between the two closed outer contours is not greater than a preset perimeter tolerance, the two closed outer contours are determined to belong to the same shape; otherwise, the two closed outer contours are determined not to belong to the same shape.

5. The method according to claim 1, characterized in that, The part number information includes a material list, which contains the correspondence between serial numbers and part numbers; The step of determining the component number corresponding to the closed outer contour based on the spatial relationship between the text annotation and the closed outer contour, combined with the component number information, specifically includes: The text annotations that conform to the preset part label format are identified as part labels. The part labels include a serial number, and the position of the part labels in the engineering drawing data is recorded. For each closed outer contour, when the position of the part label is located within the area of ​​the outer rectangle of the closed outer contour that expands outward according to a preset first spatial tolerance, or when the distance between the position of the part label and the centroid of the closed outer contour does not exceed a preset second spatial tolerance, the part label is associated with the closed outer contour. Based on the correspondence, the serial number of the part label associated with the closed outer contour is mapped to the part number corresponding to the closed outer contour.

6. The method according to claim 1, characterized in that, The process of merging multiple closed outer contours that are determined to be of the same shape into a single library entry, using the different part numbers corresponding to the multiple closed outer contours as aliases for the library entry, and counting the number of times the same shape appears in the engineering drawing data, specifically includes: Multiple closed outer contours that are determined to be of the same shape will be merged into the same library entry; Remove the suffixes from the part numbers corresponding to multiple closed outer contours that are merged into the same library entry to obtain the base family name to which each part number belongs; When there are multiple base family names, the family of the library entry is determined based on the occurrence count of each of the multiple base family names; Generate entry numbers for the library entries according to the order of entries within the family; The different part numbers corresponding to the closed outer contours of the multiple items merged into the same library entry are recorded as aliases for the library entry. The number of closed outer contours that are merged into the same library entry in the engineering drawing data is counted as the number of times the library entry appears; Record the family, entry number, alias, and number of occurrences of the entries in the library.

7. The method according to claim 1, characterized in that, The output includes a parts library containing the library entries, and also includes: Acquire new engineering drawing data, extract the new closed outer contour and its corresponding part number from the new engineering drawing data, and generate the shape fingerprint of the new closed outer contour; Set a representative fingerprint set, which is initially empty; Select any unprocessed newly added closed outer contour from all the extracted newly added closed outer contours as the current newly added closed outer contour; Compare the shape fingerprint of the newly added closed outer contour with each representative fingerprint in the representative fingerprint set; If the shape fingerprint of the newly added closed outer contour matches the target representative fingerprint in the representative fingerprint set, then the occurrence count of the library entry corresponding to the target representative fingerprint is incremented by one, and the part number corresponding to the newly added closed outer contour is merged into the alias of the library entry corresponding to the target representative fingerprint. If the shape fingerprint of the newly added closed outer contour does not match any of the representative fingerprints in the representative fingerprint set, then the shape fingerprint of the newly added closed outer contour is compared with the library entries stored in the parts library before this incremental merging. If the shape fingerprint of the newly added closed outer contour matches the target entry in the stored library entries, then the occurrence count of the target entry is incremented by one, and the part number corresponding to the newly added closed outer contour is merged into the alias of the target entry. If the shape fingerprint of the newly added closed outer contour does not match any of the stored library entries, then the shape fingerprint of the newly added closed outer contour is added as a new representative fingerprint to the representative fingerprint set, and a library entry corresponding to the new representative fingerprint is created. Repeat the above steps until all newly added closed outer contours have been processed. Add the library entries corresponding to each representative fingerprint in the representative fingerprint set to the parts library; Update and save the parts library.

8. An automatic parts library construction device for engineering drawings, characterized in that, include: The module includes a closed outer contour extraction module, a closed outer contour shape determination module, a part number determination module, a closed outer contour merging module, and a parts library output module. The closed outer contour extraction module is used to acquire engineering drawing data containing geometric entities and text annotations, and extract the closed outer contour of the part from the geometric entities. The closed outer contour shape determination module is used to normalize the closed outer contour, generate a normalized shape fingerprint, construct multiple pose variants based on the normalized shape fingerprint, and compare the similarity of any two closed outer contours under the multiple pose variants to determine whether the two closed outer contours belong to the same shape. The component number determination module is used to determine the component number corresponding to the closed outer contour based on the spatial positional relationship between the text annotation and the closed outer contour, combined with the component number information. The closed outer contour merging module is used to merge multiple closed outer contours that are determined to be of the same shape into the same library entry, record the different part numbers among the part numbers corresponding to the multiple closed outer contours as aliases of the library entry, and count the number of times the same shape appears in the engineering drawing data. The parts library output module is used to output a parts library containing the library entries.

9. A computer device, characterized in that, The computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, can implement the method as described in any one of claims 1-7.