A method for adding and outputting information attributes of a CAD-based three-dimensional model
By developing plugins and sorting algorithms in CAD, the automatic attachment of information attributes and output of detailed tables for 3D models were realized, solving the problems of model decomposition and information statistics in large-scale projects, and improving construction management efficiency and data security.
Patent Information
- Application Number
- CN202411294127.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2044-09-14
AI Technical Summary
Existing CAD software struggles to decompose 3D models to the unit level in large-scale projects, cannot automatically batch attach project information attributes, and cannot output detailed bills of quantities.
Develop a method for adding and outputting 3D model information attributes based on CAD. It enables automatic or manual attribute attachment of model units through plugins, and generates a detailed table using selection sorting algorithm and NPOI package file. It supports batch addition and output of custom attributes.
It enables the refinement of large-scale engineering models down to the smallest unit, automatically retrieves model information in batches, meets construction management requirements, improves information statistics efficiency, and enhances data security and compatibility.
Smart Images

Figure CN119418017B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of engineering BIM modeling, and particularly relates to a three-dimensional model information attribute adding and outputting method based on CAD. BACKGROUND
[0002] CAD (Autodesk Computer Aided Design) is the most widely used two-dimensional and three-dimensional engineering drawing software at present, Building Information Modeling (BIM) is rapidly developed on the basis of CAD, can integrate various types of information of the whole life cycle of engineering based on three-dimensional models, thereby assisting project management, and has become a key tool for digital transformation of the engineering industry. The most fundamental advantage of BIM compared with traditional CAD three-dimensional drawing is that the model can be connected to numerous engineering information attributes, while traditional CAD often only uses the layer (color) method to distinguish the model, cannot add model attributes, and does not have the function of batch outputting the detailed list such as the bill of quantities. For example, when the concrete quantity is counted, the volume needs to be inputted command by command for each component, and then the data is manually pasted into the table. When large-scale water conservancy and hydropower projects such as river dams and sluices or other large-scale construction models are constructed, the whole is generally built first and then cut to the smallest construction unit, and the number of components is often as many as several thousand, but Revit, the most widely used BIM software, does not have the function of cutting, which leads to the inability to finely decompose the model to the unit level, and cannot meet the requirements of construction management. Relatively speaking, the cutting function of CAD is more convenient, and the file format is more universal and compatible, therefore, a three-dimensional model information attribute adding and outputting method based on CAD is needed to solve the above problems. SUMMARY
[0003] The technical problem to be solved by the application is to provide a three-dimensional model information attribute adding and outputting method based on CAD, which is used to solve the problems of adding information attributes to CAD three-dimensional models and outputting attribute detailed lists, through the development of an information attribute management plug-in, the model units in CAD can automatically batch connect to engineering information attributes, or manually connect to any special attributes, and automatically output attribute detailed lists such as the bill of quantities, finally forming a construction information model, which is used for construction process management, and greatly improves the information statistical efficiency.
[0004] To achieve the above technical effects, the technical scheme adopted by the application is as follows:
[0005] A three-dimensional model information attribute adding and outputting method based on CAD, comprising the following steps:
[0006] S1, a three-dimensional model of a large-scale engineering whole is established in CAD, and the three-dimensional model is cut into a plurality of model units as objects of information attributes to form an initial construction model;
[0007] S2, a function module of adding custom attributes is developed by using a.NET open-source development platform, a C# language and a Winform window body, and any attribute and attribute value are manually added;
[0008] S3, a selection sorting algorithm is used to develop a module to add attributes in batches according to a preset rule of the model;
[0009] S4, a module of obtaining information of the model is developed to automatically and in batches call information attributes of the model;
[0010] S5, a module of obtaining custom attributes of the model is developed to call the custom attributes to be displayed in a CAD window body, so that all custom attribute information of the model can be quickly viewed to form a construction information model;
[0011] S6, a module of exporting a detail table is developed by using an NPOI package file to select attributes to output a detail table.
[0012] Preferably, in step S1, the model units are minimum construction unit models divided by units, parts, sub-items and processes in stages.
[0013] Preferably, in step S2, the any attribute and attribute value are custom attributes, and a data extension dictionary (ExtensionDictionary) in the CAD is used for storage.
[0014] Further, the extension dictionary inherits a DBDictionary object, and the DBDictionary is a container for storing non-graphic objects in the CAD; the dictionary exists in two ways, one is a NameDictionaries (named object dictionary) stored in a database to save data of the entire drawing, and the other is an ExtensionDictionary (object extension dictionary) stored in an object to save information data of the object; the data extension dictionary is used to store related attributes and attribute values, so that the attributes and attribute values can be saved in a DWG file of the CAD to prevent data loss.
[0015] Preferably, in step S2, the existence of the data extension dictionary of the entity is judged when the custom attribute is added, the DBObject object of the entity is obtained to perform an authority promotion function (UpgradeOpen), the extension dictionary of the entity is created (CreateExtensionDictionary), and after the creation, the object authority is degraded (DowngradeOpen).
[0016] Preferably, in step S3, the preset regular sequence is the x, y, z coordinate sequence of the mass center of the component in the space rectangular coordinate system; after selecting the x direction, y direction or z direction on the plug-in interface, the entities are sorted in ascending order according to the xyz direction by an algorithm, and the basis is the mass center coordinates of the entities.
[0017] Preferably, in step S3, the sorting algorithm includes a CAD built-in API method, converts the entity (Entity) into a 3D solid (Solid3d) using the as keyword, reads the mass center attribute of the entity, sorts the ObjectIds of the selected entities, and sorts them using the selection sorting algorithm.
[0018] Further, most entities in CAD are regular, and the mass center will not deviate to the outside of the entity, and will not affect the mass center coordinate component, so the sorting can be performed by this method.
[0019] Preferably, in step S3, the batch attribute addition is realized by a self-defined function AddDictionaryItem, and the specific method is as follows:
[0020] Get the entity DBObject object, open its write mode (OpenMode.ForWrite);
[0021] Create an Xrecord record, and store the attribute in the temporary List list through the key-value pair;
[0022] The values in the list are transmitted to the dictionary using the SetAt function, and then created into the database (AddNewlyCreatedDBObject), and the batch attribute addition is completed.
[0023] Preferably, in step S4, the built-in information of the model is the volume, area and coordinate information that the model carries after being established; taking the model volume as an example, the volume information of the entity is read through the CAD built-in function by obtaining the ObjectId of the entity, and is hung with the entity ID (ObjectId) to assist the engineering quantity list accounting work.
[0024] The method for calling the model information is as follows:
[0025] First, the transaction object (Transaction) is obtained through the transaction mode of CAD, and the selected Object object is converted into a readable entity (Entity) and 3D solid (Solid3D) through the function (GetObject) of the transaction object, and then the entity ID is obtained through the ObjectId of the entity, and the volume information is obtained through the Volume in the MassProperties attribute of the 3D solid.
[0026] Preferably, in step S5, the execution method of the model custom attribute module is:
[0027] Through the CAD built-in API method, the GetDictionaryFirstString function is used to obtain the ObjectId of the entity, and then the DBObject object is obtained through the ObjectId, so as to open the data dictionary to read the attribute;
[0028] The custom attribute can be modified and deleted; the modification is replaced by inputting a new attribute through the custom function SetDictionaryItem function, and the deletion is deleted through the custom function DeleteKeyValue function; the above two custom functions use the DBObject of the entity to operate the data expansion dictionary thereof;
[0029] The construction information model is a model obtained by refining and splitting the construction detail design model to the process, and extending the attribute and giving the construction information, which is used for construction management and digital delivery.
[0030] Preferably, in step S6, the detail table is a detail table composed of entity ID, custom attribute and attribute value and entity volume attribute; and the method for exporting the detail table is:
[0031] The detail table is created through NPOI and system I / O package method;
[0032] The information read from the CAD is integrated into the DataTable, then the IWorkbook is created through the method in the NPOI package, and the data is written, finally the detail table is saved and output through the system I / O package.
[0033] The beneficial effects of the present application are as follows:
[0034] 1. The present application avoids the defect that Revit software cannot be cut, uses CAD modeling and cutting, reduces the quality threshold of modeling personnel, has stronger format universality and compatibility, and enables large-volume engineering models to be refined to the smallest model unit.
[0035] 2. The present application can automatically batch retrieve model volume, area and other built-in information attributes, and assist in engineering quantity list accounting work.
[0036] 3. The present application can batch connect any information attribute to the CAD model unit to meet the requirements of construction management.
[0037] 4. The present application batch outputs information attribute detail table to reduce a large amount of information statistics work.
[0038] 5, XData data storage is limited, generally 16kb, however, the extended dictionary of the application can reach 2GB of data storage by using Xrecord data extension record. The custom attribute is hung in the data dictionary instead of XData, which cannot be read by the CAD built-in command, and can store multiple attribute key value pairs, greatly improving the data security and diversity. BRIEF DESCRIPTION OF DRAWINGS
[0039] Figure 1 The project flowchart of the application based on CAD three-dimensional model information attribute management plug-in;
[0040] Figure 2 The effect diagram after the dam body is cut and layered;
[0041] Figure 3 The operation schematic diagram of the application using manual input to hang a single attribute to the entity;
[0042] Figure 4 The operation schematic diagram of the application using automatic import of custom attributes;
[0043] Figure 5 The schematic diagram of the application for viewing the custom attributes of the selected entity;
[0044] Figure 6 The operation schematic diagram of the application for exporting the information of the selected entity. DETAILED DESCRIPTION
[0045] Embodiment one:
[0046] As shown in Figure 1 A CAD-based three-dimensional model information attribute adding and output method, comprising the following steps:
[0047] S1, a large amount of engineering whole three-dimensional model is established in CAD, and the three-dimensional model is cut into several model units as the object of information attribute addition, forming an initial construction model;
[0048] S2, using.NET open source development platform, C# language and Winform window form, the adding custom attribute function module of the plug-in is developed, and any attribute and attribute value is manually added;
[0049] S3, using selection sorting algorithm, the module is developed to add attributes in batch according to the preset order of the model;
[0050] S4, the model built-in information module is developed to automatically batch call the built-in information attribute of the model;
[0051] S5, a model acquisition module is developed to customize attributes, which are displayed in a CAD window, so as to quickly check all the customized attribute information of the model, and form a construction information model;
[0052] S6, an export detail table module is developed by using an NPOI package file to select attribute output detail tables.
[0053] Preferably, in step S1, the model unit is the smallest construction unit model divided by unit, division, sub-item and process.
[0054] Preferably, in step S2, the arbitrary attribute and attribute value are customized attributes, which are stored by using a data extension dictionary (ExtensionDictionary) in CAD.
[0055] Further, the extension dictionary inherits a DBDictionary object, which is a container for storing non-graphic objects in CAD; the dictionary exists in two ways, one is a NameDictionaries (named object dictionary) stored in a database to save the data of the entire drawing, and the other is an ExtensionDictionary (object extension dictionary) stored in an object to save the information data of the object; the related attribute and attribute value are stored by using the data extension dictionary, which can be saved in the DWG file of the CAD to prevent data loss.
[0056] Preferably, in step S2, the existence of the data extension dictionary of the entity is judged when the customized attribute is added, the DBObject object of the entity is obtained to perform an authority upgrade function (UpgradeOpen), the extension dictionary of the entity is created (CreateExtensionDictionary), and the object authority is downgraded (DowngradeOpen) after the creation.
[0057] Preferably, in step S3, the preset regular order is the x, y and z coordinate order of the centroid of the component in a space rectangular coordinate system; after the method of selecting the x direction, y direction or z direction in the plug-in interface, the entity is sorted from small to large according to the xyz direction by an algorithm, and the basis is the centroid coordinate of the entity.
[0058] Preferably, in step S3, the sorting algorithm includes a built-in API method of CAD, the entity (Entity) is converted into a 3D entity (Solid3d) by using the as keyword, the centroid attribute of the entity is read, the ObjectId of the selected entity is sorted, and the selection sorting algorithm is used for sorting.
[0059] Further, most of the entities in CAD are regular, and the mass center will not deviate to the outside of the entity, and will not affect the mass center coordinate component, so the sorting can be performed by the method.
[0060] Preferably, in step S3, the attribute is added in batches by a self-defined function AddDictionaryItem, and the specific method is as follows:
[0061] An entity DBObject object is obtained, and its write mode (OpenMode.ForWrite) is opened;
[0062] An Xrecord record is created, and the attribute is stored in a temporary List list through a key-value pair;
[0063] The values in the list are transmitted to the dictionary using the SetAt function, and then created into the database (AddNewlyCreatedDBObject), thereby completing the batch attribute addition.
[0064] Preferably, in step S4, the model built-in information is the volume, area and coordinate information automatically provided after the model is established; taking the model volume as an example, the volume information of the entity is read through the built-in function of CAD by obtaining the ObjectId of the entity, and the entity ID (ObjectId) is hung up, thereby assisting the accounting work of the bill of quantities.
[0065] The method for calling the model information is as follows:
[0066] First, the transaction object (Transaction) is obtained through the transaction mode of CAD, and the selected Object object is converted into a readable entity (Entity) and 3D solid (Solid3D) through the function (GetObject) for obtaining the Object object through the transaction, and then the entity ID is obtained through the ObjectId of the entity, and the volume information is obtained by reading the Volume in the MassProperties attribute of the 3D solid.
[0067] Preferably, in step S5, the execution method for calling the model custom attribute module is as follows:
[0068] Through the built-in API method of CAD, the GetDictionaryFirstString function is used, the ObjectId of the entity is obtained, the DBObject object is obtained through the ObjectId, and then the data dictionary is opened to read the attribute;
[0069] The custom attribute can be modified and deleted; the modification is replaced by the custom function SetDictionaryItem function by inputting a new attribute, and the deletion is deleted by the custom function DeleteKeyValue function; both of the above two custom functions use the DBObject of the entity to operate the data expansion dictionary of the entity;
[0070] The construction information model is a model obtained by refining and splitting the construction detail design model to the process, and then extending the attributes and giving the construction information, which is used for construction management and digital delivery.
[0071] Preferably, in step S6, the detail table is a detail table composed of entity ID, custom attribute and attribute value, and entity volume attribute; the method for exporting the detail table is:
[0072] The detail table is created by NPOI and system I / O package method;
[0073] The information read from CAD is integrated into DataTable, then IWorkbook is created by the method in NPOI package and the data is written, finally the detail table is saved and output by the system I / O package.
[0074] Example two:
[0075] A CAD-based three-dimensional model information attribute adding and output method, taking a large arch dam as an example, includes the following steps:
[0076] S1, modeling and decomposition:
[0077] As shown in Figure 2 , a three-dimensional model of a large arch dam is established by using CAD, the arch dam is segmented and layered according to the unit-subsection-unit (process) engineering division standard and construction scheme, and the arch dam is divided into several unit (process) engineering models.
[0078] The unit-subsection-unit (process) engineering division standard refers to the engineering division tree structure formed by the supervision or owner's approval before the project starts, which is used for quality evaluation and other construction management processes. The unit and subsection engineering are generally determined in the design document, and the unit engineering is determined according to the construction measures, which is the smallest unit of construction management.
[0079] The unit (process) engineering model is the basic object of construction information attribute input, delivery and management.
[0080] S2, develop a CAD-based information attribute input plug-in:
[0081] A program for adding and outputting information attributes of three-dimensional model based on Autodesk AutoCAD is written by C# language.
[0082] S3, manually or automatically inputting information attributes:
[0083] The model after modeling and decomposition in S1 is imported into CAD, and the plug-in in S2 is loaded. Manually inputting information attributes in the plug-in is to input custom attribute name and attribute value in the input box in the custom attribute module, click Add to Entity, and finally select the entity in CAD to complete attribute hanging; automatically inputting information attributes is to use Excel to import attributes (divided into x, y, and z directions) in the custom attribute module, and select the corresponding entity to complete automatic import.
[0084] The manual input method is to hang on a single entity after inputting in the text box; input the name and value to be hung in the custom attribute box on the left side of the plug-in interface, click the Add to Entity button, and select the entity to complete the manual input information operation. The characters input in the text box are converted to string type and saved to the data dictionary of the entity;
[0085] As shown in Figure 3 , the automatic input method is to select multiple entities in CAD that need to be hung with attributes, select the way to import by selecting Excel import attributes (select one of x, y, and z directions), then read the Excel table data, and hang the data in the table with the selected entities one by one. Table 1 is the custom attribute data imported by some dam section.
[0086] ;
[0087] Table 1: Custom attribute data imported by some dam section;
[0088] As shown in Figure 4 , S4, call data plug-in (for example, call custom attribute data):
[0089] In the custom attribute display module of the plug-in, click the Select Entity button and select the entity to be viewed in CAD, and the custom attributes of the entity will be displayed in the table, and the ID and volume below will also be displayed.
[0090] As shown in Figure 5 , the custom attributes are displayed in the table. If the selected entity has no custom attributes, the system will prompt that there are no attributes, but the ID and volume of the CAD entity will still be displayed;
[0091] In the custom attribute display module, the custom attribute can be modified and deleted; in the table, the attribute value can be modified by clicking the modification button, and the attribute can be deleted by clicking the delete button of a certain row attribute; if multiple entities are selected and then the multiple delete button is clicked, all the added attributes of the selected entities can be deleted.
[0092] As shown in Figure 6 S5, automatically output the information attribute details:
[0093] At the bottom of the plug-in, there is an "export details table" button. The model can be rotated to a relatively appropriate angle for selection, and then the button can be clicked to export the selected entity information to an Excel table outside the CAD, completing the export operation.
[0094] Preferably, the cut CAD entity is classified by layer in step S1, which facilitates subsequent convenient management and selection operation.
[0095] ;
[0096] Table 2: Data exported by the export details table after cutting a certain dam section;
[0097] The export details table is an Excel table, and the column attributes are entity ID, entity volume, and custom attribute name and attribute value. Table 2 is the data exported by the export details table after cutting a certain dam section.
Claims
1. A CAD-based three-dimensional model information attribute adding and output method, characterized by, It comprises the following steps: S1, a three-dimensional model of the whole project is established in CAD, and the three-dimensional model is cut into several model units as objects for adding information attributes, forming an initial construction model; S2, manually add any attribute and attribute value through the addition of custom attribute function module developed by plug-in; S3, use selection sort algorithm to develop module to add attributes in batch according to the preset order of the model; S4, develop a module to automatically batch retrieve the built-in information attributes of the model; S5, develop a module to retrieve custom attributes of the model and display them in the CAD window, which facilitates quick viewing of all custom attribute information of the model, forming a construction information model; S6, use NPOI package file to develop an export detail table module to select attributes and output a detail table.
2. The method of claim 1, wherein, In step S1, the model unit is the smallest construction unit model divided by unit, division, sub-item and process.
3. The method of claim 1, wherein the CAD-based three-dimensional model information attribute adding and output method is characterized by, In step S2, any attribute and attribute value is a custom attribute, which is stored using the data extension dictionary inside CAD.
4. The method of claim 3, wherein the CAD-based three-dimensional model information attribute adding and outputting method is characterized by, In step S2, when adding custom attributes, the existence of the data extension dictionary of the entity is judged, the permission elevation function is obtained through the DBObject object of the entity, the creation of the extension dictionary of the entity is completed, and the object permission is downgraded after the creation.
5. The method of claim 1, wherein the CAD-based three-dimensional model information attribute adding and output method is characterized by, In step S3, the preset order is the x, y, z coordinate order of the centroid of the component in the space rectangular coordinate system; after selecting the x direction, y direction or z direction in the plug-in interface, the entities are sorted from small to large according to the xyz direction through algorithm, and the basis is the centroid coordinate of the entity.
6. The method of claim 1, wherein, In step S3, the sorting algorithm includes the built-in API method of CAD, the entity is converted into a 3D entity using the as keyword, the centroid attribute of the entity is read, the ObjectId of the selected entity is sorted, and the selection sort algorithm is used for sorting.
7. The method of claim 1, wherein the CAD-based three-dimensional model information attribute adding and output method is characterized by, In step S3, the batch attribute adding is realized through a custom function, and the specific method is: Get the entity DBObject object, open its write mode; Create an Xrecord record and store the attributes in a temporary List list through key-value pairs; The values in the list are transmitted to the dictionary using the SetAt function, and then created into the database, completing the batch attribute addition.
8. The method of claim 1, wherein the CAD-based three-dimensional model information attribute adding and output method is characterized by, In step S4, the built-in information of the model is the volume, area and coordinate information of the model after the model is established; the method for retrieving the model information is: First, get the transaction object through the transaction mode of CAD, and convert the selected Object object into a readable entity and 3D solid through the function of getting the Object object, then get the entity ID through the ObjectId of the entity, and get the volume information through the Volume in the MassProperties attribute of the 3D solid.
9. The method of claim 1, wherein the CAD-based three-dimensional model information attribute adding and output method is characterized by, In step S5, the execution method of the model custom attribute module is: Through the CAD built-in API method, the GetDictionaryFirstString function is used to obtain the ObjectId of the entity, and then the ObjectId is used to obtain the DBObject object, so as to open the data dictionary to read the attribute; The custom attribute can be modified and deleted; the modification is replaced by inputting a new attribute through the custom function SetDictionaryItem function, and the deletion is performed through the custom function DeleteKeyValue function; the above two custom functions use the entity DBObject to operate the data expansion dictionary; The construction information model is a model that is refined and split into processes on the basis of the construction detail design model, and is assigned with construction information after attribute expansion, and is used for construction management and digital delivery.
10. The method of claim 1, wherein the CAD-based three-dimensional model information attribute adding and output method is characterized by, In step S6, the detail table is composed of entity ID, custom attribute and attribute value, and entity volume attribute; the method for exporting the detail table is: The detail table is created through NPOI and system I / O package methods; The information read from the CAD is integrated into the DataTable, and then the method in the NPOI package is used to create IWorkbook and write data, and finally the system I / O package is used to save and output the detail table.
Citation Information
Patent Citations
Data model transmission method and device between Revit and AutoCAD
CN114692238A
Concrete dam construction simulation progress dynamic visualization method based on same data source
CN116628798A