A method for saving and opening multiple versions of CAD document feature object data compatible with each other

CN118503213BActive Publication Date: 2026-10-09NEW DIMENSION SYST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410629374.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-21
Publication Date
2026-10-09
Estimated Expiration
2044-05-21

AI Technical Summary

Technical Problem

目前,常用的CAD文档中的特征对象数据都是按照顺序流的方式保存的,当在CAD文档中添加一个特征对象数据时,也会对顺序流造成破坏,这样打开CAD文档时会因为流的顺序不同造成打开文档失败

Benefits of technology

[0024] This invention proposes a method for saving and opening multiple versions of feature object data in CAD documents. It uses a hierarchical feature logic data structure as the basic storage structure, saving and restoring member variables of feature objects in the CAD document in a key-value format. This ensures that adding a new feature object to the CAD document does not change the overall feature object document version. Compared to sequential stream saving methods, this solves the compatibility problem between multiple versions of feature object data when opening and reading CAD documents, reducing workload and development risks. It also optimizes read/write efficiency by quickly searching based on the feature object's ObjectID. Furthermore, it uses an API call method to support the data to be saved and restored, making it simple and easy to use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118503213B_ABST
    Figure CN118503213B_ABST
Patent Text Reader

Abstract

The application discloses a kind of compatible CAD document feature object data multi-version's saving opening method, it is related to document storage reading field, this method includes: when performing document saving operation to CAD document, for any feature object in CAD document, the highest document version supported by CAD program is saved feature object;Calling storage interface, according to the ObjectID of feature object, the Key and Value of the member variable of feature object are saved in feature logic hierarchical data structure;When performing document opening operation to CAD document, for any feature object in CAD document, calling reading interface, according to the ObjectID of feature object, the Value corresponding to the Key of the member variable of feature object is read in feature logic hierarchical data structure.The application can solve the compatibility problem between multi-version of CAD document opening reading feature object data, reduce workload and development risk.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of document storage and retrieval, and in particular to a method for saving and opening multiple versions of CAD document feature object data. Background Technology

[0002] CAD documents contain many types of objects, among which feature objects are a group of elements with specific relationships on the model's design body, such as annotations, punching, chamfering, extrusion, and bending. Currently, feature object data in commonly used CAD documents is stored in a sequential flow. Adding a feature object to a CAD document disrupts this sequential flow, causing the document to fail to open due to the different flow order. For example, a previous version of the CAD program corresponding to a specific version of the feature object was used. When supporting a new feature object, the feature object document version needs to be upgraded. Upgrading the feature object document version requires a series of code modifications, which are extensive, error-prone, and require systematic testing to ensure code correctness. Therefore, currently, adding a feature object to a CAD document changes the entire feature object document version, leading to incompatibility between different versions when opening and reading feature object data in CAD documents, resulting in high workload and development risks. Summary of the Invention

[0003] The purpose of this invention is to provide a method for saving and opening CAD document feature object data in multiple versions, so as to solve the compatibility problem between multiple versions of CAD document feature object data, reduce workload and development risk.

[0004] To achieve the above objectives, the present invention provides the following solution:

[0005] A method for saving and opening CAD document feature object data compatible with multiple versions, the method comprising:

[0006] Receive current instructions;

[0007] If the current instruction is a document save instruction, then the document save operation will be performed on the CAD document;

[0008] If the current instruction is a document open instruction, then the document open operation is performed on the CAD document;

[0009] The document saving operation includes:

[0010] For any feature object in the CAD document, save the feature object using the highest document version supported by the CAD program;

[0011] For any feature object in the CAD document, obtain the Key, Value, and ObjectID of the feature object's member variables, and call the storage interface. Based on the ObjectID of the feature object, store the Key and Value of the feature object's member variables in the feature logic hierarchical data structure of the CAD software in Key-Value format, thereby realizing the storage of the feature object's member variables.

[0012] Once all feature objects and all member variables of the feature objects in the CAD document have been saved, the CAD document is saved.

[0013] The document opening operation includes:

[0014] For any feature object in the CAD document, obtain the Key of the feature object's member variable and the ObjectID of the feature object, and call the read interface. Based on the ObjectID of the feature object, read the Value of the feature object's member variable corresponding to the Key of the feature object's member variable in the feature logic hierarchical data structure of the CAD software, thereby realizing the data recovery of the feature object's member variable.

[0015] Once the member variables of all feature objects in the CAD document have been fully recovered, the CAD document can be opened.

[0016] Optionally, the storage interface is called to save the key and value of the feature object's member variables in key-value pairs within the feature logic hierarchical data structure of the CAD software, based on the feature object's ObjectID. This process includes:

