Cad drawing analysis method, device and equipment and storage medium

CN113052023BActive Publication Date: 2026-10-30SHENZHEN XKOOL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110269156.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-12
Publication Date
2026-10-30
Estimated Expiration
2041-03-12

AI Technical Summary

Technical Problem

[0004]本发明的主要目的在于解决现有的CAD图纸无法在移动端上进行解析和编辑的技术问题

Benefits of technology

[0067]本发明提供的技术方案中,对CAD图纸进行三方面的解析:第一方面是从对CAD图纸对应的绘图交换文件中解析出CAD图纸承载的图元信息,并根据图元信息识别出CAD图纸中的带语义图元以用于构建图元库;第二方面是将CAD软件专用的图元信息转化为移动端可查看和编辑的几何信息;第三方面是通过功能分区识别模型识别出CAD图纸中的各功能分区;在转换得到的几何信息基础上进行图元语义的识别,比如门、窗、墙等,以及功能分区的识别,比如卧室、客厅、厨房等,实现CAD图纸在移动端上的解析、展示和可编辑。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113052023B_ABST
    Figure CN113052023B_ABST
Patent Text Reader

Abstract

The application relates to the field of computer-aided design, and discloses a CAD drawing analysis method, device, equipment and storage medium. The method comprises the following steps: reading a CAD drawing to be analyzed and a corresponding drawing exchange file; analyzing the drawing exchange file to obtain a plurality of segment information stored in the drawing exchange file, and sequentially analyzing the segment information to obtain a plurality of graphic element information borne by the drawing exchange file; identifying semantic graphic elements in the CAD drawing according to the graphic element information, and constructing a graphic element library; sequentially converting the graphic element information into corresponding geometric information through a preset standard geometric library; performing semantic identification on the CAD drawing through a preset function partition identification model to obtain each function partition in the CAD drawing; and based on the graphic element library, the function partitions and the geometric information, drawing a geometric drawing with semantics corresponding to the CAD drawing. The CAD drawing is analyzed on a mobile terminal to obtain a geometric drawing with semantics and editability, and the convenience of using the CAD drawing for construction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer-aided design, and more particularly to a method, apparatus, device, and storage medium for parsing CAD drawings. Background Technology

[0002] AutoCAD (Autodesk Computer Aided Design) software is a drawing editing software that emerged with the digitization of the construction industry. It can parse CAD (Computer Aided Design) drawings by reading drawing exchange files such as DXF (Drawing Interchange Format), DWT (Dreamweaver Template), and DWG (DraWinG). Currently, designers can edit DXF and DWG format CAD drawings using the AutoCAD software on a PC.

[0003] With the advent of the internet and mobile internet era, an increasing number of on-site construction and design scenarios require the display and editing of CAD drawings on tablets, mobile phones, and laptops. Therefore, CAD drawing parsing technology based on standalone software architecture exhibits a significant limitation in terms of device portability. Furthermore, due to the rise of cloud computing, many design and construction companies store drawing information on servers, making cloud-based CAD drawing editing a future trend. Therefore, in conclusion, existing CAD drawings cannot be parsed and edited on mobile devices. Summary of the Invention

[0004] The main objective of this invention is to solve the technical problem that existing CAD drawings cannot be parsed and edited on mobile devices.

[0005] The first aspect of this invention provides a method for parsing CAD drawings, comprising:

[0006] Read the CAD drawing to be parsed and the corresponding drawing exchange file;

[0007] The drawing exchange file is parsed to obtain multiple segment information stored in the drawing exchange file, and each segment information is parsed in turn to obtain multiple primitive information carried by the drawing exchange file;

[0008] Based on the graphic element information, semantic graphic elements in the CAD drawing are identified, and a graphic element library is constructed using the semantic graphic elements. The graphic element information is then sequentially converted into corresponding geometric information using a pre-set standard geometry library.

[0009] By using a pre-set functional partition recognition model, semantic recognition is performed on the CAD drawing to obtain each functional partition in the CAD drawing;

[0010] Based on the primitive library, the functional partitions, and the geometric information, a semantically meaningful geometric drawing is created corresponding to the CAD drawing.

[0011] Optionally, in a first implementation of the first aspect of the present invention, the step of sequentially parsing the information segments to obtain the multiple primitive information carried by the drawing exchange file includes:

[0012] Based on the identification information of the segment information, the data type of each segment information is determined sequentially;

[0013] A preset parsing method matching the data type of each segment of information is selected sequentially to parse each segment of information and obtain the group code information of each segment of information;

[0014] Based on the group code information of each segment, the multiple primitive information carried by the drawing exchange file is obtained.

[0015] Optionally, in a second implementation of the first aspect of the present invention, the step of sequentially converting the primitive information into corresponding geometric information using a preset standard geometry library includes:

[0016] Based on the identification information of the graphic element information, the graphic element data type of each graphic element information is determined sequentially;

[0017] Based on a pre-set standard geometry library, the geometric data types corresponding to the metadata types of each primitive information are matched sequentially.

[0018] Based on the geometric logic corresponding to each geometric data type, the corresponding primitive parameters are extracted sequentially from each primitive information.

[0019] The primitive parameters corresponding to each primitive information are encapsulated sequentially using a preset format to obtain the geometric information corresponding to each primitive information.

[0020] Optionally, in a third implementation of the first aspect of the present invention, the step of constructing a primitive library using the semantic primitives includes:

