CAD block identification method and system, electronic equipment and storage medium

By generating spatial indexes in CAD drawings and verifying them using topological geometric feature vectors, the problems of low efficiency and insufficient accuracy in CAD block recognition are solved, achieving efficient and accurate block recognition.

CN121808083APending Publication Date: 2026-04-07CHINA MOBILE GROUP DESIGN INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-10
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

In existing technologies, CAD block recognition suffers from low efficiency and insufficient accuracy, especially when the topological structures are completely different but the distance distribution of feature points is similar, which can easily lead to misidentification.

Method used

By obtaining the geometric center point of each element in the CAD drawing to generate a spatial index, the reference elements and their relative position vectors in the block template are determined. Based on this information, a search is performed, and the topological geometric feature vectors of the candidate blocks are used to verify the identification by comparing them with the feature vectors of the block template, thus ensuring the accuracy of the identification.

Benefits of technology

It achieves highly efficient primitive search and block recognition, improves the accuracy of block recognition, and ensures the efficiency and precision of the recognition process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121808083A_ABST
    Figure CN121808083A_ABST
Patent Text Reader

Abstract

The invention provides a CAD graph block identification method and system, electronic equipment and a storage medium. The method comprises the steps of obtaining a geometric center point of each primitive in a to-be-recognized CAD drawing to generate a spatial index of the CAD drawing; determining a reference primitive in the block template and a relative position vector of the first primitive and the reference primitive; searching the CAD drawing based on the spatial index and the relative position vector to determine candidate blocks in the CAD drawing; and verifying the candidate block based on the first topological geometric feature vector of the candidate block and the second topological geometric feature vector of the block template, and determining that the candidate block is a target block identified from the CAD drawing after verification is passed. Therefore, according to the scheme, the CAD drawing is searched through the spatial index, and efficient primitive searching can be achieved. The block verification is carried out through the topological geometric feature vector, the verification accuracy can be improved, and the block identification accuracy is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of graphic recognition and artificial intelligence technology, and in particular to a method, system, electronic device and storage medium for recognizing CAD blocks. Background Technology

[0002] Automated parsing of Computer-Aided Design (CAD) drawings is crucial for achieving intelligent design. Block recognition, in particular, aims to combine discrete basic geometric primitives into functional units with engineering significance. Currently, block recognition mainly focuses on geometric representation and search strategies, lacking details on efficiently executing primitive search and recognition. Although recognition can be based on geometric information, its information dimension is limited, potentially leading to misidentification due to cases where the topological structures are completely different but the feature point distances are similar. Summary of the Invention

[0003] The purpose of this application is to at least partially solve one of the technical problems in the related art.

[0004] Therefore, the first objective of this application is to propose a method for recognizing CAD blocks in order to achieve efficient primitive search and improve the accuracy of block recognition.

[0005] The second objective of this application is to propose a CAD block recognition system.

[0006] The third objective of this application is to propose an electronic device.

[0007] The fourth objective of this application is to provide a computer-readable storage medium.

[0008] To achieve the above objectives, a first aspect of this application proposes a method for identifying CAD blocks, comprising: acquiring the geometric center point of each element in a CAD drawing to be identified, and generating a spatial index of the CAD drawing based on the geometric center point; wherein the CAD drawing is composed of at least one block, and each block is composed of at least one element; determining a reference element in a block template, and a relative position vector between a first element in the block template and the reference element; wherein the first element and the reference element constitute the block template; searching the CAD drawing based on the spatial index and the relative position vector to determine candidate blocks in the CAD drawing; determining a first topological geometric feature vector of the candidate block and a second topological geometric feature vector of the block template; verifying the candidate block based on the first topological geometric feature vector and the second topological geometric feature vector, and determining the candidate block as a target block identified from the CAD drawing after successful verification.

[0009] To achieve the above objectives, a second aspect of this application proposes a CAD block recognition system, comprising: a spatial indexing module, used to acquire the geometric center point of each element in the CAD drawing to be recognized, and generate a spatial index of the CAD drawing based on the geometric center point; wherein the CAD drawing is composed of at least one block, and each block is composed of at least one element; a predictive search module, used to determine a reference element in a block template, and a relative position vector between a first element in the block template and the reference element, and to search the CAD drawing based on the spatial index and the relative position vector to determine candidate blocks in the CAD drawing; wherein the first element and the reference element constitute the block template; an element parsing and vectorization module, used to determine a first topological geometric feature vector of the candidate block and a second topological geometric feature vector of the block template; and a structural verification module, used to verify the candidate block based on the first topological geometric feature vector and the second topological geometric feature vector, and determine the candidate block as a target block identified from the CAD drawing after successful verification.

[0010] To achieve the above objectives, a third aspect of this application provides an electronic device, comprising: a processor; and a memory communicatively connected to the processor; the memory storing computer execution instructions; and the processor executing the computer execution instructions stored in the memory to enable the processor to perform the CAD block recognition method described in the first aspect of the application.

[0011] To achieve the above objectives, a fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, the computer instructions being used to cause the computer to execute the CAD block recognition method described in the above aspect of the embodiment.