[0017] If a node with the same ObjectID as the feature object is found in the AppendedType category of the feature logic hierarchical data structure of the CAD software, an AppendedMember node named Key is created in that node, and the storage interface is called to write the Value of the member variable of the feature object into the attribute value of the AppendedMember node, thereby saving the feature object.

[0018] If a node with the same ObjectID as the feature object cannot be found in the AppendedType category of the feature logic hierarchical data structure in the CAD software, then a node with the same ObjectID as the feature object is created, and the storage interface is called to save the Key and Value of the feature object's member variables under the created node, thereby saving the feature object.

[0019] Optionally, the read interface is called to read the value of the member variable of the feature object corresponding to the key of the feature object's member variable in the feature logic hierarchical data structure of the CAD software, based on the ObjectID of the feature object, thereby realizing the data recovery of the member variable of the feature object, specifically including:

[0020] In the feature logic hierarchical data structure of the CAD software, find the node with the same category as the ObjectID of the feature object, call the read interface to read the value of the member variable of the feature object corresponding to the key of the member variable of the feature object in the found node, and realize the data recovery of the feature object.

[0021] Optionally, the feature logic hierarchical data structure is an XML data structure.

[0022] Optionally, both the storage interface and the read interface adopt the Context's IO interface.

[0023] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0024] This invention proposes a method for saving and opening multiple versions of feature object data in CAD documents. It uses a hierarchical feature logic data structure as the basic storage structure, saving and restoring member variables of feature objects in the CAD document in a key-value format. This ensures that adding a new feature object to the CAD document does not change the overall feature object document version. Compared to sequential stream saving methods, this solves the compatibility problem between multiple versions of feature object data when opening and reading CAD documents, reducing workload and development risks. It also optimizes read / write efficiency by quickly searching based on the feature object's ObjectID. Furthermore, it uses an API call method to support the data to be saved and restored, making it simple and easy to use. Attached Figure Description

[0025] 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.

[0026] Figure 1 This is a schematic diagram of the method for saving and opening multiple versions of CAD document feature object data provided in an embodiment of the present invention;

[0027] Figure 2 This is a schematic diagram of a hierarchical data structure for feature logic. Detailed Implementation

[0028] 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.

[0029] The purpose of this invention is to provide a method for saving and opening CAD document feature object data in multiple versions, aiming to solve the compatibility problem between multiple versions of CAD document feature object data, and reduce workload and development risks.

[0030] 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.

[0031] like Figure 1 As shown, the method for saving and opening multiple versions of CAD document feature object data in this embodiment includes:

[0032] Step 101: Receive the current instruction.

[0033] Step 102: If the current instruction is a document save instruction, then execute step 103 on the CAD document.

[0034] Step 103: Save the document.

[0035] Step 104: If the current instruction is a document open instruction, then proceed to step 105 for the CAD document.

[0036] Step 105: Open the document.

[0037] Step 103 specifically includes:

[0038] Step 1031: For any feature object in the CAD document, save the feature object using the highest document version supported by the CAD program. The highest document version can be the latest version of the current software.

[0039] Step 1032: For any feature object in the CAD document, call the storage interface, and according to the ObjectID of the feature object, save the Key and Value of the member variables of the feature object in the feature logic hierarchical data structure of the CAD software in the form of Key-Value.

[0040] Specifically: For any feature object in the CAD document, first obtain the Key, Value, and ObjectID of the feature object's member variables; then call the storage interface, and based on the ObjectID of the feature object, save the Key and Value of the feature object's member variables in the feature logic hierarchical data structure of the CAD software in Key-Value format, thereby realizing the saving of the feature object's member variables.

[0041] Step 1033: Once all feature objects and member variables of all feature objects in the CAD document have been saved, the CAD document is saved.

[0042] Step 105 specifically includes:

[0043] Step 1051: Call the read interface and, based on the ObjectID of the feature object, read the Value of the member variable of the feature object corresponding to the Key of the member variable of the feature object in the feature logic hierarchical data structure of the CAD software.

[0044] Specifically: For any feature object in the CAD document, first obtain the Key of the feature object's member variable and the ObjectID of the feature object; then call the read interface, and according to the ObjectID of the feature object, read the Value of the feature object's member variable corresponding to the Key of the feature object's member variable in the feature logic hierarchical data structure of the CAD software, thereby realizing the data recovery of the feature object's member variable.

[0045] Step 1052: Once the member variables of all feature objects in the CAD document have been fully recovered, the CAD document can be opened.

[0046] In one example, step 1032 calls the storage interface to save the key and value of the feature object's member variables in key-value pairs within the feature logic hierarchical data structure of the CAD software, based on the feature object's ObjectID. This process of saving the feature object's member variables specifically includes:

[0047] (1) If a node with the same ObjectID as the feature object is found in the AppendedType category of the feature logic hierarchical data structure of the CAD software, an AppendedMember node named Key is created in that node, and the storage interface is called to write the Value of the member variable of the feature object into the attribute value of the AppendedMember node, thereby saving the feature object.

[0048] (2) If a node with the same ObjectID as the feature object cannot be found in the AppendedType category of the feature logic hierarchical data structure of the CAD software, then a node with the same ObjectID as the feature object is created, and the storage interface is called to save the Key of the feature object's member variables and the Value of the feature object's member variables under the created node, thereby saving the feature object.

[0049] In one example, step 1052 calls the read interface to read the value of the member variable of the feature object corresponding to the key of the feature object's member variable from the feature logic hierarchical data structure of the CAD software, based on the ObjectID of the feature object. This achieves data recovery of the member variable of the feature object, specifically including:

[0050] In the feature logic hierarchical data structure of the CAD software, find the node with the same category as the ObjectID of the feature object, call the read interface to read the value of the member variable of the feature object corresponding to the key of the member variable of the feature object in the found node, and realize the data recovery of the feature object.

[0051] In one example, the feature logic hierarchical data structure can be an XML data structure. Specifically, such as... Figure 2 As shown, the feature logic hierarchical data structure includes four layers: the first layer is SPECIFIC_DATA, the second layer is AppendedToType, the third layer is Object, and the fourth layer is AppendedMember. Key-Value pairs are stored in the fourth layer, with one key-value pair corresponding to one AppendedMember.

[0052] In one example, both the storage interface and the read interface use the Context's IO interface. The IO interface is one of the Context's interfaces, which can implement data reading and writing of basic data types, such as boolean, long integer, and string types.

[0053] The method described in the above embodiments solves the problem of incompatibility between multiple versions of CAD document feature object data. Internally, the feature object data is logically layered into a basic storage structure, changing the past sequential data read and write method to a key-value read and write method, and quickly searching by ID, which is more conducive to opening and storing feature objects in multiple versions of documents.

[0054] The following section introduces a more specific implementation process of the above method in practical applications, and explains it in conjunction with usage scenarios.

[0055] (1) When saving a CAD document, iterate through all feature block tables and save all the feature objects in the database by calling the storage interface in each block table.

[0056] In the storage interface of each feature object, the highest document version supported by the current CAD program is saved, and the Context's IO interface is called to save the data of the member variables of the current feature object.

[0057] In the IO interface, the key and value of the member variables of the current feature object, as well as the ObjectID of the current feature object, are obtained. The key-value pair is then stored in the corresponding category of the feature object's ObjectID within the CAD software's feature logic hierarchical data structure. Specifically, if a node with the same ObjectID as the feature object is found in the AppendedType category of the feature logic hierarchical data structure, an AppendedMember node with the name "Key" is created within that node, and the value is written to the node's attribute value. If no node with the same ObjectID is found, the node is created, and the key and value are stored accordingly. After all feature objects have been saved, the CAD software's feature logic hierarchical data structure is saved in a document.

[0058] (2) When opening a CAD document, the feature logic hierarchical data of the CAD software in the CAD document is first read and constructed into a key-value format for easy searching. The construction process is as follows: by parsing the data text, the text data under the category is generated into a key-value data structure.

[0059] The system reads all feature block tables from the CAD document and uses the read interface to restore the data for all imported feature objects in each feature block table. The restoration process is as follows: each imported feature object consists of member variables, which are defined by names (the key string in the key-value pair) and values ​​(the values). The system matches the values ​​of all member variables against the key-value nodes in the feature's logical hierarchical data structure and assigns the values ​​to the member variables.

[0060] In the read interface of each feature object, the IO interface of the Context is called to restore the data of the member variables of the current feature object.

[0061] In the IO interface, by passing the Key of the current feature object's member variable and the ObjectID of the current feature object, the corresponding category of ObjectID is found in the feature logic hierarchical data structure of the CAD software. Within this category, the corresponding Value is found using the Key. Specifically, the process is as follows: All nodes under the AppendedToType category are searched in the data structure. The node with the name ObjectID and a value matching the passed ObjectID is found among all Object nodes. Under this node, the name of the AppendedMember node, which has the same Key, is found, and its value is returned. For example, if the passed Key is m_dTol and the ObjectID is 1, the found Value is 3.0, and this Value is returned to the object's member variable and assigned. The feature logic hierarchical data structure is represented as follows:

[0062]