[0021] Collect the primitive dataset corresponding to the semantic primitives, and convert the semantic primitives into corresponding binary data streams based on the primitive dataset;

[0022] Based on the type of the semantic primitives, the corresponding binary data streams are classified and written into a preset database to obtain the primitive library corresponding to the semantic primitives.

[0023] Optionally, in a fourth implementation of the first aspect of the present invention, the step of performing semantic recognition on the CAD drawing through a preset functional partition recognition model to obtain each functional partition in the CAD drawing includes:

[0024] The CAD drawing is input into a preset functional area recognition model, wherein the functional area recognition model includes a generator and a discriminator;

[0025] The generator extracts the relative and absolute features of each partition in the CAD drawing, and constructs a partition feature matrix based on the connection relationship between the partitions.

[0026] The discriminator performs feature aggregation on the feature matrix based on the relative and absolute features of each partition to obtain the functional category probability of each partition.

[0027] The discriminator determines each functional partition in the CAD drawing based on the maximum functional category probability of each partition.

[0028] Optionally, in a fifth implementation of the first aspect of the present invention, the step of constructing a partition feature matrix by the generator based on the connection relationship between the partitions includes:

[0029] The generator converts the CAD drawing into a corresponding N-order adjacency matrix based on the connection relationships between the partitions.

[0030] The generator adds up the elements of each column in the adjacency matrix to obtain N values, and generates the corresponding N-order degree matrix based on the N values.

[0031] The generator subtracts the degree matrix from the adjacency matrix to obtain the partition feature matrix.

[0032] Optionally, in a sixth implementation of the first aspect of the present invention, after the primitive information is sequentially converted into corresponding geometric information using a preset standard geometry library, the method further includes:

[0033] Based on the geometric information, geometric figures are drawn using a pre-set drawing library to generate geometric drawings corresponding to the CAD drawings;

[0034] The graphic elements in the CAD drawing and the geometric figures in the geometric drawing are compared and verified sequentially, and the comparison and verification results are output.

[0035] A second aspect of the present invention provides a CAD drawing parsing device, comprising:

[0036] The reading module is used to read the CAD drawing to be parsed and the corresponding drawing exchange file of the CAD drawing;

[0037] The parsing module is used to parse the drawing exchange file to obtain multiple segment information stored in the drawing exchange file, and to parse each segment information in turn to obtain multiple primitive information carried by the drawing exchange file;

[0038] The conversion module is used to identify semantic primitives in the CAD drawing based on the primitive information, construct a primitive library using the semantic primitives, and convert the primitive information into corresponding geometric information sequentially through a preset standard geometry library.

[0039] The recognition module is used to perform semantic recognition on the CAD drawing through a preset functional partition recognition model to obtain the functional partitions in the CAD drawing.

[0040] The drawing module is used to draw semantically meaningful geometric drawings corresponding to the CAD drawings based on the primitive library, the functional partitions, and the geometric information.

[0041] Optionally, in a first implementation of the second aspect of the present invention, the parsing module includes a first parsing unit and a second parsing unit, the second parsing unit being used for:

[0042] Based on the identification information of the segment information, the data type of each segment information is determined sequentially;

[0043] A preset parsing method matching the data type of each segment of information is selected sequentially to parse each segment of information and obtain the group code information of each segment of information;

[0044] Based on the group code information of each segment, the multiple primitive information carried by the drawing exchange file is obtained.

[0045] Optionally, in a second implementation of the second aspect of the present invention, the conversion module includes a construction unit and a conversion unit, the conversion unit being used for:

[0046] Based on the identification information of the graphic element information, the graphic element data type of each graphic element information is determined sequentially;

[0047] Based on a pre-set standard geometry library, the geometric data types corresponding to the metadata types of each primitive information are matched sequentially.

[0048] Based on the geometric logic corresponding to each geometric data type, the corresponding primitive parameters are extracted sequentially from each primitive information.

[0049] The primitive parameters corresponding to each primitive information are encapsulated sequentially using a preset format to obtain the geometric information corresponding to each primitive information.

[0050] Optionally, in a third implementation of the second aspect of the present invention, the building unit includes an identification subunit and a first building subunit, the first building subunit being used for:

[0051] Collect the primitive dataset corresponding to the semantic primitives, and convert the semantic primitives into corresponding binary data streams based on the primitive dataset;

[0052] Based on the type of the semantic primitives, the corresponding binary data streams are classified and written into a preset database to obtain the primitive library corresponding to the semantic primitives.

[0053] Optionally, in a fourth implementation of the second aspect of the present invention, the identification module includes:

[0054] An input unit is used to input the CAD drawing into a preset functional partition recognition model, wherein the functional partition recognition model includes a generator and a discriminator;

[0055] The generation unit is used to extract the relative and absolute features of each partition in the CAD drawing through the generator, and to construct a partition feature matrix based on the connection relationship between the partitions through the generator.

[0056] The discrimination unit is used to perform feature aggregation of each partition on the feature matrix based on the relative and absolute features of each partition by the discriminator, so as to obtain the functional category probability of each partition;

[0057] The determining unit is used to determine each functional partition in the CAD drawing based on the maximum functional category probability of each partition through the discriminator.

[0058] Optionally, in a fifth implementation of the second aspect of the present invention, the generation unit further includes an extraction subunit and a second construction subunit, the second construction subunit being used for:

[0059] The generator converts the CAD drawing into a corresponding N-order adjacency matrix based on the connection relationships between the partitions.