[0012] The CAD block recognition method, system, electronic device, and storage medium provided in this application generate a spatial index of the CAD drawing based on the geometric center point of each element in the CAD drawing to be recognized, and determine the reference elements in the block template, as well as the relative position vector between the first element and the reference elements. This allows for searching the CAD drawing based on the spatial index and the relative position vector to identify candidate blocks. Further, the candidate blocks are verified based on the first topological geometric feature vector of the candidate blocks and the second topological geometric feature vector of the block template. Upon successful verification, the candidate blocks are confirmed as the target blocks identified from the CAD drawing. Therefore, this solution achieves highly efficient element search by constructing a spatial index to search the CAD drawing, thereby improving the efficiency of block recognition. Verifying blocks using topological geometric feature vectors increases the diversity of vector dimensions during verification, improves verification accuracy, and further enhances the accuracy of block recognition, achieving efficient and accurate automated block recognition.

[0013] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0014] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 This is a flowchart illustrating a method for recognizing CAD blocks provided in an embodiment of this application. Figure 2 This is a flowchart illustrating another method for recognizing CAD blocks provided in an embodiment of this application. Figure 3 This is a flowchart illustrating another method for recognizing CAD blocks provided in an embodiment of this application. Figure 4 This is a schematic diagram of the process for determining candidate blocks provided in an embodiment of this application; Figure 5 This is a schematic diagram of primitive normalization processing provided in the embodiments of this application; Figure 6 A schematic diagram of the topological geometric feature vectors provided in the embodiments of this application; Figure 7 This is a flowchart illustrating another method for recognizing CAD blocks provided in an embodiment of this application. Figure 8 This is a schematic diagram of the process for recognizing CAD blocks provided in an embodiment of this application; Figure 9 This is a schematic diagram of the structure of a CAD block recognition system provided in an embodiment of this application. Detailed Implementation

[0015] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0016] The following describes a method and system for recognizing CAD blocks according to embodiments of this application, with reference to the accompanying drawings.

[0017] Figure 1 This is a flowchart illustrating a method for recognizing CAD blocks according to an embodiment of this application, as shown below. Figure 1 As shown, the CAD block recognition method of this application includes, but is not limited to, the following steps: S101, obtain the geometric center point of each element in the CAD drawing to be identified, and generate a spatial index of the CAD drawing based on the geometric center point.

[0018] It should be noted that the CAD block recognition method provided in this application is executed by an electronic device, which can be a terminal device. Optionally, the terminal device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be personal computers (PCs), televisions, etc. This application does not impose specific limitations.

[0019] In some embodiments, Computer-Aided Design (CAD) drawings are two-dimensional or three-dimensional graphic files created using CAD software. They are used to express design intent, demonstrate product structure, or guide construction and manufacturing. They contain elements such as geometric figures, dimensions, text descriptions, layer information, and attribute data, and can accurately describe the shape, size, location, and technical requirements of an object.

[0020] In some embodiments, a CAD drawing consists of at least one block, and each block consists of at least one element. That is, a block is a whole composed of multiple elements, and the element is the basic unit that constitutes a block.

[0021] In some embodiments, by parsing the CAD drawing to be identified, multiple graphic elements can be parsed from the CAD drawing and the graphic element type of each graphic element can be determined. The method for calculating the geometric center point can then be determined based on the graphic element type, so as to calculate the geometric center point of different graphic elements according to the calculation method.

[0022] Alternatively, the geometric center point of a graphic element can be queried using commands in the CAD software.

[0023] In some embodiments, the spatial index can be a K-Dimensional Tree (KD-tree), which can be generated based on the set of geometric center points of all primitives. For example, for the set of geometric center points, by determining the partition dimension and partition point, the space is divided into two subspaces, left and right, with the partition point as the reference. The left subtree contains data whose coordinates in that dimension are less than the partition point, and the right subtree contains data whose coordinates are greater than or equal to the partition point. By repeating the above steps, the KD-tree is obtained.

[0024] Optionally, the specific implementation method for generating a KD tree can be implemented using the KD tree generation method in related technologies, without any specific limitation.

[0025] S102, determine the reference primitive in the block template, and the relative position vector between the first primitive in the block template and the reference primitive.

[0026] In some embodiments, a block template is a pre-created and saved standardized collection of graphic elements, which includes graphic elements, attributes, and parameter settings that conform to industry or enterprise standards.

[0027] In some embodiments, the block template may include at least one graphic element, each of which is a graphic element conforming to a specification. Optionally, filtering criteria may be preset to filter the graphic elements in the block template to determine reference graphic elements from the block template.

[0028] Optionally, the filtering criteria can be determined based on the stability and distinctiveness of the geometric features of the primitives. For example, the filtering criteria could be primitives with the highest stability and the greatest distinctiveness of their geometric features. If a block template includes one rectangular primitive and two linear primitives, then the primitive that satisfies the filtering criteria is the rectangular primitive, and the rectangular primitive is the reference primitive.

[0029] In some embodiments, after determining the reference element, the relative position vector between the first element and the reference element in the block template can be determined. The first element and the reference element together constitute the block template.

[0030] Optionally, the relative position vector between the first primitive and the reference primitive can be calculated based on their geometric center points. Here, the relative position vector refers to the vector representing the positional relationship between the geometric center point of the first primitive and the geometric center point of the reference primitive.

