A method and system for automatically extracting tabular data from two-dimensional drawings
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NEW DIMENSION SYST
- Filing Date
- 2022-09-08
- Publication Date
- 2026-05-12
Smart Images

Figure CN115631503B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of tabular data extraction technology, and in particular to a method and system for automatically extracting tabular data from two-dimensional drawings. Background Technology
[0002] With the rapid development of industrialization, electronic drawings are often used instead of paper drawings in some engineering projects. Typically, designers include technical parameters in the drawings to facilitate easy viewing of relevant information such as dimensions and specifications during manufacturing. However, with the advancement of digitalization, the technical information on the drawings needs to be presented not only on the drawings themselves but also simultaneously entered into data management systems such as ERP and SAP. Furthermore, historical drawing data also needs to be manually extracted and entered into the data management system, resulting in an exceptionally large workload. Requiring designers to manually re-enter all the data into the data management system would undoubtedly significantly increase their workload. Summary of the Invention
[0003] The purpose of this invention is to provide a method and system for automatically extracting table data from two-dimensional drawings, thereby reducing the workload for designers to recreate tables and fill in data in the data management system.
[0004] To achieve the above objectives, the present invention provides the following solution:
[0005] A method for automatically extracting tabular data from two-dimensional drawings includes:
[0006] Extract line segment entities and text entities from the 2D drawing to obtain a set of line segments and a set of text.
[0007] Group all line segment entities in the line segment set according to their extension direction to obtain the horizontal line segment set and the vertical line segment set;
[0008] All straight line segment entities in the horizontal line segment set are grouped according to their starting coordinates and lengths to obtain several horizontal line segment subsets; the starting point of the horizontally extended straight line segment entities is the leftmost point.
[0009] All line segment entities in the vertical line segment set are grouped according to their starting coordinates and lengths to obtain several vertical line segment subsets; the starting point of the vertically extended line segment entities is the topmost point.
[0010] Based on each set of horizontal and vertical line segments, determine several line segment entities that can form a table, and obtain the table line segment set;
[0011] A blank table is constructed based on the set of line segments in the table; the blank table includes multiple blank cells;
[0012] Based on the coordinates of each text entity in the text set and the coverage area of each blank cell in the blank table, each text entity is bound to the corresponding blank cell to obtain a table containing data.
[0013] Optionally, before extracting line segment entities and text entities from the two-dimensional drawing, the method for automatically extracting table data from the two-dimensional drawing further includes:
[0014] Determine whether the obtained entity is the smallest entity, and obtain the smallest entity determination result; the smallest entity is a line segment entity or a text entity; the line segment entity includes straight line segment entities and curved line segment entities;
[0015] If the minimum entity determination result is yes, then no further processing of the entity is required;
[0016] If the determination result of the minimum entity is negative, the entity is exploded until the entity is transformed into multiple minimum entities.
[0017] Optionally, after grouping all straight line segment entities in the straight line segment set according to their extension direction to obtain a horizontal line segment set and a vertical line segment set, the method for automatically extracting table data from the two-dimensional drawing further includes:
[0018] In the set of horizontal line segments, for any straight line segment entity, determine whether the distance between the end point coordinate of the straight line segment entity and the starting point coordinate of other straight line segment entities is less than a threshold. If so, connect the two straight line segment entities into one straight line segment entity; the end point of the horizontally extended straight line segment entity is the rightmost point.
[0019] In the set of vertical line segments, for any straight line segment entity, determine whether the distance between the end point coordinate of the straight line segment entity and the starting point coordinate of other straight line segment entities is less than a threshold. If so, connect the two straight line segment entities into one straight line segment entity; the end point of the vertically extended straight line segment entity is the bottommost point.
[0020] Optionally, the step of grouping all straight line segment entities in the horizontal line segment set according to the starting coordinates and length of the straight line segment entities to obtain several horizontal line segment subsets specifically includes:
[0021] Multiple straight line segments with the same starting y-axis coordinate and the same length in the set of horizontal line segments are taken as a subset of horizontal line segments, resulting in several subsets of horizontal line segments.
[0022] Optionally, the step of grouping all line segment entities in the vertical line segment set according to the starting coordinates and length of the line segment entities to obtain several vertical line segment subsets specifically includes:
[0023] Multiple straight line segments with the same starting x-axis coordinate and the same length in the set of vertical line segments are taken as a subset of vertical line segments, resulting in several subsets of vertical line segments.
[0024] Optionally, the step of obtaining a set of straight line segments that can form a table based on each subset of horizontal and vertical line segments, specifically includes:
[0025] In each subset of vertical line segments, determine the subset of vertical line segments with the largest average length value of the straight line segments, and use it as the initial table line segment set;
[0026] Traverse each horizontal line segment subset and add the straight line segment entities that intersect with the straight line segment entities in the initial table line segment set to the initial table line segment set to obtain the intermediate table line segment set.
[0027] Traverse each subset of vertical line segments, and add the line segment entities that intersect with the line segment entities in the intermediate table line segment set to the intermediate table line segment set to obtain the table line segment set.
[0028] Optionally, the step of obtaining a set of straight line segments that can form a table based on each subset of horizontal and vertical line segments, specifically includes:
[0029] In each set of horizontal line segments, determine the set of horizontal line segments with the largest average length value of straight line segments, and use it as the initial table line segment set.
[0030] Traverse each subset of vertical line segments and add the line segment entities that intersect with the line segment entities in the initial table line segment set to the initial table line segment set to obtain the intermediate table line segment set.
[0031] Traverse each horizontal line segment subset and add the straight line segment entities that intersect with the straight line segment entities in the intermediate table line segment set to the intermediate table line segment set to obtain the table line segment set.
[0032] Optionally, the step of binding each text entity to a corresponding blank cell based on the coordinates of each text entity in the text set and the area size of each blank cell in the blank table to obtain a table containing data specifically includes:
[0033] For any blank cell, determine the coverage area of the blank cell based on the coordinates of the two points on the diagonal of the blank cell;
[0034] Based on the coordinates of each text entity and the coverage area of the blank cell, the text entities located in the blank cell are determined.
[0035] Corresponding to the aforementioned method for automatically extracting table data from two-dimensional drawings, the present invention also provides a system for automatically extracting table data from two-dimensional drawings, comprising:
[0036] The entity extraction module is used to extract line segment entities and text entities from 2D drawings, and obtain a set of line segment entities and a set of text entities.
[0037] The line segment grouping module is used to group all line segment entities in the line segment set according to their extension direction, resulting in a horizontal line segment set and a vertical line segment set; it further groups all line segment entities in the horizontal line segment set according to their starting coordinates and length, resulting in several horizontal line segment subsets; the starting point of the horizontally extending line segment entities is the leftmost point; similarly, it groups all line segment entities in the vertical line segment set according to their starting coordinates and length, resulting in several vertical line segment subsets; the starting point of the vertically extending line segment entities is the topmost point.
[0038] The table segment set determination module is used to determine several straight line segment entities that can form a table based on each horizontal line segment subset and each vertical line segment subset, thus obtaining the table segment set.
[0039] The blank table construction module is used to construct a blank table based on the set of table line segments; the blank table includes multiple blank cells.
[0040] The text binding module is used to bind each text entity to the corresponding blank cell based on the coordinates of each text entity in the text set and the coverage area of each blank cell in the blank table, so as to obtain a table containing data.
[0041] Optionally, the system for automatically extracting tabular data from two-dimensional drawings further includes: a minimum entity determination module and an explosion processing module;
[0042] The minimum entity determination module is used to determine whether the acquired entity is a minimum entity and obtain a minimum entity determination result; the minimum entity includes line segment entities and text entities; the line segment entities include straight line segment entities and curved line segment entities; if the minimum entity determination result is yes, no further processing of the entity is required; if the minimum entity determination result is no, the explosion processing module is called.
[0043] The explosion processing module is used to perform explosion processing on the entity until the entity is transformed into multiple minimal entities.
[0044] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0045] This invention provides a method and system for automatically extracting table data from two-dimensional drawings. First, it automatically extracts and classifies line segments and text entities from the two-dimensional drawing. Then, according to the needs of table construction, it matches each line segment entity to obtain a set of table segments that can be used to construct the table and creates a blank table. Further, it determines the text within each cell and binds it using the coverage area of each cell and the coordinates of each text entity in the blank table, ultimately obtaining a table containing text data. This achieves automatic extraction of table data from two-dimensional drawings. The table data can then be directly stored in a data management system through other methods, reducing the workload for designers who need to recreate tables and fill in data in the data management system. Attached Figure Description
[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 This is a flowchart of a method for automatically extracting tabular data from two-dimensional drawings, provided in Embodiment 1 of the present invention;
[0048] Figure 2 This is a flowchart of steps A51 to A53 in the method for automatically extracting tabular data from two-dimensional drawings provided in Embodiment 1 of the present invention;
[0049] Figure 3 This is a flowchart of steps A71 to A72 in the method for automatically extracting tabular data from two-dimensional drawings provided in Embodiment 1 of the present invention;
[0050] Figure 4 This is a block diagram of a system for automatically extracting tabular data from two-dimensional drawings, as provided in Embodiment 2 of the present invention. Detailed Implementation
[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] With the development of the Industrial Internet and the trend of industrial digitalization, the requirements for data management are becoming increasingly stringent. This is especially true for engineering drawings used in production or construction. Designers not only need to draw relevant technical parameters on the drawings, but also need to store this data in a data management system to achieve data unification, standardization, and paperless processing. Currently available technologies include:
[0053] (1) Manual input by designers
[0054] When designers create two-dimensional drawings, they need to include technical parameters and other information in the form of tables on the drawings, and then manually enter the information into the data management system.
[0055] (2) The form of intermediate table
[0056] Designers first store the technical parameter table in a spreadsheet file (such as Excel), then import the table data using a 2D drawing design tool, and simultaneously import it in the data management system using the same operation.
[0057] However, in the existing technology, both method 1 and method 2 require manual processing, which is a lot of work for designers and is prone to errors.
[0058] To address the problems of the prior art, the purpose of this invention is to provide a method and system for automatically extracting tabular data from two-dimensional drawings. This method and system automatically extracts tabular data from two-dimensional drawings, reducing the workload for designers who need to recreate tables and fill in data in the data management system.
[0059] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0060] Example 1:
[0061] This embodiment provides a method for automatically extracting tabular data from two-dimensional drawings, such as... Figure 1 The flowchart shown illustrates the method for automatically extracting tabular data from two-dimensional drawings, which includes:
[0062] A1. Extract line segment entities and text entities from the 2D drawing to obtain a set of line segment entities and a set of text entities. In this embodiment, the 2D drawing refers to an electronic drawing in DWG / DXF format; extracting line segment entities and text entities from the 2D drawing can be done using modules like Teigha that can load drawings into a drawing database.
[0063] In actual engineering 2D drawings, there may be multiple small entities combined together as a large entity. In this case, it is necessary to determine whether the obtained entity is the smallest entity and obtain the smallest entity determination result. In this embodiment, the smallest entity to be obtained is a line segment entity or a text entity. The line segment entity includes straight line segment entities and curved line segment entities.
[0064] If the minimum entity determination result is yes, then no further processing of the entity is required.
[0065] If the determination result of the minimum entity is negative, the entity is exploded until the entity is transformed into multiple minimum entities.
[0066] A2. Group all line segment entities in the line segment set according to the extension direction to obtain the horizontal line segment set and the vertical line segment set. Through step A2, the horizontal and vertical line segments that were originally constructed into a table in the two-dimensional drawing can be extracted, which is convenient for subsequent table construction based on the line segment set.
[0067] To avoid excessive short lines and facilitate subsequent processing, the method for automatically extracting table data from 2D drawings after step A2 also includes:
[0068] In the set of horizontal line segments, for any straight line segment entity, it is determined whether the distance between the end coordinate of the straight line segment entity and the starting coordinate of other straight line segment entities is less than a threshold. If so, the two straight line segment entities are connected into one straight line segment entity. The end point of the horizontally extended straight line segment entity is the rightmost point. After this step, the straight line segments in the set of horizontal line segments that are approximately a straight line are connected end to end to form a straight line.
[0069] In the set of vertical line segments, for any straight line segment entity, it is determined whether the distance between the end point coordinate of the straight line segment entity and the starting point coordinate of other straight line segment entities is less than a threshold. If so, the two straight line segment entities are connected into one straight line segment entity. The end point of the vertically extended straight line segment entity is the lowest point. After this step, the straight line segments in the set of vertical line segments that are approximately a straight line are connected end to end to form a straight line.
[0070] A3. Group all straight line segments in the horizontal line segment set according to their starting point coordinates and lengths to obtain several horizontal line segment subsets; the starting point of a horizontally extended straight line segment is the leftmost point. In this embodiment, multiple straight line segments with the same starting y-axis coordinate and the same length in the horizontal line segment set are grouped into one horizontal line segment subset, resulting in several horizontal line segment subsets. After dividing the horizontal and vertical line segments into two large groups in step A2, further grouping of each line segment is required.
[0071] A4. Group all straight line segment entities in the vertical line segment set according to their starting point coordinates and lengths to obtain several vertical line segment subsets; the starting point of the vertically extended straight line segment entity is the uppermost point; in this embodiment, multiple straight line segment entities with the same starting x-axis coordinate and the same length in the vertical line segment set are taken as a vertical line segment subset to obtain several vertical line segment subsets.
[0072] A5. Based on the subsets of horizontal and vertical line segments, determine several line segment entities that can form a table, thus obtaining the table line segment set; in one embodiment, step A5 may specifically include the following steps:
[0073] A51. In each subset of vertical line segments, determine the subset of vertical line segments with the largest average length value of the straight line segments, which is the initial table line segment set. In step A51, by selecting the longest vertical line segment subset from multiple vertical line segment groups after grouping by line segment starting point and line segment length, it is actually selecting the outermost set of vertical straight line segments that make up the table as the initial table line segment set.
[0074] A52. Traverse each horizontal line segment subset and add the straight line segments that intersect with the straight line segments in the initial table line segment set to the initial table line segment set to obtain the intermediate table line segment set. After determining the initial table line segment set including the outermost vertical straight line segments in step A51, traverse each horizontal line segment subset and determine whether the straight line segments in each horizontal line segment subset intersect with the straight line segments in the initial table line segment set. If there is an intersection, it can be determined that the straight line segment can form a table together with the straight line segments in the initial table line segment set. Then, add all the straight line segments that meet the conditions to the initial table line segment set to obtain the intermediate table line segment set.
[0075] A53. Traverse each vertical line segment subset and add the line segments that intersect with the line segments in the intermediate table line segment set to the intermediate table line segment set to obtain the table line segment set. After traversing each horizontal line segment subset in step A52 to obtain the corresponding intermediate table line segment set, traverse each vertical line segment subset again. Similarly, determine whether each vertical line segment intersects with the line segments in the intermediate table line segment set. If there is an intersection, it can be determined that the line segment can form a table together with the line segments in the intermediate table line segment set. Then, add these line segments that meet the conditions to the intermediate table line segment set to obtain the final table line segment set. At this time, the line segments in the table line segment set can form a table.
[0076] As an alternative implementation to steps A51 to A53 above, step A5 may further include the following steps:
[0077] In each set of horizontal line segments, the set of horizontal line segments with the largest average length of the straight line segments is determined as the initial set of table line segments. In this step, the longest set of horizontal line segments is selected from multiple groups of horizontal line segments grouped by line segment starting point and line segment length. Similar to step A51, this actually selects the outermost set of horizontal straight line segments that make up the table as the initial set of table line segments.
[0078] Traverse each subset of vertical line segments and add any line segments that intersect with the line segments in the initial table line segment set to the initial table line segment set to obtain the intermediate table line segment set. After determining the initial table line segment set including the outermost horizontal line segments, traverse each subset of vertical line segments and determine whether any line segments in each subset intersect with any line segments in the initial table line segment set. If there is an intersection, it can be determined that the line segment can form a table with any line segments in the initial table line segment set. Then, add all the line segments that meet the condition to the initial table line segment set to obtain the intermediate table line segment set.
[0079] Traverse each horizontal line segment subset and add any line segment entities that intersect with the line segments in the intermediate table line segment set to the intermediate table line segment set, thus obtaining the table line segment set. Similarly, after traversing each vertical line segment subset in the aforementioned steps to obtain the corresponding intermediate table line segment set, traverse each horizontal line segment subset again, similarly determining whether each horizontal line segment intersects with the line segments in the intermediate table line segment set. If an intersection exists, it can be determined that the line segment can form a table together with the line segments in the intermediate table line segment set. Then, add these line segments that meet the condition to the intermediate table line segment set to obtain the final table line segment set. At this point, the line segments in the table line segment set can form a table.
[0080] A6. A blank table is constructed based on the set of line segments in the table; the blank table includes multiple blank cells; based on the coordinates and lengths of each line segment in the set of line segments in the table, each line segment is constructed into a table. Since the text has not yet been bound to each cell of the table, each cell in the table is blank.
[0081] A7. Based on the coordinates of each text entity in the text set and the coverage area of each blank cell in the blank table, bind each text entity to the corresponding blank cell to obtain a table containing data. In this embodiment, step A7 specifically includes:
[0082] A71. For any blank cell, determine the coverage area of the blank cell based on the coordinates of the two points on its diagonal. For example, if the coordinates of the two points on the diagonal of the upper left and lower right corners of a blank cell are (0,0) and (2,3) respectively, or the coordinates of the two points on the diagonal of the upper right and lower left corners are (0,3) and (2,0) respectively, then the blank cell can cover the area with the horizontal coordinate 0 to 2 and the vertical coordinate 0 to 3.
[0083] A72. Based on the coordinates of each text entity and the coverage area of the blank cell, determine the text entity located in the blank cell. For example, if the coordinates of a text are (1,2), its horizontal coordinate is within 0 to 2, and its vertical coordinate is within 0 to 3, then it can be determined that the text can be bound to the blank cell with the upper left corner coordinates (0,0) and the lower right corner coordinates (2,3).
[0084] This embodiment automatically extracts and classifies line segments and text entities from 2D drawings. Then, according to the needs of table construction, it matches each line segment entity to obtain a set of table segments that can be used to construct a table and creates a blank table. Furthermore, by using the coverage area of each cell in the blank table and the coordinates of each text entity, it determines the text in each cell and binds it, ultimately obtaining a table containing text data. This achieves automatic extraction of table data from 2D drawings. The table data can then be directly stored in the data management system through other methods, reducing the workload for designers to recreate tables and fill in data in the data management system.
[0085] Example 2:
[0086] This embodiment corresponds to the method for automatically extracting table data from two-dimensional drawings provided in Embodiment 1, and provides a system for automatically extracting table data from two-dimensional drawings, such as... Figure 3 As shown, the system for automatically extracting tabular data from two-dimensional drawings includes:
[0087] The entity extraction module is used to extract line segment entities and text entities from 2D drawings, and obtain a set of line segment entities and a set of text entities.
[0088] The line segment grouping module is used to group all line segment entities in the line segment set according to their extension direction, resulting in a horizontal line segment set and a vertical line segment set; it further groups all line segment entities in the horizontal line segment set according to their starting coordinates and length, resulting in several horizontal line segment subsets; the starting point of the horizontally extending line segment entities is the leftmost point; similarly, it groups all line segment entities in the vertical line segment set according to their starting coordinates and length, resulting in several vertical line segment subsets; the starting point of the vertically extending line segment entities is the topmost point.
[0089] The table segment set determination module is used to determine several straight line segment entities that can form a table based on each horizontal line segment subset and each vertical line segment subset, thus obtaining the table segment set.
[0090] The blank table construction module is used to construct a blank table based on the set of table line segments; the blank table includes multiple blank cells.
[0091] The text binding module is used to bind each text entity to the corresponding blank cell based on the coordinates of each text entity in the text set and the coverage area of each blank cell in the blank table, so as to obtain a table containing data.
[0092] In this embodiment, the system for automatically extracting tabular data from two-dimensional drawings also includes: a minimum entity judgment module and an explosion processing module;
[0093] The minimum entity determination module is used to determine whether the acquired entity is a minimum entity and obtain the minimum entity determination result; the minimum entity includes line segment entities and text entities; the line segment entities include straight line segment entities and curved line segment entities; if the minimum entity determination result is yes, no further processing of the entity is required; if the minimum entity determination result is no, the explosion processing module is called.
[0094] An explosion processing module is used to perform explosion processing on the entity until the entity is transformed into multiple minimal entities.
[0095] The program portion of a technology can be considered a "product" or "artifact" existing in the form of executable code and / or related data, and is involved in or implemented through a computer-readable medium. Tangible, permanent storage media can include memory or storage used by any computer, processor, or similar device or related module. For example, various semiconductor memories, tape drives, disk drives, or any similar device capable of providing storage functionality for software.
[0096] All software, or parts thereof, may sometimes communicate via networks, such as the Internet or other communication networks. Such communication can load software from one computer device or processor to another. For example, loading software from a server or host computer of a video object detection device to a hardware platform of a computer environment, or another computer environment that implements the system, or a system with similar functionality related to providing the information needed for object detection. Therefore, another medium capable of transmitting software elements can also be used as a physical connection between local devices, such as light waves, radio waves, electromagnetic waves, etc., propagated through cables, fiber optic cables, or air. Physical media used for carrier waves, such as cables, wireless connections, or fiber optic cables, can also be considered as media carrying software. In this context, unless limited to tangible "storage" media, the term "readable medium" for a computer or machine refers to the medium involved in the execution of any instructions by the processor.
[0097] Specific examples are used in this article, but the above description is only to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. Those skilled in the art should understand that the various modules or steps of the present invention described above can be implemented using general-purpose computer devices. Optionally, they can be implemented using computer-executable program code, and thus, they can be stored in a storage device for execution by a computer device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. The present invention is not limited to any specific combination of hardware and software.
[0098] Furthermore, those skilled in the art will recognize that, based on the principles of this invention, there will be variations in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as limiting the invention.
Claims
1. A method for automatically extracting tabular data from a two-dimensional drawing, characterized in that, The method for automatically extracting table data in a two-dimensional drawing comprises the following steps: extracting straight line segment entities and text entities in the two-dimensional drawing to obtain a straight line segment set and a text set; grouping all straight line segment entities in the straight line segment set according to the extension direction to obtain a horizontal line segment set and a vertical line segment set; grouping all straight line segment entities in the horizontal line segment set according to the starting point coordinates of the straight line segment entities and the length of the straight line segment entities to obtain a plurality of horizontal line segment subsets; the starting point of the straight line segment entity extending horizontally is the leftmost point; grouping all straight line segment entities in the vertical line segment set according to the starting point coordinates of the straight line segment entities and the length of the straight line segment entities to obtain a plurality of vertical line segment subsets; the starting point of the straight line segment entity extending vertically is the uppermost point; determining a plurality of straight line segment entities capable of constituting a table according to the horizontal line segment subsets and the vertical line segment subsets to obtain a table line segment set; constructing a blank table according to the table line segment set; the blank table comprises a plurality of blank cells; binding each text entity to the corresponding blank cell according to the coordinates of each text entity in the text set and the coverage area of each blank cell in the blank table to obtain a table containing data; determining a plurality of straight line segment entities capable of constituting a table according to the horizontal line segment subsets and the vertical line segment subsets to obtain a table line segment set, which specifically comprises the following steps: in each vertical line segment subset, determining the vertical line segment subset with the maximum average length value of the straight line segment entities as an initial table line segment set; traversing each horizontal line segment subset and adding the straight line segment entities intersecting with the straight line segment entities in the initial table line segment set to the initial table line segment set to obtain an intermediate table line segment set; traversing each vertical line segment subset and adding the straight line segment entities intersecting with the straight line segment entities in the intermediate table line segment set to the intermediate table line segment set to obtain the table line segment set; or in each horizontal line segment subset, determining the horizontal line segment subset with the maximum average length value of the straight line segment entities as an initial table line segment set; traversing each vertical line segment subset and adding the straight line segment entities intersecting with the straight line segment entities in the initial table line segment set to the initial table line segment set to obtain an intermediate table line segment set; traversing each horizontal line segment subset and adding the straight line segment entities intersecting with the straight line segment entities in the intermediate table line segment set to the intermediate table line segment set to obtain the table line segment set.
2. The method of claim 1, wherein, Before the step of extracting the straight line segment entities and the text entities in the two-dimensional drawing, the method for automatically extracting table data in a two-dimensional drawing further comprises the following steps: determining whether the obtained entity is a minimum entity to obtain a minimum entity determination result; the minimum entity is a line segment entity or a text entity; the line segment entity comprises a straight line segment entity and a curved line segment entity; if the minimum entity determination result is yes, the entity does not need to be further processed; if the minimum entity determination result is no, the entity is subjected to explosion processing until the entity is converted into a plurality of minimum entities.
3. The method of claim 1, wherein, After grouping all straight line segment entities in the straight line segment set according to their extension direction to obtain a horizontal line segment set and a vertical line segment set, the method for automatically extracting table data from two-dimensional drawings further includes: In the set of horizontal line segments, for any straight line segment entity, determine whether the distance between the end point coordinate of the straight line segment entity and the starting point coordinate of other straight line segment entities is less than a threshold. If so, connect the two straight line segment entities into one straight line segment entity; the end point of the horizontally extended straight line segment entity is the rightmost point. In the set of vertical line segments, for any straight line segment entity, determine whether the distance between the end point coordinate of the straight line segment entity and the starting point coordinate of other straight line segment entities is less than a threshold. If so, connect the two straight line segment entities into one straight line segment entity; the end point of the vertically extended straight line segment entity is the bottommost point.
4. The method of claim 1, wherein, The process of grouping all straight line segment entities in the horizontal line segment set according to their starting coordinates and lengths to obtain several horizontal line segment subsets specifically includes: The starting point of the horizontal line segment set is taken as the starting point of the horizontal line segment set y A plurality of straight line segment entities with the same axis coordinate and the same length are taken as a horizontal line segment subset, and a plurality of horizontal line segment subsets are obtained.
5. The method for automatically extracting tabular data from two-dimensional drawing sheets of claim 1, wherein, The process of grouping all line segment entities in the vertical line segment set according to their starting coordinates and lengths to obtain several vertical line segment subsets specifically includes: The starting point of the vertical line segment set is set as the starting point of the vertical line segment set x A plurality of straight line segment entities with the same axis coordinate and the same length are taken as a vertical line segment subset, and a plurality of vertical line segment subsets are obtained.
6. The method for automatically extracting tabular data from two-dimensional drawing sheets of claim 1, wherein, The step of binding each text entity to a corresponding blank cell based on the coordinates of each text entity in the text set and the area size of each blank cell in the blank table to obtain a table containing data specifically includes: For any blank cell, determine the coverage area of the blank cell based on the coordinates of the two points on the diagonal of the blank cell; Based on the coordinates of each text entity and the coverage area of the blank cell, the text entities located in the blank cell are determined.
7. A system for automatically extracting tabular data from a two-dimensional drawing, characterized by The system for automatically extracting tabular data from two-dimensional drawings includes: The entity extraction module is used to extract line segment entities and text entities from 2D drawings, and obtain a set of line segment entities and a set of text entities. The line segment grouping module is used to group all line segment entities in the line segment set according to their extension direction, resulting in a horizontal line segment set and a vertical line segment set; it further groups all line segment entities in the horizontal line segment set according to their starting coordinates and length, resulting in several horizontal line segment subsets; the starting point of the horizontally extending line segment entities is the leftmost point; similarly, it groups all line segment entities in the vertical line segment set according to their starting coordinates and length, resulting in several vertical line segment subsets; the starting point of the vertically extending line segment entities is the topmost point. The table segment set determination module is used to determine several straight line segment entities that can form a table based on each horizontal line segment subset and each vertical line segment subset, thus obtaining the table segment set. The blank table construction module is used to construct a blank table based on the set of table line segments; the blank table includes multiple blank cells. The text binding module is used to bind each text entity to the corresponding blank cell according to the coordinates of each text entity in the text set and the coverage area of each blank cell in the blank table, so as to obtain a table containing data. The table segment set determination module is used to: determine the subset of vertical line segments with the largest average length value among each subset of vertical line segments, which is the initial table segment set; traverse each subset of horizontal line segments, adding line segments that intersect with line segments in the initial table segment set to the initial table segment set, thus obtaining an intermediate table segment set; traverse each subset of vertical line segments, adding line segments that intersect with line segments in the intermediate table segment set to the intermediate table segment set, thus obtaining a table segment set; or In each set of horizontal line segments, the set of horizontal line segments with the largest average length of straight line segments is determined as the initial set of table line segments. Each set of vertical line segments is traversed, and straight line segments that intersect with the straight line segments in the initial set are added to the initial set of table line segments to obtain an intermediate set of table line segments. Similarly, each set of horizontal line segments is traversed, and straight line segments that intersect with the straight line segments in the intermediate set of table line segments are added to the intermediate set of table line segments to obtain a complete set of table line segments.
8. The system for automatically extracting tabular data from two-dimensional drawing sheets of claim 7, wherein, The system for automatically extracting tabular data from two-dimensional drawings also includes: a minimum entity determination module and an explosion processing module; The minimum entity determination module is used to determine whether the acquired entity is a minimum entity and obtain a minimum entity determination result; the minimum entity includes line segment entities and text entities; the line segment entities include straight line segment entities and curved line segment entities; if the minimum entity determination result is yes, no further processing of the entity is required; if the minimum entity determination result is no, the explosion processing module is called. The explosion processing module is used to perform explosion processing on the entity until the entity is transformed into multiple minimal entities.