[0060] The generator adds up the elements of each column in the adjacency matrix to obtain N values, and generates the corresponding N-order degree matrix based on the N values.

[0061] The generator subtracts the degree matrix from the adjacency matrix to obtain the partition feature matrix.

[0062] Optionally, in a sixth implementation of the second aspect of the present invention, the CAD drawing parsing device further includes:

[0063] The generation module is used to draw geometric figures using a preset drawing library based on the geometric information, and generate the geometric drawing corresponding to the CAD drawing;

[0064] The verification module is used to compare and verify the graphic elements in the CAD drawing and the geometric figures in the geometric drawing in sequence, and output the comparison and verification results.

[0065] A third aspect of the present invention provides a CAD drawing parsing device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor invokes the instructions in the memory to cause the CAD drawing parsing device to perform the CAD drawing parsing method described above.

[0066] A fourth aspect of the present invention provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the above-described CAD drawing parsing method.

[0067] The technical solution provided by this invention parses CAD drawings in three aspects: First, it parses the graphic element information carried by the CAD drawings from the drawing exchange files corresponding to the CAD drawings, and identifies semantic graphic elements in the CAD drawings based on the graphic element information for constructing a graphic element library; second, it converts the graphic element information specific to CAD software into geometric information that can be viewed and edited on mobile devices; third, it identifies each functional area in the CAD drawings through a functional area recognition model; based on the converted geometric information, it performs graphic element semantic recognition, such as doors, windows, and walls, as well as functional area recognition, such as bedrooms, living rooms, and kitchens, thereby realizing the parsing, display, and editing of CAD drawings on mobile devices. Attached Figure Description

[0068] Figure 1 This is a schematic diagram of one embodiment of the CAD drawing parsing method in this invention;

[0069] Figure 2 This is a schematic diagram of another embodiment of the CAD drawing parsing method in this invention;

[0070] Figure 3 This is a schematic diagram of an embodiment of the construction of the partition feature matrix in this invention;

[0071] Figure 4 This is a schematic diagram of one embodiment of the CAD drawing parsing device in this invention;

[0072] Figure 5This is a schematic diagram of another embodiment of the CAD drawing parsing device in this invention;

[0073] Figure 6 This is a schematic diagram of one embodiment of the CAD drawing parsing device in this invention. Detailed Implementation

[0074] This invention provides a method, apparatus, device, and storage medium for parsing CAD drawings. The method reads the CAD drawing to be parsed and its corresponding drawing exchange file; parses the drawing exchange file to obtain multiple segment information stored within it, and sequentially parses each segment information to obtain multiple primitive information carried by the drawing exchange file; based on the primitive information, it identifies semantic primitives in the CAD drawing and constructs a primitive library; it sequentially converts the primitive information into corresponding geometric information using a pre-set standard geometry library; it performs semantic recognition on the CAD drawing using a pre-set functional partition recognition model to obtain each functional partition in the CAD drawing; and based on the primitive library, each functional partition, and the geometric information, it draws a semantically meaningful geometric drawing corresponding to the CAD drawing. This invention enables the parsing of CAD drawings on a mobile device to obtain semantically meaningful and editable geometric drawings, improving the convenience of modifying CAD drawings and constructing using CAD drawings.

[0075] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” or “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0076] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 The first embodiment of the CAD drawing parsing method in this invention includes:

[0077] 101. Read the CAD drawing to be parsed and the corresponding drawing exchange file;

[0078] It is understood that the executing entity of this invention can be a CAD drawing parsing device, a terminal, or a server; no specific limitation is made here. This embodiment of the invention will be described using a server as an example.

[0079] In this embodiment, the CAD drawing contains graphic element display shapes (hereinafter referred to as graphic elements), which are the smallest fine-grained units for drawing graphics in the CAD drawing. They can be line segments, polylines, composite line segments, curves, polygons, circles, annular rings, ellipses, spline curves, spirals, segmented surfaces, etc. Different graphic objects can be drawn using graphic elements, such as sofas, tables, chairs, walls, doors, etc.

[0080] Drawing exchange files include files in formats such as DXF, DWT, and DWG. The corresponding CAD drawings can be parsed and displayed by reading drawing exchange files of DXF, DWG, and DWT formats.

[0081] 102. Parse the drawing exchange file to obtain multiple segment information stored in the drawing exchange file, and parse each segment information in turn to obtain multiple primitive information carried by the drawing exchange file;

[0082] In this embodiment, by parsing the drawing exchange file, the segment information of various types stored in the drawing exchange file can be obtained. Since each type of segment information is stored in the drawing exchange file, the corresponding segment information can be obtained by sequentially reading the storage fields of the segment information. Each segment information is stored independently in a folder. For example, when parsing a DXF file, the obtained segment information includes at least the following: The folder name and the corresponding segment information type are shown below:

[0083] DIMSTYLE: Style sheet annotation;

[0084] LAYER: Layer table;

[0085] LTYPE: Line type table;

[0086] The BLOCKS section contains the block definitions and graphic primitives that make up each block reference in a graphic object;

[0087] The ENTITIES section contains graphic objects (primitives) in the drawing, including block references (inserted primitives).

[0088] In this embodiment, after parsing multiple segment information, the corresponding segment information can be parsed sequentially according to the name of the storage folder of each segment information. The main focus is to obtain the primitive information carried by the drawing exchange file. The parsed primitive information includes at least the following types of primitive information: line segment, polyline, multiline, curve, polygon, circle, donut, ellipse, spline, helix, and region. Different types of primitive information are stored in an independent folder and represented by the English name in parentheses.