[0031] Optionally, the geometric center point of the first geometric element is regarded as the first geometric center point, and the geometric center point of the reference geometric element is regarded as the second geometric center point. By determining the coordinates of the first geometric center point and the second geometric center point, as well as the direction of the vector, the relative position vector can be determined based on the coordinate values.

[0032] S103 searches the CAD drawing based on spatial index and relative position vector to identify candidate blocks in the CAD drawing.

[0033] In some embodiments, spatial indexing can be used to search for elements in the CAD drawing that have the same relative position vector as the first element and the reference element, and these elements can be used as candidate blocks in the CAD drawing. That is, there is a correspondence between the elements in the candidate blocks and the first element and the reference element.

[0034] In some embodiments, the candidate block contains a candidate primitive corresponding to the reference primitive and a second primitive corresponding to the first primitive. The candidate block is composed of the candidate primitive and the second primitive, and the relative position vector between the second primitive and the candidate primitive is the same as the relative position vector between the first primitive and the reference primitive.

[0035] Optionally, candidate primitives corresponding to the reference primitives can be determined from the CAD drawings first, and the desired position of the second primitive, that is, the position where the second primitive should be, can be determined based on the absolute and relative position vectors of the candidate primitives. Then, a search is performed at the desired position using spatial indexing, and the primitive found is used as the second primitive.

[0036] Furthermore, candidate elements and second elements can be used as candidate blocks in CAD drawings.

[0037] In some embodiments, candidate elements can be determined based on element type. That is, the element type of the candidate element is the same as that of the reference element. Multiple candidate elements with the same element type as the reference element can exist in a CAD drawing.

[0038] In some embodiments, if no candidate element is found at the desired location, the candidate element can be discarded to determine the second element of other candidate elements, thereby improving the efficiency of searching for candidate elements.

[0039] For example, if there are candidate element 1 and candidate element 2 in the CAD drawing that are of the same element type as the reference element, if the second element 1 is found at the expected position 1 corresponding to candidate element 1, then candidate element 1 and the second element 1 are used as candidate block 1 in the CAD drawing; if the second element 2 is not found at the expected position 2 corresponding to candidate element 2, then candidate element 2 is discarded.

[0040] S104, determine the first topological geometric feature vector of the candidate tile and the second topological geometric feature vector of the tile template.

[0041] In some embodiments, the process of determining the first topological geometric feature vector of the candidate tile and the second topological geometric feature vector of the tile template is the same. For any topological geometric feature vector corresponding to any tile, the geometric structure information of the primitives in the tile can be determined, and the topological geometric feature vector can be generated based on the geometric structure information.

[0042] In some embodiments, the topological relationships of primitives in a tile can be encoded based on geometric structure information to obtain a topological geometric feature vector. To make the expression of the topological geometric feature vector more specific and stable, it can be generated using a structured fixed-length vector. Here, a fixed-length vector refers to a vector with a fixed length (i.e., number of dimensions).

[0043] In some embodiments, the number of dimensions of the topological geometric feature vector is predetermined, and different levels are divided based on the number of dimensions. Geometric structure information is encoded in each level to obtain the topological geometric feature vector.

[0044] For example, the topological geometric feature vector can be divided into 3 levels, and the number of dimensions of the topological geometric feature vector is 512. Among them, 0-15 dimensions are the first level, 16-271 dimensions are the second level, and 272-527 dimensions are the third level.

[0045] By encoding the statistical information of the tiles in the first level, the geometric structure information of the primitives in the second level, and the topological relationships between the primitives in the third level, a topological geometric feature vector can be obtained.

[0046] S105, the candidate block is verified based on the first topological geometric feature vector and the second topological geometric feature vector, and after the verification is passed, the candidate block is determined to be the target block identified from the CAD drawing.

[0047] In some embodiments, candidate blocks can be verified based on the similarity between vectors. That is, by determining the similarity between the first topological geometric feature vector and the second topological geometric feature vector, if the similarity is greater than the similarity threshold, the candidate block can be determined to pass the verification, and the candidate block is then used as the target block identified from the CAD drawing.

[0048] In some embodiments, to further ensure the accuracy of identifying target tiles, after a candidate tile passes similarity verification, a geometric verification can be performed on the candidate tile, thereby ensuring that the target tile meets the non-negotiable key constraints defined in the tile template.

[0049] In some embodiments, different constraints can be set for different types of primitives, and it can be determined whether the candidate blocks that pass the similarity verification meet the constraints. That is, it can be determined whether the primitives in the candidate blocks meet their respective constraints, and after meeting the constraints, it can be determined that the geometric verification has passed, and then the candidate blocks can be determined to be the target blocks identified from the CAD drawings.

[0050] For example, if the constraint is that the two lines are parallel, and the candidate image patch that passes the similarity verification contains two lines that are parallel, then the geometric verification is passed; if the two lines are not parallel, then the geometric verification is not passed.

[0051] In some embodiments, once a candidate block passes similarity verification and geometric verification, it can be determined that the candidate block is the target block identified from the CAD drawing.