[0063] The above-described feature logical hierarchical data structure can be described as follows: In this example, there are two feature objects with ObjectIDs of 1 and 2, and names Dimension and Line, respectively. The feature object with ObjectID 1 has two member variables named m_dTol and m_dNewTol, with values ​​of 3.0 and 1.0, respectively. The feature object with ObjectID 2 has one member variable named m_dLength, with a value of 3.3.

[0064] (3) Application scenarios.

[0065] When adding functionality to CAD software, it is usually necessary to add new member variables under feature objects. Previously, the existing member variables were saved to the document in a sequential stream. If a member variable is added to a feature object in the program, when opening an old document, because the code is executed sequentially, it is not easy to determine and identify whether the member variable exists in the sequential stream. This will cause the data read to be different from the corresponding member variable, resulting in misalignment and possibly causing the document to fail to open.

[0066] To better avoid the aforementioned situations, this embodiment uses the logical hierarchical approach of CAD software features to organize and construct data, which solves the problem of read data not being the corresponding member variable. For example, if a feature object Dimension has a member variable m_dTol, when adding a new member variable m_dNewTol under this feature object, it is only necessary to call the IO interface anywhere in the object's storage and read interfaces, passing in the feature object's ObjectID m_dNewTol, to save and restore the data, thus eliminating the need for the caller to consider data compatibility issues.

[0067] This invention provides a logical hierarchy for feature object data and stores it using a KeyValue model. It categorizes the stored feature object data by type and optimizes read / write efficiency through a fast ID lookup method. The logical classes of the feature object data provide simple and easy-to-use calling methods to support the data to be saved. This invention solves the problem that adding a feature object to a CAD document would change the entire feature object document version, improving compatibility across multiple versions of the feature object and reducing workload and development risks.

[0068] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0069] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for saving and opening multiple versions of CAD document feature object data, characterized in that, The method includes: Receive current instructions; If the current instruction is a document save instruction, then the document save operation will be performed on the CAD document; If the current instruction is a document open instruction, then the document open operation is performed on the CAD document; The document saving operation includes: For any feature object in the CAD document, save the feature object using the highest document version supported by the CAD program; For any feature object in the CAD document, obtain the Key, Value, and ObjectID of the feature object's member variables, and call the storage interface. Based on the ObjectID of the feature object, store the Key and Value of the feature object's member variables in the feature logic hierarchical data structure of the CAD software in Key-Value format, thereby realizing the storage of the feature object's member variables. Once all feature objects and all member variables of the feature objects in the CAD document have been saved, the CAD document is saved. The document opening operation includes: For any feature object in the CAD document, obtain the Key of the feature object's member variable and the ObjectID of the feature object, and call the read interface. Based on the ObjectID of the feature object, read the Value of the feature object's member variable corresponding to the Key of the feature object's member variable in the feature logic hierarchical data structure of the CAD software, thereby realizing the data recovery of the feature object's member variable. Once the member variables of all feature objects in the CAD document have been fully recovered, the CAD document can be opened. The storage interface is invoked, and based on the ObjectID of the feature object, the key and value of the feature object's member variables are stored in key-value pairs within the feature logic hierarchical data structure of the CAD software. This process of storing the member variables of the feature object includes: If a node with the same ObjectID as the feature object is found in the AppendedType category of the feature logic hierarchical data structure of the CAD software, an AppendedMember node named Key is created in that node, and the storage interface is called to write the Value of the member variable of the feature object into the attribute value of the AppendedMember node, thereby saving the member variable of the feature object. If a node with the same ObjectID as the feature object cannot be found in the AppendedType category of the feature logic hierarchical data structure in the CAD software, then a node with the same ObjectID as the feature object is created, and the storage interface is called to save the Key and Value of the feature object's member variables under the created node, thereby saving the member variables of the feature object.

2. The method for saving and opening multiple versions of CAD document feature object data according to claim 1, characterized in that, The system calls the read interface to retrieve the value of the member variable corresponding to the key of the feature object's member variable from the feature logic hierarchical data structure of the CAD software, based on the feature object's ObjectID. This enables data recovery of the feature object's member variable, specifically including: In the feature logic hierarchical data structure of the CAD software, find the node with the same category as the ObjectID of the feature object, call the read interface to read the value of the member variable of the feature object corresponding to the key of the member variable of the feature object in the found node, and realize the data recovery of the member variable of the feature object.

3. The method for saving and opening multiple versions of CAD document feature object data according to claim 1, characterized in that, The feature logic hierarchical data structure is an XML data structure.

4. The method for saving and opening multiple versions of CAD document feature object data according to claim 1, characterized in that, Both the storage interface and the read interface use the Context's IO interface.

Citation Information

Patent Citations

  • Document file processing method and system

    CN101165682A

  • Document redaction and reconciliation

    CN112069165A