[0089] During the conversion process, the type of primitive information to be converted is determined based on the file name of the segment information (represented by the file name corresponding to the primitive information). For example, when it is necessary to parse segment information with the file name LWPOLYLINE, it can be determined that the primitive information obtained by parsing is Polyline.

[0090] 103. Based on the graphic element information, identify semantic graphic elements in the CAD drawing, construct a graphic element library using the semantic graphic elements, and sequentially convert the graphic element information into corresponding geometric information using a preset standard geometry library;

[0091] In this embodiment, when engineers draw CAD drawings, they may annotate graphic elements or describe the layers corresponding to the graphic elements. These graphic elements are called semantic graphic elements. By using the annotation information of the graphic elements and the description information of the layers, the semantic information of the corresponding graphic elements can be determined. For example, graphic element A is a wall, graphic element B is a door, graphic element C is a window, etc. Then, different types of semantic graphic elements are classified and stored uniformly. By storing different types of semantic graphic elements in different storage partitions, the corresponding graphic element library can be obtained.

[0092] In this embodiment, different types of primitive information can be converted into geometric information using a conventional standard geometry library or a custom pre-built standard geometry library. Primitive information is the storage format of drawing exchange files, with corresponding types of primitive information stored in folders with different names. Geometric information, on the other hand, is a conventional graphic geometry format, with corresponding types of geometric information stored in folders with different names. When converting between these two different storage formats, the matching file name can be found in the standard geometry library based on the file name corresponding to the primitive information. Then, according to the standard conversion method for geometric information, each descriptive field in the primitive information can be converted into the corresponding geometric information. For example, primitive information with the file name "Polyline" corresponds to "LineString" in the standard geometry library, so the conversion can be performed according to the standard conversion method from "Polyline" to "LineString".

[0093] 104. Using a preset functional partition recognition model, perform semantic recognition on the CAD drawing to obtain each functional partition in the CAD drawing;

[0094] In this embodiment, the CAD drawing is divided into multiple partitions by walls, doors, windows, etc. A pre-set functional partition recognition model first performs image segmentation on each partition in the CAD drawing to obtain multiple independent partitions; then, it extracts the features of each partition, such as the area, orientation, and direction of the partition, and represents each partition with a feature matrix based on the features of each partition; finally, it performs semantic recognition on each partition in the CAD drawing by feature aggregation of the feature matrix, and identifies the function and purpose of each partition, thus obtaining the functional partitions of the CAD drawing.

[0095] Functional zone identification models can be built using neural network models such as Unet, CNNs (Convolutional Neural Networks), FCNs (Fully Convolutional Networks), or generative adversarial networks (GANs). Among these, GANs are preferred. The discriminator in the model implicitly restricts the results; for example, the wall lines obtained from semantic recognition are assumed to be continuous and straight lines. Furthermore, the wall lines can be converted into vectors for extracting zone features.

[0096] 105. Based on the primitive library, the functional partitions, and the geometric information, draw semantically meaningful geometric drawings corresponding to the CAD drawings.

[0097] In this embodiment, a custom-encapsulated Matplotlib plotting library or JTS (Spatial Data Algorithm) plotting library can be used to draw geometric figures that carry geometric information, thereby obtaining the geometric drawing corresponding to the CAD drawing. In this geometric drawing, compared to the CAD drawing, the geometric drawing only displays pure geometric figures. Then, semantic primitives and functional partitions are added to the geometric figures to further annotate the geometric figures semantically, thus obtaining semantically meaningful geometric figures.

[0098] In this embodiment of the invention, CAD drawings are parsed in three aspects: First, the graphic element information carried by the CAD drawings is parsed from the drawing exchange file corresponding to the CAD drawings, and semantic graphic elements in the CAD drawings are identified based on the graphic element information to construct a graphic element library; second, the graphic element information specific to CAD software is converted into geometric information that can be viewed and edited on mobile devices; third, the functional partitions in the CAD drawings are identified through a functional partition recognition model; based on the converted geometric information, the semantic recognition of graphic elements, such as doors, windows, and walls, and the recognition of functional partitions, such as bedrooms, living rooms, and kitchens, are performed to realize the parsing, display, and editing of CAD drawings on mobile devices.

[0099] Please see Figure 2 The second embodiment of the CAD drawing parsing method in this invention includes:

[0100] 201. Read the CAD drawing to be parsed and the corresponding drawing exchange file;

[0101] 202. Parse the drawing exchange file to obtain multiple segment information stored in the drawing exchange file, and parse each segment information in turn to obtain multiple primitive information carried by the drawing exchange file;

[0102] In this embodiment, each segment information contains corresponding group code data. Different segment information has different group code data. When parsing each segment information, the identification information is first identified, and then further segment information parsing is performed based on the identification information. The identification information of the segment information can be the file name storing the segment information and is defined at the beginning of the segment information.

[0103] Furthermore, segment information parsing specifically includes the following steps:

[0104] (1) Determine the data type of each segment information sequentially based on the identification information of the segment information;

[0105] (2) Select a preset parsing method that matches the data type of each segment of information in sequence, parse each segment of information, and obtain the group code information of each segment of information;

[0106] (3) Based on the group code information of each segment, the multiple primitive information carried by the drawing exchange file is obtained.

