Method and system for extracting and structurally storing data from CAD drawing
By calling the ObjectARX interface and building an SQLite database, the problem of incomplete extraction of custom entity data from CAD drawings was solved, enabling cross-platform data storage and incremental updates, and improving data utilization efficiency and consistency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-10
AI Technical Summary
Existing technologies struggle to fully extract design data for custom entities from CAD drawings, and their data storage and interoperability are insufficient, making cross-platform applications and incremental updates impossible.
By calling the ObjectARX interface to read design entity information from CAD drawings, an SQLite structured database is built, data forms are created and logical relationships are established, and incremental updates are supported.
It enables complete extraction and cross-platform availability of custom entity data, improves data standardization and query efficiency, and ensures data consistency with design iterations.
Smart Images

Figure CN121833704A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data extraction technology, specifically to a method and system for extracting and structurally storing data from CAD drawings. Background Technology
[0002] In fields such as engineering surveying and design, architectural design, and manufacturing, computer-aided design (CAD) software has become a core tool. The drawing files it generates (especially the widely used .dwg format) carry the complete geometry and design information of a project. Traditionally, these drawings mainly serve for visualization, printing, and manual review. Their internal data is a hybrid structure optimized for graphic display and editing, containing basic graphic entities (such as lines, circles, and arcs) and custom entities developed by software vendors (such as specialized components representing walls, doors, and windows).
[0003] With the deepening of digital and intelligent transformation in the industry, simply possessing drawing files is no longer sufficient to meet the demands. All parties involved in a project urgently need to extract, clean, and structure design data from the drawings for cost estimation, construction simulation, material statistics, performance analysis, and data transfer to Building Information Modeling (BIM) platforms. However, achieving this goal faces significant technical bottlenecks:
[0004] Technical barriers to data extraction: For drawings created using professional software such as Tianzheng Architecture, the core design information (such as the material, dimensions, and model of components) is encapsulated in custom entity objects unique to the software. General CAD platforms or data interfaces usually cannot directly identify and parse the complete internal data structure of these custom entities, resulting in incomplete data extraction or only obtaining geometric outlines while losing key attribute information.
[0005] Data storage and interoperability format limitations: .dwg files are inherently complex binary graphic file formats, not designed for efficient data querying, correlation analysis, and cross-platform exchange. Directly using .dwg files for downstream data applications presents challenges such as parsing difficulties, slow reading speeds, and difficulty in implementing incremental updates. Although existing technologies utilize application programming interfaces (APIs) of specific software (such as ObjectARX) to extract data in its own format and write it to databases (such as SQLite), these methods typically depend on the runtime environment of that specific software, lacking versatility and failing to establish a cross-platform, software-neutral data supply chain.
[0006] Lack of dynamic update and version management mechanisms: Engineering design is an iterative process, and drawings undergo multiple revisions. Existing one-time data extraction methods cannot effectively identify and synchronize differences between drawing versions (such as the addition, deletion, and modification of components), resulting in the extracted dataset being out of sync with the current drawing status. This necessitates manual verification or a complete re-extraction, which is inefficient and prone to errors.
[0007] Therefore, there is an urgent need in this field for a method that can overcome the dependence on specific software, deeply analyze the complete design data in CAD drawings (especially professional drawings containing custom entities), and transform it into a structured, associative, and incrementally recognizable general data storage format, so as to open up the key link in the transformation of design data into value data. Summary of the Invention
[0008] To address this, embodiments of the present invention provide a method and system for extracting and structuring data from CAD drawings, thereby solving the technical problem of how to completely extract the design data carried by proprietary custom entities from professional drawings generated by specific CAD software and convert it into cross-platform usable structured data.
[0009] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0010] According to a first aspect of the present invention, a method for extracting and structurally storing data from CAD drawings is provided, the method comprising:
[0011] Call the application programming interface of the CAD platform to read one or more design entities within a selected range in the target drawing, and obtain the geometric and attribute information of the design entities;
[0012] Based on the data type of the designed entity, the read entities are classified and their quantities are counted;
[0013] Construct a structured database, and create data forms in the structured database that correspond to the design entity types;
[0014] The acquired geometric and attribute information is stored in the corresponding data forms created in the structured database according to their corresponding design entity types, and logical relationships are established between different data forms.
[0015] Furthermore, the specific method of calling the CAD platform's application programming interface is to call an interface based on the ObjectARX development framework; the specific method of reading the design entity is to read the geometric information, attribute information, coordinate information, and identification information of the design entity through dwgInFields.
[0016] Furthermore, the selected range is determined by selecting a box in the graphical interface of the target drawing through user interaction; the reading operation specifically involves traversing all entity objects within the selected range using an entity database iterator.
[0017] Furthermore, the design entity includes nested entities located in block references or external references; the method further includes the step of: recursively entering the interior of the block reference or external reference, traversing and reading the geometric and attribute information of the nested entities therein.
[0018] Furthermore, the structured database is an SQLite database; the data forms are created according to the type of building components, including at least a first form for storing wall data and a second form for storing door and window data, wherein the second form records the wall identification associated with the door and window data.
[0019] Furthermore, the method also includes:
[0020] At least one data storage file is generated, which is independent of the structured database and is used to persistently store the core data set extracted from the target drawing. The core data set includes at least: component identification, component handle, component name, geometric information, and coordinate information.
[0021] Furthermore, the method also includes updating incremental data, specifically including:
[0022] When data extraction is performed again on an updated version of the same drawing, the differences between the extracted data and the stored data are identified and compared.
[0023] The difference data is marked as added, modified, or deleted, and synchronously updated to the structured database and the corresponding data storage file.
[0024] Furthermore, the marking specifically involves setting a status flag bit in the corresponding data entry of the structured database;
[0025] Among them, newly added or modified data that has not been used is marked as the first state value, and data that has been used by subsequent processes is marked as the second state value.
[0026] Furthermore, the data extracted by the method is used for data transmission to the building information modeling platform, component location tracking, or statistical analysis of design results.
[0027] According to a second aspect of the present invention, a system for extracting and structurally storing data from CAD drawings is provided, the system comprising:
[0028] The target drawing reading module is used to call the application programming interface of the CAD platform to read one or more design entities within a selected range in the target drawing and obtain the geometric and attribute information of the design entities.
[0029] The classification and quantity statistics module is used to classify and count the read entities according to the data type of the designed entities;
[0030] The data form creation module is used to construct a structured database and create data forms corresponding to the design entity types in the structured database;
[0031] The storage module is used to store the acquired geometric information and attribute information into corresponding data forms created in the structured database according to their corresponding design entity types, and to establish logical relationships between different data forms.
[0032] The embodiments of the present invention have the following advantages:
[0033] This invention utilizes the ObjectARX application programming interface of a CAD platform to read design entities within a selected area of the drawing, obtaining their geometric and attribute information. It then categorizes and statistically analyzes these entities based on their type; constructs an SQLite structured database and creates data forms corresponding to the entity types; and stores the extracted information in the corresponding forms and establishes logical relationships. This invention is particularly effective in parsing and extracting complete design data from custom entities in Tianzheng software, solving the problems of incomplete data extraction from professional drawings and dependence on specific software environments. By converting graphic data into a structured database for storage, it achieves standardization, cross-platform usability, and efficient querying of design data. Through an incremental update mechanism, it supports the identification and synchronization of differences in drawing modification versions, ensuring data consistency with design iterations and significantly improving the utilization efficiency and automation level of design data in downstream applications. Attached Figure Description
[0034] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.
[0035] The structures, proportions, sizes, etc. illustrated in this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed herein, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.
[0036] Figure 1 A schematic diagram of the logical structure of a system for extracting and structuring data from CAD drawings, provided in an embodiment of the present invention;
[0037] Figure 2 A flowchart illustrating a method for extracting and structurally storing data from CAD drawings, provided by an embodiment of the present invention;
[0038] Figure 3 This is a schematic diagram of the main process of a method for extracting and structurally storing data from CAD drawings, provided in an embodiment of the present invention. Detailed Implementation
[0039] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. 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.
[0040] In the engineering survey and design industry, project drawings are typically created using CAD software and stored as .dwg files. However, with the development of the engineering survey and design industry and the increasing demand for digitalization in engineering projects, the traditional single .dwg file format is no longer compatible with a wider range of design platforms, and the data in the drawings cannot be effectively utilized, failing to meet the demands of engineering projects for the utilization of design data.
[0041] Custom entity technology is a graphical object extension feature implemented through the ObjectARX development framework, allowing developers to create custom graphical entities with independent attributes, behaviors, and data persistence. Therefore, custom entities have the potential to assign values to the geometric and attribute information of building components. With the advancement of digitalization in engineering projects, it has been clearly stated that there is a need to utilize drawing data for data extraction and cleaning to achieve standardized and controllable data for effective utilization in the engineering surveying and design industry.
[0042] 1. Tianzheng is based on the C++ programming language and can call the ObjectARX open interface to extract the geometric and attribute information stored in custom solid components;
[0043] 2. Implement the ability to read and write custom entities using dwgInFields (read data) and dwgOutFields (write data);
[0044] 3. Parametric-driven graphics were implemented using the subWorldDraw technique;
[0045] 4. Execute SQL statements to manipulate the SQLite database. This method writes the data from the drawings into the SQLite database.
[0046] Tianzheng pre-built forms in the SQLite database to categorize and store the extracted drawing data, and established form relationships. For example, the door and window form categorizes and stores data such as the specification parameters of door and window components, door and window types, door and window ID numbers, coordinate information of door and window components, wall ID numbers of the walls where the components are located, and the floor level.
[0047] However, when extracting data based on .DWG drawing data, other software struggles to extract data from Tianzheng drawings, while Tianzheng Architecture software has a high market share in the surveying and design industry.
[0048] This addresses the technical challenge of extracting design data from proprietary custom entities in professional drawings generated by specific CAD software and converting it into cross-platform usable structured data.
[0049] refer to Figure 1 This invention discloses a system for extracting and structurally storing data from CAD drawings. The system includes: a target drawing reading module 1; a classification and quantity statistics module 2; a data form creation module 3; and a storage module 4.
[0050] Corresponding to the system disclosed above for extracting and structuring data from CAD drawings, this invention also discloses a method for extracting and structuring data from CAD drawings. The following describes in detail, with reference to the system described above for extracting and structuring data from CAD drawings, a method for extracting and structuring data from CAD drawings disclosed in this invention.
[0051] refer to Figure 2 and Figure 3This invention discloses a method for extracting and structurally storing data from CAD drawings. The method involves calling the application programming interface (API) of a CAD platform to read one or more design entities within a selected range of the target drawing, obtaining the geometric and attribute information of the design entities; classifying and counting the read entities according to their data types; constructing a structured database and creating data forms corresponding to the design entity types within the structured database; storing the obtained geometric and attribute information, based on their corresponding design entity types, into the corresponding data forms created in the structured database, and establishing logical relationships between different data forms.
[0052] refer to Figure 3 Using the ObjectARX interface and dwglnfieds technology, we can read the geometric information, attribute information, coordinate information, and ID number of the component entity.
[0053] In a DWG drawing, use the mouse to select the area from which you want to extract the drawing data. Using ObjectARX entity database reading technology, iterate through all entity objects within the selected area using an iterator, and then categorize and summarize them according to the data type of the entities to obtain the number of components within the selected area.
[0054] The data extraction process can be stopped at any node. During this process, it's considered that the drawing data in the DWG drawing includes not only independent custom entity components, but also internal entities and external CAD references, all of which require data extraction. This patent also needs to re-enter the block base map and external reference drawings using an iterator, traversing the internal entities and reading their data to achieve nested data parsing of the block base map and external reference drawing data.
[0055] Data extraction involves executing SQL statements on the SQLite database to create component classification forms and establish logical relationships within the database. For example, information about door and window components is stored in the TarchDoor data form, recording the ID number of the wall where each component is located. Wall data is stored in the TarchWall data form, thus recording which wall each door or window is on, facilitating subsequent location and tracking of doors and windows within the specific model.
[0056] The extracted drawing data is stored in two files named Tgdate and ToRevit respectively. The Tgdate file stores the core component data in the drawing data, such as geometric information, attribute information, component ID number, component handle number, component name, and component coordinate information.
[0057] Considering that designers continuously iterate throughout the project design cycle, from schematic design and preliminary design to construction drawings, data extraction needs to support incremental data updates. Additions, deletions, and parametric modifications in the drawings need to be carefully processed. The ToRevit data file records the status information of the extracted data.
[0058] Once a data entry in the database has been used, the entry is marked with the number "0", and this entry cannot be reused. Newly added data entries are marked with the number "1" to distinguish which data has been used and which data is newly added.
[0059] For professional drawings generated by Tianzheng Architecture software (especially its T30 series), which holds a significant market share in the engineering survey and design industry, existing technologies lack a universal solution capable of completely and accurately extracting the design data encapsulated within its proprietary custom entities. Traditional data utilization methods based on the .dwg format have serious limitations, failing to achieve data structuring, standardization, and efficient cross-platform flow.
[0060] This invention enables in-depth analysis and cleaning of Tianzheng professional drawing data, and standardizes its storage in a general-purpose SQLite relational database. This transformation fundamentally changes the paradigm of design data storage and utilization, turning massive amounts of design data, originally confined to specific graphic file formats, into structured data resources with clear structures, well-defined relationships, and the ability to be accessed, queried, analyzed, and incrementally maintained independently of the original design software environment. This significantly improves the usability, interoperability, and efficiency of design data in downstream applications such as Building Information Modeling (BIM) collaboration, cost analysis, construction management, and digital auditing.
[0061] Although the present invention has been described in detail above with general descriptions and specific embodiments, modifications or improvements can be made to it, which will be obvious to those skilled in the art. Therefore, all such modifications or improvements made without departing from the spirit of the present invention fall within the scope of protection claimed by the present invention.
Claims
1. A method of extracting and structurally storing data from CAD drawings, characterized in that, The method comprises: calling an application program interface of a CAD platform, reading one or more design entities in a selected range in a target drawing, and obtaining geometric information and attribute information of the design entities; classifying and counting the read entities according to the data types of the design entities; constructing a structured database and creating data forms corresponding to the types of the design entities in the structured database; storing the obtained geometric information and attribute information in the corresponding data forms created in the structured database according to the types of the design entities, and establishing a logical association relationship between different data forms.
2. A method of extracting and structurally storing data from CAD drawings as claimed in claim 1, wherein, The application program interface of the CAD platform is specifically an interface based on an ObjectARX development framework; and the reading of the design entities is specifically reading geometric information, attribute information, coordinate information and identity information of the design entities through dwgInFields.
3. A method of extracting and structurally storing data from CAD drawings as claimed in claim 1, wherein, The selected range is determined by user interaction operation in a graphical interface of the target drawing; and the reading operation is specifically traversing all entity objects in the selected range through an entity database iterator.
4. A method of extracting and structurally storing data from CAD drawings as claimed in claim 1, wherein, The design entities include nested entities in block references or external references; and the method further comprises the steps of recursively entering the interiors of the block references or external references, and traversing and reading geometric information and attribute information of the nested entities.
5. A method of extracting and structurally storing data from CAD drawings as claimed in claim 1, wherein, The structured database is a SQLite database; and the data forms are classified and created according to building component types, and at least include a first form for storing wall data and a second form for storing door and window data, wherein the second form records identity of a wall associated with the door and window data.
6. A method of extracting and structurally storing data from CAD drawings as claimed in claim 1, wherein, The method further comprises: generating at least one data storage file independent of the structured database, for persistently storing a core data set extracted from the target drawing, wherein the core data set at least includes component identity, component handle, component name, geometric information and coordinate information.
7. A method of extracting and structurally storing data from CAD drawings as claimed in claim 1, wherein, The method further comprises updating incremental data, specifically comprising: when an updated version of the same drawing is executed again for data extraction, identifying and comparing differences between data extracted this time and stored data; marking the difference data as new, modified or deleted, and synchronously updating to the structured database and the corresponding data storage file.
8. A method of extracting and structurally storing data from CAD drawings as claimed in claim 7, wherein, The marking is specifically setting a state identification bit in a corresponding data entry of the structured database; wherein the new or modified data not used is marked as a first state value, and the data used by a subsequent process is marked as a second state value.
9. A method of extracting and structurally storing data from CAD drawings as claimed in claim 1, wherein, The data extracted by the method is used for data transmission to a building information model platform, component positioning tracking or design achievement statistical analysis.
10. A system for extracting and structurally storing data from CAD drawings, characterized in that, The system comprises: a target drawing reading module, configured to call an application program interface of a CAD platform, read one or more design entities in a selected range in a target drawing, and obtain geometric information and attribute information of the design entities; The classification and quantity statistics module is used for classifying and counting the read entities according to the data type of the design entity; The data form creating module is used for constructing a structured database and creating a data form corresponding to the design entity type in the structured database; The storage module is used for storing the obtained geometric information and attribute information into the corresponding data form created in the structured database according to the corresponding design entity type, and establishing a logical association relationship between different data forms.
Citation Information
Patent Citations
BIM data structured processing and storage method
CN110245368A
Data processing method and data processing system
CN111723424A
Intelligent BIM model generation method and system based on CAD drawing
CN112818457A
CAD drawing data processing method and device and storage medium
CN113642054A
Incremental storage method and system for design drawings
CN119179680A