[0052] The CAD block recognition method provided in this application generates a spatial index of the CAD drawing based on the geometric center point of each element in the CAD drawing to be recognized, and determines the reference elements in the block template, as well as the relative position vector between the first element and the reference elements. This allows for a search of the CAD drawing based on the spatial index and the relative position vector to identify candidate blocks. Further, the candidate blocks are verified based on the first topological geometric feature vector of the candidate blocks and the second topological geometric feature vector of the block template. Upon successful verification, the candidate blocks are determined as the target blocks identified from the CAD drawing. Therefore, this solution achieves highly efficient element search by constructing a spatial index to search the CAD drawing, thereby improving the efficiency of block recognition. Verifying blocks using topological geometric feature vectors increases the diversity of vector dimensions during verification, improves verification accuracy, and further enhances the accuracy of block recognition, achieving efficient and accurate automated block recognition.

[0053] Figure 2 This is a flowchart illustrating a method for recognizing CAD blocks according to an embodiment of this application, as shown below. Figure 2 As shown, the CAD block recognition method of this application includes, but is not limited to, the following steps: S201, Obtain the geometric center point of each element in the CAD drawing to be identified, and generate a spatial index of the CAD drawing based on the geometric center point.

[0054] S202, determine the reference primitive in the block template, and the relative position vector between the first primitive in the block template and the reference primitive.

[0055] In the embodiments of this application, steps S201-S202 can be implemented in any of the embodiments of this application, and no limitation is made here, nor will it be described in detail.

[0056] S203: Identify candidate elements from the elements in the CAD drawing that match the reference element, and determine the absolute position of the candidate elements.

[0057] S204. Determine the desired position of the second primitive based on the absolute and relative position vectors.

[0058] In some embodiments, a first element type of the reference element can be determined, and elements of the same type as the first element type can be determined from the elements of the CAD drawing as candidate elements to match the reference element. That is, the candidate elements and the reference element have the same element type.

[0059] In some embodiments, since there is at least one element of the same type as the first element in the CAD drawing, there is also at least one candidate element.

[0060] In some embodiments, the second primitive and the candidate primitive form a block. The desired position of the second primitive refers to the position of the primitive that forms a block with the candidate primitive; that is, if a primitive exists at the desired position, then that primitive is the second primitive that forms a block with the candidate primitive.

[0061] In some embodiments, the desired position of the second element can be determined based on the relative position vector between the first element and the reference element. That is, the element composed of the candidate element and the second element should correspond one-to-one with the elements in the block template.

[0062] In some embodiments, the desired position of the second primitive can be determined based on the absolute and relative position vectors of the candidate primitives. The desired position of the second primitive is determined by determining the absolute position of the candidate primitive and then using the absolute and relative position vectors.

[0063] Optionally, the absolute position of a candidate graphic element refers to its location within the CAD drawing; that is, its coordinate position within the coordinate system of the CAD drawing. Furthermore, the desired position of the second graphic element can be determined through vector operations based on the absolute and relative position vectors.

[0064] S205, based on the spatial index and the desired location, determine the second primitive at the desired location, and based on the candidate primitive and the second primitive at the desired location, determine the candidate block in the CAD drawing.

[0065] S206, Based on the candidate primitives and the second primitive in the desired position, determine the candidate blocks in the CAD drawing.

[0066] In some embodiments, a spatial index can be used to perform a search query at a desired location to determine the primitive at that location as the second primitive. Specifically, the spatial index allows for efficient nearest neighbor search at the desired location; that is, the second primitive can be determined by querying within the neighborhood of the desired location using the spatial index.

[0067] In some embodiments, a small range around the desired location can be used as the neighborhood for primitive querying, and the query is performed within that neighborhood, with the queried primitives being used as the second primitives at the desired location.

[0068] In some embodiments, a time complexity for the query can be set, and the query can be performed based on this time complexity. The time complexity can be logarithmic, for example, logN. Here, N is the number of nodes in the KD-tree, ensuring efficient querying even when the number of part primitives is large.

[0069] In some embodiments, after determining the second element, the candidate element and the second element at the desired position can be used as candidate blocks in the CAD drawing. That is, the candidate element and the second element at the desired position can form a block.

[0070] In some embodiments, if no primitive exists at the desired location, candidate primitives can be discarded, and the desired locations corresponding to other candidate primitives can be searched to avoid invalid searches and improve the efficiency of patch recognition.

[0071] S207, determine the first topological geometric feature vector of the candidate tile and the second topological geometric feature vector of the tile template.

[0072] S208, the candidate block is verified based on the first topological geometric feature vector and the second topological geometric feature vector, and after the verification is passed, the candidate block is determined to be the target block identified from the CAD drawing.

[0073] In the embodiments of this application, steps S207-S208 can be implemented in any of the embodiments of this application, and no limitation is made here, nor will it be described in detail.

[0074] The CAD block recognition method provided in this application identifies candidate elements matching reference elements from the elements of the CAD drawing and determines the absolute position of the candidate elements. Based on the absolute and relative position vectors, the desired position of the second element is determined. This allows the second element at the desired position to be identified based on the spatial index and the desired position. Finally, candidate blocks in the CAD drawing are identified based on the candidate elements and the second element at the desired position. By constructing a spatial index to search the CAD drawing, highly efficient nearest neighbor search can be achieved, quickly finding the element closest to the candidate element in the CAD drawing, further improving the efficiency of block recognition. Searching within the neighborhood of the desired position reduces unnecessary computation and increases search speed.