[0107] Specifically, for example, if the segment information is identified as LWPOLYLINE, then the group code data contained in this segment information includes: subclass tag (AcDbPolyline), number of vertices (90), polyline flag (bit code, default value is 0), closed or open, constant width, elevation, thickness, vertex coordinates, start width, end width, convexity, stretching direction, three-dimensional vector, etc. Then, by parsing each group code data in sequence, the corresponding Polyline type primitive information can be obtained. Through the primitive information content, each group code data can uniquely represent a primitive.

[0108] 203. Based on the graphic element information, identify semantic graphic elements in the CAD drawing, construct a graphic element library using the semantic graphic elements, and sequentially convert the graphic element information into corresponding geometric information using a preset standard geometry library;

[0109] In this embodiment, the data format of each semantic graphic element in the CAD drawing is converted and categorized and stored in the corresponding partition of the preset database, thus completing the construction of the graphic element library. The specific steps are as follows:

[0110] (1) Collect the graph dataset corresponding to the semantic graph primitives, and convert the semantic graph primitives into corresponding binary data streams based on the graph dataset;

[0111] (2) According to the type of the semantic primitive, the corresponding binary data stream is classified and written into a preset database to obtain the primitive library corresponding to the semantic primitive.

[0112] Specifically, for semantic primitives whose semantics have been defined by engineers, they are converted into corresponding binary data streams. For example, for a Polyline type primitive, the connection points of multiple line segments can be extracted as line segment nodes. Strings are used to connect the coordinates (x, y) of multiple nodes in the multi-line segment primitive. These coordinates are then converted into a binary data stream, which serves as the binary data stream for that multi-line segment primitive. Finally, the binary data streams corresponding to different types of semantic primitives are written to the corresponding partitions in a pre-defined database, such as furniture, walls, windows, doors, etc.

[0113] In this embodiment, the graphic element information specific to CAD drawings is converted into conventional geometric information that can be read by other image reading software, as detailed below:

[0114] (1) Determine the data type of each graphic element in sequence according to the identification information of the graphic element information;

[0115] (2) Based on a pre-set standard geometry library, sequentially match the geometric data types corresponding to the data types of each graphic element information;

[0116] (3) Based on the geometric logic corresponding to each geometric data type, extract the corresponding primitive parameters from each primitive information in sequence;

[0117] (4) The primitive parameters corresponding to each primitive information are encapsulated sequentially using a preset format to obtain the geometric information corresponding to each primitive information.

[0118] Specifically, for example, if the identifier of the primitive information is Polyline, the primitive type of the primitive information can be determined to be a polyline. The LineString geometric data type corresponding to Polyline can be matched by the standard geometry library. Then, according to the geometric logic of processing Polyline to LineString, the primitive parameters of primitive data types such as subclass tag, number of vertices, polyline flag, closed or open, constant width, elevation, thickness, vertex coordinates, start width, end width, convexity, stretching direction, and 3D vector are automatically converted into the corresponding geometric structure data and encapsulated into the corresponding geometric information.

[0119] 204. Based on the geometric information, draw the geometric figures using a preset drawing library to generate the geometric drawing corresponding to the CAD drawing;

[0120] In this embodiment, a custom-encapsulated Matplotlib plotting library or JTS (Spatial Data Algorithm) plotting library can be used to draw geometric figures that carry geometric information, thereby obtaining the geometric drawing corresponding to the CAD drawing. In this geometric drawing, compared to the CAD drawing, the geometric drawing only displays pure geometric figures.

[0121] 205. Compare and verify the graphic elements in the CAD drawing and the geometric figures in the geometric drawing in sequence, and output the comparison and verification results;

[0122] In this embodiment, a comparison program can be used to statistically analyze the quantity and coordinates of various types of graphic element information and geometric information in the geometric drawing. For example, it can compare the existence of corresponding geometric information for line segments, polylines, composite line segments, curves, polygons, circles, annulus, ellipses, spline curves, spirals, and segmented surfaces in the graphic element information. This verifies whether conversion failures or errors occur during the conversion of graphic element information and geometric information. Based on the comparison results, such as whether the graphic element information and geometric information are completely consistent or inconsistent, and whether the coordinates of the graphic element information in the CAD drawing are consistent or inconsistent with the coordinates of the corresponding geometric figures in the geometric drawing, a corresponding verification report is generated for the user to conduct a preliminary inspection of the reading results of the CAD drawing.

[0123] 206. Using a preset functional partition recognition model, perform semantic recognition on the CAD drawing to obtain each functional partition in the CAD drawing;

[0124] In this embodiment, a functional area recognition model is used to segment the CAD drawing, and semantic recognition is performed on each segmented part to determine the functional areas in the CAD drawing. The specific process is as follows:

[0125] (1) Input the CAD drawing into the preset functional area recognition model, wherein the functional area recognition model includes a generator and a discriminator;

[0126] (2) Extract the relative and absolute features of each partition in the CAD drawing through the generator, and construct a partition feature matrix based on the connection relationship between the partitions through the generator;

[0127] (3) The discriminator performs feature aggregation on the feature matrix based on the relative and absolute features of each partition to obtain the functional category probability of each partition;

[0128] (4) The discriminator determines each functional partition in the CAD drawing based on the maximum functional category probability of each partition.

