A Parts List Extraction Method Based on ObjectARX
By using ObjectARX technology in AutoCAD, the parts list in the drawings of the LNG ship cargo hold containment system is quickly extracted, which solves the time-consuming and labor-intensive problem of parts statistics in the existing technology, achieves rapid and accurate extraction of the parts list, and improves work efficiency. .
Patent Information
- Application Number
- CN202210595643.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-27
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2042-05-27
AI Technical Summary
During the design and construction of LNG cargo hold enclosure system, it is difficult for the existing technology to quickly and accurately extract parts lists from drawings, which makes it time-consuming and labor-intensive to count parts inventory and procurement, and is prone to omissions.
Using a method based on ObjectARX, the main program is loaded in AutoCAD, and through the processing of selection sets and block definition IDs, part and plate information is quickly extracted, summarized and stored in the MFC list control, and exported as txt text.
It realizes the rapid extraction of parts list, saves calculation time, improves work efficiency, and prevents omissions in parts statistics, which is of great significance to the design and construction of LNG ships.
Smart Images

Figure CN114969974B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a parts list extraction method, in particular to a parts list fast extraction method based on ObjectARX. Background Art
[0002] As a high value-added special ship, LNG carrier has been vigorously developed in recent years. In the construction process of LNG carrier, the cargo hold containment system is the key to its construction. In the construction of this type of cargo containment system, a special construction and installation platform must be used to install the cargo hold screen in the cabin space.
[0003] During the design and construction of the enclosure system installation platform, it is very important to extract data from the parts layout drawing. In actual projects, it is often necessary to count the use of parts and plates in the drawings. For the parts in the drawings, it is necessary to obtain the names of the parts used and the number of each part used to count the parts inventory and parts procurement. For the plates, in addition to counting the size and quantity of the plates, it is also necessary to count the total area of all the plates in the drawings. In the previous statistical process, engineers needed to search for single-line text of the part name in the drawings and count the search results in software such as Excel. The whole process is time-consuming and labor-intensive, and requires that the part number must be inserted into the drawing in the form of a single-line text. In addition, the part statistics are too dependent on the inserted part name, which may result in omissions. Summary of the invention
[0004] Purpose of the invention: The purpose of the present invention is to provide a method for quickly extracting a parts list based on ObjectARX.
[0005] Technical solution: The method of the present invention comprises the following steps:
[0006] (1) Load the main program in AutoCAD and run it using the APPLOAD command;
[0007] (2) Create a selection set to obtain the selected entity object combination;
[0008] (3) Traverse the selection set and determine whether the object in the selection set is a block reference. If yes, proceed to the next step. If not, delete the object from the selection set.
[0009] (4) Traverse the selection set, query the block definition referenced by each block reference object, and save the block definition ID into the ObjectIdArray array;
[0010] (5) Count the ObjectIdArray array and delete duplicate items, obtain the block definition pointer according to the object ID, and then obtain the block definition name and save it in the NameArray array;
[0011] (6) Extract the plate name in the NameArray array and calculate the plate area;
[0012] (7) All parts and plate information are summarized and stored in the MFC list control, and the table is exported as txt text.
[0013] Furthermore, in the step (1), the main program uses the MFC class so that the program interface style is highly consistent with the AutoCAD interface.
[0014] Furthermore, the specific method for determining the object category in the selection set in step (3) is as follows: calling the selection set filter, traversing the selection set objects, and filtering the class corresponding to the selected entity object through the isKindOf function, leaving only the entity object created by the block reference AcDbBlockReference class.
[0015] Furthermore, the ObjectIdArray array in step (4) is an object created by the AcDbObjectIdArray class.
[0016] Furthermore, in step (5), the array is counted and duplicates are deleted using a "bubble sort" algorithm.
[0017] Furthermore, the method for extracting the plate name in step (6) is as follows: traverse the array to determine whether the members in the array contain the "×" character string. If so, the character string is the plate name. The plate area calculation method is to identify the character strings before and after the "×" sign, and convert the character strings into double format and multiply them.
[0018] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages: it can help save tedious calculation time, thereby improving the efficiency of subsequent work and preventing omissions, which is of great significance to the design and construction of LNG ships. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0020] The technical solution of the present invention is further described below in conjunction with the accompanying drawings.
[0021] The present invention utilizes ObjectARX to perform secondary development on AutoCAD, and can quickly output a list of parts and consumables of a drawing in a dwg format in which parts are inserted and arranged in a block manner, thereby facilitating the purchase and inventory update of parts.
[0022] like Figure 1 As shown, the method of the present invention comprises the following steps:
[0023] (1) Load the main program in AutoCAD and run it through the APPLOAD command; the main program interface is created by MFC and uses the MFC class in ObjectARX, so that the program interface style is highly consistent with the AutoCAD interface and can adapt to different operating system interface styles. The program can automatically load the .arx program by setting the acad2021.lsp file in the Support file in the AutoCAD installation directory. After loading is complete, type "list extraction" in the command line to wake up the main program interface.
[0024] (2) Create a selection set, that is, use the acedSSGet function through ObjectARX to create a selection set and obtain the selected entity object combination.
[0025] (3) Traverse the selection set to determine whether the object in the selection set is a block reference. If so, proceed to the next step. If not, delete the object from the selection set. Call the selection set filter, traverse the selection set, obtain the object pointer through the object ID of the selection set and open the entity. Then, use the isKindOf function to filter the class corresponding to the selected entity object, leaving only the entity object created by the block reference AcDbBlockReference class.
[0026] (4) Traverse the selection set, query the block definition referenced by each block reference object, return the block name and other properties of the block definition, and save the block definition ID into the ObjectIdArray array; the ObjectIdArray array is an object created by the AcDbObjectIdArray class, and the array is used to store the ID of the block definition entity object.
[0027] (5) Count and delete duplicate items in the ObjectIdArray array, obtain the block definition pointer based on the object ID, and then obtain the block definition name (i.e., part or plate name) and save it in the NameArray array; the “bubble sort” algorithm is used to count and delete duplicate items in the ObjectIdArray array. The specific ideas are as follows:
[0028] The first loop is from 0 to len-1. When i is 0, the second loop is from j to i+1, that is, from 1 to len-1. It checks whether num[i] and num[j] are equal. If they are equal, it enters the third loop, k is from j+1 to len-1, and all elements after the repeated point j are moved forward by 1, and the array length is len-1, j-1.
[0029] (6) Extract the plate name from the NameArray array and calculate the plate area. The method for extracting the plate name is to traverse the array and determine whether the members in the array contain the "×" string. If so, it is the plate name (the plate naming rule is "plate length × plate width"). The method for calculating the plate area is to identify the strings before and after the "×" sign, convert them into double format, and perform multiplication calculation.
[0030] (7) All parts and plate information are summarized and stored in the MFC list control, and the table is exported as txt text through the list control.
Claims
1. A parts list extraction method based on ObjectARX, characterized by: The method comprises the following steps: (1) Load the main program in AutoCAD and run it using the APPLOAD command; (2) Create a selection set to obtain the selected entity object combination; (3) traverse the selection set and determine whether the object in the selection set is a block reference. If yes, proceed to step (4). If not, delete the object from the selection set. (4) Traverse the selection set, query the block definition referenced by each block reference object, and save the block definition ID into the ObjectIdArray array; (5) Count the ObjectIdArray array and delete duplicate items, obtain the block definition pointer according to the object ID, and then obtain the block definition name and save it in the NameArray array; (6) Extract the plate name in the NameArray array and calculate the plate area; (7) All parts and plate information are summarized and stored in the MFC list control, and the table is exported as txt text.
2. The method for extracting a parts list based on ObjectARX according to claim 1, characterized in that: In the step (1), the main program uses the MFC class to ensure that the program interface style is highly consistent with the AutoCAD interface.
3. The method for extracting a parts list based on ObjectARX according to claim 1, characterized in that: The specific method for determining the object category in the selection set in the step (3) is as follows: calling the selection set filter, traversing the selection set objects, and filtering the class corresponding to the selected entity object through the isKindOf function, leaving only the entity object created by the block reference AcDbBlockReference class.
4. The method for extracting a parts list based on ObjectARX according to claim 1, characterized in that: The ObjectIdArray array in step (4) is an object created by the AcDbObjectIdArray class.
5. The method for extracting a parts list based on ObjectARX according to claim 1, characterized in that: In step (5), the array is counted and duplicates are deleted using a "bubble sort" algorithm.
6. The method for extracting a parts list based on ObjectARX according to claim 1, characterized in that: The method for extracting the plate name in step (6) is as follows: traverse the array to determine whether the members in the array contain the "×" character string. If so, the character string is the plate name. The method for calculating the plate area is to identify the character strings before and after the "×" sign, and convert the character strings into double format and multiply them.
Citation Information
Patent Citations
CAD (computer-aided design) drawing information batch processing method based on ObjectArx
CN102830979A
Method for automatically obtaining amount of batch outfititem jacking parts
CN105653761A