[0075] Figure 3 This is a flowchart illustrating a method for recognizing CAD blocks according to an embodiment of this application, as shown below. Figure 3 As shown, the CAD block recognition method of this application includes, but is not limited to, the following steps: S301, obtain the geometric center point of each element in the CAD drawing to be identified, and generate a spatial index of the CAD drawing based on the geometric center point.

[0076] S302, determine the reference element in the block template, and the relative position vector between the first element and the reference element in the block template.

[0077] S303, determine candidate elements that match the reference elements from the elements in the CAD drawing, and determine the desired position of the second element based on the relative position vector.

[0078] In the embodiments of this application, steps S301-S303 can be implemented in any of the embodiments of this application, and no limitation is made here, nor will it be described in detail.

[0079] S304, Determine the set neighborhood range of the desired location.

[0080] S305, based on spatial indexing, performs a logarithmic time search within a defined neighborhood of the desired location to determine the primitive within the defined neighborhood of the desired location as the second primitive.

[0081] In some embodiments, spatial indexes can be used for nearest neighbor searches and range searches to achieve efficient searches. By defining a defined neighborhood range for each desired location and searching within the defined neighborhood range using spatial indexes, a second primitive at the desired location can be quickly determined from a CAD drawing.

[0082] In some embodiments, the time complexity of the search can also be set for the spatial index, thereby enabling efficient and fast searches in multidimensional space. By optimizing the time complexity, query speed and resource consumption can be balanced.

[0083] In some embodiments, the spatial index can be a KD tree, the neighborhood range can be the smallest neighborhood range of the desired location, and the time complexity can be logarithmic, such as logN, where N is the number of nodes in the KD tree.

[0084] In other words, a KD tree can be used to perform a search with a time complexity of logN within the smallest neighborhood of each desired location, and when a primitive is found, it can be used as the second primitive.

[0085] S306, Based on the candidate primitives and the second primitive in the desired position, determine the candidate blocks in the CAD drawing.

[0086] In the embodiments of this application, step S306 can be implemented in any of the ways described in the various embodiments of this application. This is not limited here and will not be elaborated further.

[0087] Figure 4 The diagram illustrates the process of determining candidate blocks. Reference blocks are determined from the block template, along with first block 1 and first block 2 within the block template. The relative position vector 1 between the reference block and first block 1, and the relative position vector 2 between the reference block and first block 2 are also determined.

[0088] Candidate primitives matching the reference primitives are identified from the CAD drawing. Based on the absolute positions of these candidate primitives, and relative position vectors 1 and 2, desired positions 1 and 2 are determined. A nearest neighbor search is then performed at desired positions 1 and 2 using spatial indexing.

[0089] If a second primitive 1 is found at desired location 1 and a second primitive 2 is found at desired location 2, the candidate primitives, along with the second primitive 1 and the second primitive 2, can be used as candidate blocks.

[0090] S307, determine the first topological geometric feature vector of the candidate tile and the second topological geometric feature vector of the tile template.

[0091] In some embodiments, the method for determining the topological geometric feature vector is the same for any of the first and second topological geometric feature vectors. That is, the process of generating the topological geometric feature vector can be explained for any of the candidate tiles and the tile template.

[0092] In some embodiments, in order to eliminate non-essential geometric differences in primitives themselves, primitives in any of the candidate blocks and block templates can be normalized to obtain geometric structure information of the primitives, and then encoded according to the geometric structure information to obtain topological geometric feature vectors.

[0093] Figure 5 This diagram illustrates the primitive normalization process. Let the primitives before normalization be the original primitives. If the original primitives are straight lines from point P1 to point P2, then the result of normalization, i.e., their corresponding geometric structure information, is the sorted starting point coordinates and unit direction vector. If the original primitives are circles with center point C and radius R, their corresponding geometric structure information consists of four orthogonal poles, forming a rotation-invariant set of points.

[0094] In some embodiments, if the original primitive is a multi-line segment, its corresponding geometric structure information is the vertex coordinates sorted in a clockwise order.

[0095] In some embodiments, after determining the geometric structure information, the structural relationships between primitives can be encoded at multiple levels based on the geometric structure information to obtain a topological geometric feature vector. In other words, the structural relationships between primitives can be encoded based on the geometric structure information to obtain the topological geometric feature vector.

[0096] In some embodiments, to make the vector representation more specific and stable, the dimension of the topological geometric feature vector can be preset, and the structural relationship between primitives can be encoded based on the geometric structure information within this dimension to obtain the topological geometric feature vector.

[0097] In some embodiments, by obtaining a pre-defined number of dimensions of the topological geometric feature vector and dividing it into at least one level based on the number of dimensions, statistical information, geometric structure information and topological relationships between primitives of the tiles can be encoded into different levels based on the number of dimensions of different levels, thereby obtaining the topological geometric feature vector.

[0098] In other words, the topological geometric feature vector contains statistical information, geometric structure information, and topological relationships between primitives.

[0099] For example, Figure 6 The diagram shown is a schematic of the topological geometric feature vectors. Figure 6 The topological geometric feature vectors in the model have 512 dimensions, with dimensions 0-15 forming the first level, 16-271 forming the second level, and 272-527 forming the third level.

[0100] Optionally, statistical information of the tiles can be encoded in the first level. Dimension 0 can store the total number of primitives; dimensions 1-7 store the number of different types of primitives such as lines, circles, and arcs, respectively; dimensions 8-15 can be used to store other global features such as the aspect ratio of the tile's bounding rectangle.