[0129] Specifically, the pre-built functional zoning identification model is a generative adversarial network (GAN), comprising a generator and a discriminator. The generator's role includes: identifying the absolute features of each zoning area, such as size, area, and area percentage; and the relative features, such as the relative positions of zoning areas (e.g., the relative orientation of rooms, such as zoning A being south of zoning B), window positions, and door orientations. Then, the generator determines the connectivity between zoning areas based on the door positions. A zoning feature aggregation is then used to represent the connectivity between zoning areas in the CAD drawing. The discriminator's role includes: finally, aggregating the features of each zoning area during feature aggregation to obtain the highest probability category for each zoning area. For example, if zoning C in the matrix is ​​located in the south, is a rectangle approximately 2.5m x 3m with an area of ​​8m², has doors facing inwards and windows facing outwards, then the predicted probabilities of zoning C's categories, from highest to lowest, are: bedroom, kitchen, toilet, storage room, and living room. Ultimately, the highest probability category for zoning C is determined to be bedroom, thus identifying zoning C in the CAD drawing as a bedroom. This process continues until all functional zoning areas in the CAD drawing are identified.

[0130] Furthermore, the specific process for constructing the feature matrix is ​​as follows:

[0131] (1) The generator converts the CAD drawing into a corresponding N-order adjacency matrix according to the connection relationship between the partitions;

[0132] (2) The generator adds up the elements of each column in the adjacency matrix to obtain N values, and generates the corresponding N-order degree matrix based on the N values;

[0133] (3) The generator subtracts the degree matrix from the adjacency matrix to obtain the partition feature matrix.

[0134] Specifically, such as Figure 3 The generator can further draw a simplified graph 301 based on the connection relationship, then transform the graph into a corresponding N-adjacency matrix 302, then add the elements of each column in the adjacency matrix to obtain N values, and place the N values ​​on the diagonal of an N-order zero matrix to obtain a corresponding N-order degree matrix 303. Subtracting the adjacency matrix 302 from the degree matrix 303 yields an N-order Laplace matrix, which is then used as the partition feature matrix.

[0135] 207. Based on the primitive library, the functional partitions, and the geometric information, draw semantically meaningful geometric drawings corresponding to the CAD drawings.

[0136] This invention further illustrates how, on a mobile device, segment information is identified using a pre-defined parsing method to parse the group code information of the segment information, resulting in corresponding primitive information. Geometric information is then extracted from the primitive information using the identifier information and corresponding geometric logic, thus achieving geometric information parsing of CAD drawings. Furthermore, it introduces the use of binary data streams as the data storage format for the primitive library, facilitating subsequent marking of the geometric drawings. Finally, it describes the identification of functional zones in the CAD drawing using a functional zone recognition model, used for marking the corresponding zones in the geometric drawings. Through these methods, based on parsing the CAD drawings to obtain geometric drawings, semantic annotation is also performed on the geometric drawings, achieving high parsing and editability of CAD drawings on mobile devices.

[0137] The CAD drawing parsing method in the embodiments of the present invention has been described above. The CAD drawing parsing device in the embodiments of the present invention will be described below. Please refer to [link / reference]. Figure 4 One embodiment of the CAD drawing parsing device in this invention includes:

[0138] The reading module 401 is used to read the CAD drawing to be parsed and the drawing exchange file corresponding to the CAD drawing;

[0139] The parsing module 402 is used to parse the drawing exchange file to obtain multiple segment information stored in the drawing exchange file, and to parse each segment information in turn to obtain multiple primitive information carried by the drawing exchange file;

[0140] The conversion module 403 is used to identify semantic primitives in the CAD drawing based on the primitive information, construct a primitive library using the semantic primitives, and convert the primitive information into corresponding geometric information sequentially through a preset standard geometry library.

[0141] The recognition module 404 is used to perform semantic recognition on the CAD drawing through a preset functional partition recognition model to obtain each functional partition in the CAD drawing.

[0142] The drawing module 405 is used to draw semantic geometric drawings corresponding to the CAD drawings based on the primitive library, the functional partitions, and the geometric information.

[0143] In this embodiment of the invention, CAD drawings are parsed in three aspects: First, the graphic element information carried by the CAD drawings is parsed from the drawing exchange file corresponding to the CAD drawings, and semantic graphic elements in the CAD drawings are identified based on the graphic element information to construct a graphic element library; second, the graphic element information specific to CAD software is converted into geometric information that can be viewed and edited on mobile devices; third, the functional partitions in the CAD drawings are identified through a functional partition recognition model; based on the converted geometric information, the semantic recognition of graphic elements, such as doors, windows, and walls, and the recognition of functional partitions, such as bedrooms, living rooms, and kitchens, are performed to realize the parsing, display, and editing of CAD drawings on mobile devices.

[0144] Please see Figure 5 Another embodiment of the CAD drawing parsing device in this invention includes:

[0145] The reading module 401 is used to read the CAD drawing to be parsed and the drawing exchange file corresponding to the CAD drawing;

[0146] The parsing module 402 is used to parse the drawing exchange file to obtain multiple segment information stored in the drawing exchange file, and to parse each segment information in turn to obtain multiple primitive information carried by the drawing exchange file;

[0147] The conversion module 403 is used to identify semantic primitives in the CAD drawing based on the primitive information, construct a primitive library using the semantic primitives, and convert the primitive information into corresponding geometric information sequentially through a preset standard geometry library.

[0148] The recognition module 404 is used to perform semantic recognition on the CAD drawing through a preset functional partition recognition model to obtain each functional partition in the CAD drawing.