[0101] Optionally, geometric structure information of primitives can be encoded into the second level. If a tile contains a maximum of 16 primitives, and each primitive is assigned 16 dimensions, then the tile uses a total of 256 dimensions. The storage structure corresponding to a primitive is: [Primitive Type Identifier, P1_x, P1_y, P2_x, P2_y, ..., Zero-padding]. Here, P1 and P2 are the normalized relative coordinates of keypoints (e.g., endpoints of a rectangle).

[0102] Figure 6 The storage structure described above can be used to encode the geometric structure information of the primitives to obtain a second level containing 16 slots, each slot having 16 dimensions.

[0103] Optionally, the topological relationships between primitives can be encoded in the third level. These relationships can be stored in a matrix format. For 16 primitives, this can be represented as a 16x16 matrix, with a total of 256 dimensions.

[0104] For example, a matrix M(i, j) is used to store the topological relationship between the i-th primitive and the j-th primitive. This relationship can be encoded by an integer value, such as: 0 (no relationship), 1 (intersecting), 2 (parallel), 4 (perpendicular), 8 (endpoint adjacency). These values ​​can be combined, such as 9 representing intersecting and endpoint adjacency.

[0105] S308, the candidate block is verified based on the first topological geometric feature vector and the second topological geometric feature vector, and after the verification is passed, the candidate block is determined to be the target block identified from the CAD drawing.

[0106] In the embodiments of this application, step S308 can be implemented in any of the ways described in the embodiments of this application. This is not limited here and will not be described in detail.

[0107] In the CAD block recognition method provided in this application embodiment, a topological geometric feature vector is constructed by using the statistical information of the block, the geometric structure information of the elements, and the topological relationship between the elements. This vector can describe the geometric appearance of the block and characterize the topological structure between the elements, thereby increasing the diversity of verification dimensions when verifying using the topological geometric feature vector and further improving the accuracy of block recognition.

[0108] Figure 7 This is a flowchart illustrating a method for recognizing CAD blocks according to an embodiment of this application, as shown below. Figure 7 As shown, the CAD block recognition method of this application includes, but is not limited to, the following steps: S701, obtain the geometric center point of each element in the CAD drawing to be identified, and generate a spatial index of the CAD drawing based on the geometric center point.

[0109] S702, determine the reference element in the block template, and the relative position vector between the first element and the reference element in the block template.

[0110] S703 searches CAD drawings based on spatial indexes and relative position vectors to identify candidate blocks within the CAD drawings.

[0111] S704, determine the first topological geometric feature vector of the candidate tile and the second topological geometric feature vector of the tile template.

[0112] In the embodiments of this application, steps S701-S704 can be implemented in any of the embodiments of this application, and no limitation is made here, nor will it be described in detail.

[0113] S705, obtain the similarity between the first topological geometric feature vector and the second topological geometric feature vector.

[0114] S706, in response to a similarity greater than the similarity threshold, determines that the candidate image patch has passed the similarity verification.

[0115] S707, obtain the constraints between graphic elements.

[0116] S708, in response to the candidate tile that passes the similarity verification satisfying the constraint conditions, determine the candidate tile that passes the similarity verification as the target tile identified from the CAD drawing.

[0117] In some embodiments, the verification of candidate patches may include similarity verification and geometric verification. Through a dual verification mechanism, the candidate patches are compared in a precise and quantitative manner to ensure the final accuracy of the identification.

[0118] In some embodiments, similarity verification refers to verifying whether the similarity between the first topological geometric feature vector and the second topological geometric feature vector is greater than a similarity threshold. The similarity between the first and second topological geometric feature vectors can be cosine similarity.

[0119] In some embodiments, after passing similarity verification, geometric verification can be performed on the candidate blocks. Optionally, geometric verification can be performed on whether the geometric relationships between the primitives meet the constraints. If the constraints are met, the candidate blocks that pass both similarity and geometric verification can be determined as the target blocks identified from the CAD drawings.

[0120] In the CAD block recognition method provided in this application embodiment, the similarity between the first topological geometric feature vector and the second topological geometric feature vector is obtained, and similarity verification is performed based on the similarity. After the similarity verification is passed, it is determined whether the candidate block meets the constraint conditions, and the candidate block that meets the constraint conditions is the target block identified from the CAD drawing. Through dual verification, the accuracy of verification can be improved, and the accuracy of block recognition can be further improved, so as to achieve efficient and accurate automated block recognition.

[0121] Figure 8 The diagram illustrates the process of identifying CAD blocks. For a block template, a set of relative position vectors is obtained by determining reference elements from the block template and the relative position vectors between other first elements in the element template and the reference elements, and then determining the second topological geometric feature vector of the block template.

[0122] For the CAD drawing to be identified, the geometric center point of each element in the CAD drawing is obtained, and the spatial index of the CAD drawing is determined based on the geometric center point. Each element in the CAD drawing is traversed to determine candidate elements that match the element type of the reference element, and the desired position of the second element is determined based on the set of relative position vectors. A logarithmic time complexity search is performed within a defined neighborhood of the desired position using the spatial index to identify elements within that neighborhood as the second element. Candidate blocks of the CAD drawing are then generated based on the candidate elements and the second element, and the first topological geometric feature vector of the candidate blocks is determined. If the similarity between the first and second topological geometric feature vectors is greater than a similarity threshold, the candidate block is determined to be the target block identified from the CAD drawing.

[0123] Corresponding to the CAD block recognition methods proposed in the above embodiments, an embodiment of this application also proposes a CAD block recognition system. Since the CAD block recognition system proposed in this application corresponds to the CAD block recognition methods proposed in the above embodiments, the implementation methods of the above CAD block recognition methods are also applicable to the CAD block recognition system proposed in this application, and will not be described in detail in the following embodiments.

[0124] Figure 9 This is a schematic diagram of the structure of a CAD block recognition system provided in an embodiment of this application.

[0125] like Figure 9 As shown, the CAD block recognition system 900 includes: The spatial index module 901 is used to obtain the geometric center point of each element in the CAD drawing to be identified, and generate a spatial index of the CAD drawing based on the geometric center point; wherein the CAD drawing consists of at least one block, and each block consists of at least one element; The predictive search module 902 is used to determine reference elements in the block template, and the relative position vector between the first element in the block template and the reference element, and to search the CAD drawing based on the spatial index and the relative position vector to determine candidate blocks in the CAD drawing; wherein the first element and the reference element constitute the block template; The primitive parsing and vectorization module 903 is used to determine the first topological geometric feature vector of the candidate block and the second topological geometric feature vector of the block template. The structure verification module 904 is used to verify the candidate block based on the first topological geometric feature vector and the second topological geometric feature vector, and determine the candidate block as the target block identified from the CAD drawing after the verification is passed.

[0126] In one possible implementation of this application embodiment, the predictive search module 902 is further configured to: determine candidate elements matching the reference element from the elements of the CAD drawing, and determine the absolute position of the candidate elements; determine the desired position of the second element based on the absolute position and the relative position vector; wherein the second element and the candidate element form a block; determine the second element at the desired position based on the spatial index and the desired position, and determine the candidate block in the CAD drawing based on the candidate elements and the second element at the desired position.

[0127] In one possible implementation of this application embodiment, the predictive search module 902 is further configured to: determine a set neighborhood range of the desired location; and perform a logarithmic time complexity search within the set neighborhood range of the desired location based on the spatial index, so as to determine the primitive within the set neighborhood range of the desired location as the second primitive.

[0128] In one possible implementation of this application embodiment, for any one of the first and second topological geometric feature vectors, the primitive parsing and vectorization module 903 is further configured to: perform normalization processing on the primitives in any one of the candidate blocks and the block template to obtain the geometric structure information of the primitives; and based on the geometric structure information, perform multi-level encoding on the structural relationships between the primitives to obtain the topological geometric feature vector.

[0129] In one possible implementation of this application, the primitive parsing and vectorization module 903 is further configured to: obtain a pre-set dimension number of the topological geometric feature vector, and divide at least one level based on the dimension number; based on the dimension number of different levels, encode the statistical information of the blocks, the geometric structure information and the topological relationship between the primitives into the different levels to obtain the topological geometric feature vector.

[0130] In one possible implementation of this application embodiment, the structure verification module 904 is further configured to: obtain the similarity between the first topological geometric feature vector and the second topological geometric feature vector; and determine that the candidate map patch passes the similarity verification in response to the similarity being greater than a similarity threshold.

[0131] In one possible implementation of this application embodiment, the structure verification module 904 is further configured to: obtain the constraint conditions between graphic elements; and, in response to the candidate graphic block that has passed the similarity verification satisfying the constraint conditions, determine that the candidate graphic block that has passed the similarity verification is the target graphic block identified from the CAD drawing.

[0132] The CAD block recognition system provided in this application generates a spatial index for the CAD drawing based on the geometric center point of each element in the CAD drawing to be recognized, and determines the reference elements in the block template, as well as the relative position vector between the first element and the reference elements. This allows for searching the CAD drawing based on the spatial index and the relative position vector to identify candidate blocks. Further, the candidate blocks are verified based on the first topological geometric feature vector of the candidate blocks and the second topological geometric feature vector of the block template. Upon successful verification, the candidate blocks are determined as the target blocks identified from the CAD drawing. Therefore, this solution achieves highly efficient element search by constructing a spatial index to search the CAD drawing, thereby improving the efficiency of block recognition. Verifying blocks using topological geometric feature vectors increases the diversity of vector dimensions during verification, improves verification accuracy, and further enhances the accuracy of block recognition, achieving efficient and accurate automated block recognition.

[0133] It should be noted that the explanation of the aforementioned method for recognizing CAD blocks also applies to the CAD block recognition system of this embodiment, and will not be repeated here.

[0134] To implement the above embodiments, this application also proposes an electronic device, including: a processor and a memory communicatively connected to the processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to implement the method provided in the foregoing embodiments. To implement the above embodiments, this application also proposes a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods provided in the foregoing embodiments.

[0135] The collection, storage, use, processing, transmission, provision, and application of user personal information involved in this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0136] It should be noted that personal information collected from users should be used for legitimate and reasonable purposes and should not be shared or sold outside of these legitimate uses. Furthermore, such collection / sharing should only be conducted after receiving the user's informed consent, including but not limited to notifying the user to read the user agreement / user notice and sign an agreement / authorization that includes authorization of relevant user information before the user uses the function. In addition, any necessary steps must be taken to protect and safeguard access to such personal information data and ensure that others with access to personal information data comply with their privacy policies and procedures.