[0149] The drawing module 405 is used to draw semantic geometric drawings corresponding to the CAD drawings based on the primitive library, the functional partitions, and the geometric information.

[0150] Specifically, the parsing module 402 includes a first parsing unit 4021 and a second parsing unit 4022, the second parsing unit 4022 being used for:

[0151] Based on the identification information of the segment information, the data type of each segment information is determined sequentially;

[0152] A preset parsing method matching the data type of each segment of information is selected sequentially to parse each segment of information and obtain the group code information of each segment of information;

[0153] Based on the group code information of each segment, the multiple primitive information carried by the drawing exchange file is obtained.

[0154] Specifically, the conversion module 403 includes a construction unit 4031 and a conversion unit 4032, the conversion unit 4032 being used for:

[0155] Based on the identification information of the graphic element information, the graphic element data type of each graphic element information is determined sequentially;

[0156] Based on a pre-set standard geometry library, the geometric data types corresponding to the metadata types of each primitive information are matched sequentially.

[0157] Based on the geometric logic corresponding to each geometric data type, the corresponding primitive parameters are extracted sequentially from each primitive information.

[0158] The primitive parameters corresponding to each primitive information are encapsulated sequentially using a preset format to obtain the geometric information corresponding to each primitive information.

[0159] Specifically, the construction unit 4031 includes an identification subunit 40311 and a first construction subunit 40312, the first construction subunit 40312 being used for:

[0160] Collect the primitive dataset corresponding to the semantic primitives, and convert the semantic primitives into corresponding binary data streams based on the primitive dataset;

[0161] Based on the type of the semantic primitives, the corresponding binary data streams are classified and written into a preset database to obtain the primitive library corresponding to the semantic primitives.

[0162] Specifically, the identification module 404 includes:

[0163] Input unit 4041 is used to input the CAD drawing into a preset functional partition recognition model, wherein the functional partition recognition model includes a generator and a discriminator;

[0164] The generation unit 4042 is used to extract the relative and absolute features of each partition in the CAD drawing through the generator, and to construct a partition feature matrix through the generator based on the connection relationship between the partitions.

[0165] The discrimination unit 4043 is used to perform feature aggregation of each partition on the feature matrix based on the relative and absolute features of each partition by the discriminator, so as to obtain the functional category probability of each partition;

[0166] The determining unit 4044 is used to determine each functional partition in the CAD drawing based on the maximum functional category probability of each partition through the discriminator.

[0167] Specifically, the generation unit 4042 further includes an extraction subunit 40421 and a construction subunit 40422, the second construction subunit 40422 being used for:

[0168] The generator converts the CAD drawing into a corresponding N-order adjacency matrix based on the connection relationships between the partitions.

[0169] The generator adds up the elements of each column in the adjacency matrix to obtain N values, and generates the corresponding N-order degree matrix based on the N values.

[0170] The generator subtracts the degree matrix from the adjacency matrix to obtain the partition feature matrix.

[0171] Specifically, the CAD drawing parsing device also includes:

[0172] The generation module 406 is used to draw geometric figures using a preset drawing library based on the geometric information, and generate a geometric drawing corresponding to the CAD drawing;

[0173] The verification module 407 is used to compare and verify the graphic elements in the CAD drawing and the geometric figures in the geometric drawing in sequence, and output the comparison and verification results.

[0174] This invention further illustrates how, on a mobile device, segment information is identified using a pre-defined parsing method to parse the group code information of the segment information, resulting in corresponding primitive information. Geometric information is then extracted from the primitive information using the identifier information and corresponding geometric logic, thus achieving geometric information parsing of CAD drawings. Furthermore, it introduces the use of binary data streams as the data storage format for the primitive library, facilitating subsequent marking of the geometric drawings. Finally, it describes the identification of functional zones in the CAD drawing using a functional zone recognition model, used for marking the corresponding zones in the geometric drawings. Through these methods, based on parsing the CAD drawings to obtain geometric drawings, semantic annotation is also performed on the geometric drawings, achieving high parsing and editability of CAD drawings on mobile devices.

[0175] above Figure 4 and Figure 5 The CAD drawing parsing device in this embodiment of the invention will be described in detail from the perspective of modular functional entities. The CAD drawing parsing device in this embodiment of the invention will be described in detail from the perspective of hardware processing.

[0176] Figure 6 This is a schematic diagram of a CAD drawing parsing device 600 provided in an embodiment of the present invention. The CAD drawing parsing device 600 can vary significantly due to different configurations or performance characteristics. It may include one or more central processing units (CPUs) 610 (e.g., one or more processors) and a memory 620, and one or more storage media 630 (e.g., one or more mass storage devices) for storing application programs 633 or data 632. The memory 620 and storage media 630 can be temporary or persistent storage. The program stored in the storage media 630 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the CAD drawing parsing device 600. Furthermore, the processor 610 may be configured to communicate with the storage media 630 and execute the series of instruction operations in the storage media 630 on the CAD drawing parsing device 600.

[0177] The CAD drawing parsing device 600 may also include one or more power supplies 640, one or more wired or wireless network interfaces 650, one or more input / output interfaces 660, and / or one or more operating systems 631, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will understand that... Figure 6The illustrated CAD drawing parsing device structure does not constitute a limitation on the CAD drawing parsing device, and may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.

[0178] The present invention also provides a CAD drawing parsing device, which includes a memory and a processor. The memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor performs the steps of the CAD drawing parsing method in the above embodiments.