[0137] This application is intended to provide an implementation scheme for users to selectively prevent the use or access to their personal information data. Specifically, this application is intended to provide hardware and / or software to prevent or block access to such personal information data. Once personal information data is no longer needed, risks can be minimized by restricting data collection and deleting data. Furthermore, where applicable, such personal information is de-identified to protect user privacy.

[0138] In the foregoing descriptions of the embodiments, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0139] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0140] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.

[0141] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, system, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, system, or device). For the purposes of this specification, "computer-readable medium" can be any system that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, system, or device. More specific examples (a non-exhaustive list) of computer-readable media include: electrical connections having one or more wires (electronic systems), portable computer disk drives (magnetic systems), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic systems, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.

[0142] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware as in another embodiment, it can be implemented using any of the following techniques known in the art, or a combination thereof: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0143] Those skilled in the art will understand that all or part of the steps of the methods described in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it includes one or a combination of the steps of the method embodiments.

[0144] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0145] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.

Claims

1. A method for recognizing blocks in computer-aided design (CAD) drawings, characterized in that, The method includes: Obtain the geometric center point of each element in the CAD drawing to be identified, and generate a spatial index of the CAD drawing based on the geometric center point; wherein the CAD drawing consists of at least one block, and each block consists of at least one element; Determine the reference primitive in the block template, and the relative position vector between the first primitive in the block template and the reference primitive; wherein, the first primitive and the reference primitive constitute the block template; Based on the spatial index and the relative position vector, the CAD drawing is searched to determine candidate blocks in the CAD drawing; Determine the first topological geometric feature vector of the candidate map tile and the second topological geometric feature vector of the map tile template; The candidate block is verified based on the first topological geometric feature vector and the second topological geometric feature vector, and after the verification is passed, the candidate block is determined to be the target block identified from the CAD drawing.

2. The method according to claim 1, characterized in that, The step of searching the CAD drawing based on the spatial index and the relative position vector to determine candidate blocks in the CAD drawing includes: From the elements of the CAD drawing, determine the candidate elements that match the reference elements, and determine the absolute position of the candidate elements; Based on the absolute position and the relative position vector, the desired position of the second primitive is determined; wherein the second primitive and the candidate primitive form a block; Based on the spatial index and the desired location, a second graphic element at the desired location is determined, and based on the candidate graphic elements and the second graphic element at the desired location, candidate blocks in the CAD drawing are determined.

3. The method according to claim 2, characterized in that, The step of determining the second primitive at the desired location based on the spatial index and the desired location includes: Determine the defined neighborhood range of the desired location; Based on the spatial index, a search with logarithmic time complexity is performed within a set neighborhood of the desired location to determine the primitive within the set neighborhood of the desired location as the second primitive.

4. The method according to claim 1, characterized in that, The process of determining the topological geometric feature vector for any one of the first and second topological geometric feature vectors includes: The primitives in any of the candidate blocks and the block templates are normalized to obtain the geometric structure information of the primitives; Based on the geometric structure information, the structural relationships between the primitives are encoded at multiple levels to obtain the topological geometric feature vector.

5. The method according to claim 4, characterized in that, The step of encoding the structural relationships between the primitives based on the geometric structure information to obtain the topological geometric feature vector includes: Obtain the number of dimensions of the pre-defined topological geometric feature vectors, and divide at least one level based on the number of dimensions; Based on the number of dimensions at different levels, the statistical information of the tiles, the geometric structure information, and the topological relationships between the primitives are encoded into the different levels to obtain the topological geometric feature vector.

6. The method according to any one of claims 1-5, characterized in that, The verification of the candidate map tiles based on the first topological geometric feature vector and the second topological geometric feature vector includes: Obtain the similarity between the first topological geometric feature vector and the second topological geometric feature vector; In response to the similarity being greater than a similarity threshold, the candidate image patch is determined to have passed the similarity verification.

7. The method according to claim 6, characterized in that, After determining that the candidate image patch passes the similarity verification, the method further includes: Obtain the constraints between graphic elements; In response to the candidate tile that passes the similarity verification satisfying the constraint condition, the candidate tile that passes the similarity verification is determined to be the target tile identified from the CAD drawing.

8. A CAD block recognition system, characterized in that, The system includes: A spatial index module is used to obtain the geometric center point of each element in the CAD drawing to be identified, and generate a spatial index of the CAD drawing based on the geometric center point; wherein, the CAD drawing consists of at least one block, and each block consists of at least one element; A predictive search module is used to determine reference elements in a block template, and the relative position vector between a first element in the block template and the reference elements, and to search the CAD drawing based on the spatial index and the relative position vector to determine candidate blocks in the CAD drawing; wherein, the first element and the reference elements constitute the block template; The primitive parsing and vectorization module is used to determine the first topological geometric feature vector of the candidate map patch and the second topological geometric feature vector of the map patch template. The structure verification module is used to verify the candidate block based on the first topological geometric feature vector and the second topological geometric feature vector, and determine the candidate block as the target block identified from the CAD drawing after the verification is passed.

9. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.