[0179] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when the instructions are executed on a computer, cause the computer to perform the steps of the CAD drawing parsing method.

[0180] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0181] 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 computer-readable storage medium. Based on this understanding, the technical solution of the present invention, 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, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0182] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for parsing CAD drawings, characterized in that, The CAD drawing parsing method includes: Read the CAD drawing to be parsed and the corresponding drawing exchange file; The drawing exchange file is parsed to obtain multiple segment information stored in the drawing exchange file, and each segment information is parsed in turn to obtain multiple primitive information carried by the drawing exchange file; Based on the graphic element information, semantic graphic elements in the CAD drawing are identified, and a graphic element library is constructed using the semantic graphic elements. The graphic element information is then sequentially converted into corresponding geometric information using a pre-set standard geometry library. The CAD drawing is input into a preset functional area recognition model, wherein the functional area recognition model includes a generator and a discriminator; The generator extracts the relative and absolute features of each partition in the CAD drawing; The generator converts the CAD drawing into a corresponding N-order adjacency matrix based on the connection relationships between the partitions. The generator adds up the elements of each column in the adjacency matrix to obtain N values, and generates the corresponding N-order degree matrix based on the N values. The generator subtracts the degree matrix from the adjacency matrix to obtain the partition feature matrix; The discriminator performs feature aggregation on the feature matrix based on the relative and absolute features of each partition to obtain the functional category probability of each partition. The discriminator determines each functional partition in the CAD drawing based on the maximum functional category probability of each partition. Based on the primitive library, the functional partitions, and the geometric information, a semantically meaningful geometric drawing is created corresponding to the CAD drawing.

2. The CAD drawing parsing method according to claim 1, characterized in that, The process of parsing each segment of information sequentially to obtain multiple primitive information carried by the drawing exchange file includes: Based on the identification information of the segment information, the data type of each segment information is determined sequentially; A preset parsing method matching the data type of each segment of information is selected sequentially to parse each segment of information and obtain the group code information of each segment of information; Based on the group code information of each segment, the multiple primitive information carried by the drawing exchange file is obtained.

3. The CAD drawing parsing method according to claim 1, characterized in that, The step of sequentially converting the primitive information into corresponding geometric information using a pre-set standard geometry library includes: Based on the identification information of the graphic element information, the graphic element data type of each graphic element information is determined sequentially; Based on a pre-set standard geometry library, the geometric data types corresponding to the metadata types of each primitive information are matched sequentially. Based on the geometric logic corresponding to each geometric data type, the corresponding primitive parameters are extracted sequentially from each primitive information. The primitive parameters corresponding to each primitive information are encapsulated sequentially using a preset format to obtain the geometric information corresponding to each primitive information.

4. The CAD drawing parsing method according to claim 1, characterized in that, The construction of the primitive library using the semantic primitives includes: Collect the primitive dataset corresponding to the semantic primitives, and convert the semantic primitives into corresponding binary data streams based on the primitive dataset; Based on the type of the semantic primitives, the corresponding binary data streams are classified and written into a preset database to obtain the primitive library corresponding to the semantic primitives.

5. The CAD drawing parsing method according to any one of claims 1-4, characterized in that, After the primitive information is sequentially converted into corresponding geometric information using a preset standard geometry library, the method further includes: Based on the geometric information, geometric figures are drawn using a pre-set drawing library to generate geometric drawings corresponding to the CAD drawings; The graphic elements in the CAD drawing and the geometric figures in the geometric drawing are compared and verified sequentially, and the comparison and verification results are output.

6. A CAD drawing parsing device, characterized in that, The CAD drawing parsing device includes: The reading module is used to read the CAD drawing to be parsed and the corresponding drawing exchange file of the CAD drawing; The parsing module is used to parse the drawing exchange file to obtain multiple segment information stored in the drawing exchange file, and to parse each segment information in turn to obtain multiple primitive information carried by the drawing exchange file; The conversion module is used to identify semantic primitives in the CAD drawing based on the primitive information, construct a primitive library using the semantic primitives, and convert the primitive information into corresponding geometric information sequentially through a preset standard geometry library. The recognition module is used to input the CAD drawing into a preset functional partition recognition model, wherein the functional partition recognition model includes a generator and a discriminator; the generator extracts the relative and absolute features of each partition in the CAD drawing; the generator converts the CAD drawing into a corresponding N-order adjacency matrix based on the connection relationships between the partitions; the generator adds the elements of each column in the adjacency matrix to obtain N values, and generates a corresponding N-order degree matrix based on the N values; the generator subtracts the degree matrix from the adjacency matrix to obtain a partition feature matrix; the discriminator performs feature aggregation on the feature matrix based on the relative and absolute features of each partition to obtain the functional category probability of each partition; and the discriminator determines each functional partition in the CAD drawing based on the maximum functional category probability of each partition. The drawing module is used to draw semantically meaningful geometric drawings corresponding to the CAD drawings based on the primitive library, the functional partitions, and the geometric information.

7. A CAD drawing parsing device, characterized in that, The CAD drawing parsing device includes: a memory and at least one processor, wherein the memory stores instructions; The at least one processor invokes the instructions in the memory to cause the CAD drawing parsing device to perform the CAD drawing parsing method as described in any one of claims 1-5.

8. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by the processor, it implements the CAD drawing parsing method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Identifying and graph-auditing method of building industry engineering CAD drawing

    CN108875599A

  • Intelligent recognition method for constructional engineering drawing

    CN111898401A