Method, device and medium for extracting bill of materials and title information from CAD
By applying NLP and text analysis algorithms in CAD files, the problem of low entry efficiency of bill of materials and title information in the prior art is solved, and the rapid and accurate BOM generation of ERP system is achieved, which reduces maintenance costs and provides experience in MES format file generation.
Patent Information
- Application Number
- CN202510703807.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-05-29
AI Technical Summary
In the prior art, the entry of the bill of materials and title information from CAD files to the ERP system is inefficient and difficult to ensure accuracy, especially when the BOM template is not standardized.
The dictionary matching and rule matching algorithm in natural language processing (NLP) and text analysis is used to extract the INSERT insertion object and ATTRIB attribute object from the drawing object list of CAD files, and BOM and title information are extracted through preset rules or dictionary matching algorithms.
It realizes fast and accurate automatic material list and title information extraction from CAD files to ERP systems, reduces the cost and difficulty of ERP's BOM maintenance, and provides experience in generating format files required for quality management in MES.
Smart Images

Figure CN120235144B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of material statistics, and in particular to a method, device and medium for extracting material lists and title information in CAD. Background Art
[0002] In an existing CAD file drawing, the bill of materials and title information are given in the lower right corner. Currently, when most companies use ERP (Enterprise Resource Planning) systems, the bill of materials (BOM) and title are mainly entered in the following two ways:
[0003] 1. Manually create BOM based on CAD files and import it into ERP system;
[0004] 2. Export the BOM using the built-in function of CAD and then import it into the ERP system according to the BOM template requirements of ERP.
[0005] In the existing technology, the first method is very inefficient and difficult to guarantee accuracy; Chinese patent publication number CN111914315A discloses a CAD-based bill of materials statistics method and system, which uses the second method to perform material statistics. However, the BOM exported from CAD is extremely dependent on the accuracy of the BOM template when converting it to the BOM template required by ERP. When the user does not mark the BOM information in a standardized manner, the BOM information cannot be collected and obtained through the preset BOM template, and the collection process is inefficient and error-prone. Summary of the Invention
[0006] Technical purpose: In response to the defects in the existing technology, the present invention discloses a method, device and medium for extracting bill of materials and title information from CAD. It makes full use of the dictionary matching and rule matching algorithms in natural language processing (NLP) and text analysis to perfectly solve the pain point of manually entering BOM during the use of ERP (enterprise resource management) system.
[0007] Technical solution: In order to achieve the above technical objectives, the present invention adopts the following technical solution.
[0008] A method for extracting bill of materials and title information in CAD, the method comprising:
[0009] Extract the INSERT object and ATTRIB object from the drawing object list of the CAD file as the filtering data; the INSERT object has no data inside, and the ATTRIB object includes the tag attribute and the value attribute, wherein the tag attribute is the attribute name of the ATTRIB object, and the value attribute is the attribute data of the ATTRIB object;
[0010] Extract BOM and title information from filtered data through preset rule matching algorithm. If the extraction is successful, the BOM and title information will be output; if the extraction fails, the following will be performed:
[0011] Extract BOM and title information from filtered data according to the preset dictionary matching algorithm and output BOM and title information.
[0012] An electronic device comprises: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the electronic device performs the above-mentioned method of extracting bill of materials and title information in CAD.
[0013] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the above-mentioned method for extracting bill of materials and title information in CAD.
[0014] Beneficial effects: The present invention makes full use of the dictionary matching and rule matching algorithms in natural language processing (NLP) and text analysis, and perfectly solves the pain point of manually entering BOM during the use of the ERP (Enterprise Resource Management) system; the BOM format required by ERP can be automatically generated in a timely and rapid manner through CAD files, reducing the BOM maintenance cost and difficulty of use of ERP; at the same time, it provides experience for using natural language processing (NLP) to extract information such as dimensions from CAD files and directly generate the format files required for quality management in ERP (Enterprise Resource Management) and MES (Manufacturing Execution Management). BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 Extract the main flow chart for BOM and header information;
[0016] Figure 2 Schematic diagram of filtering out a list of key objects for extracting information;
[0017] Figure 3 Schematic diagram of grouping attribute sequences for dictionary matching;
[0018] Figure 4 Schematic diagram of splitting and grouping attribute sequences for dictionary matching;
[0019] Figure 5 Schematic diagram of sorting the set of dictionary matching attribute sequences;
[0020] Figure 6 Extract sub-main flow chart for rule matching;
[0021] Figure 7 Extract BOM information sub-main flow chart for rule matching;
[0022] Figure 8 Extract title information sub-main flow chart for rule matching;
[0023] Figure 9 Extract sub-main flow chart for dictionary matching;
[0024] Figure 10 Extract BOM field value sub-flowchart for dictionary matching;
[0025] Figure 11 Extract BOM field value sub-flowchart from sequence set for dictionary matching;
[0026] Figure 12 Matching attribute sequence fields for dictionary matching sub-flowchart;
[0027] Figure 13 Sub-flowchart of the algorithm for extracting the value of the title field for dictionary matching. DETAILED DESCRIPTION
[0028] In order to help those skilled in the art better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0029] Example
[0030] As attached Figure 1 As shown, a method for extracting bill of materials and title information in CAD files in this embodiment is applied to the field of material statistics of CAD files, including the following steps:
[0031] Step 1: Extract the INSERT object and ATTRIB object from the drawing object list of the CAD file as filtering data;
[0032] The drawing object list in a CAD file contains data representing different objects, such as Layer, Line, Insert, and Attribute. However, the Bill of Materials (BOM) and title information are both contained in the ATTRIB and separated by INSERT. Therefore, in this embodiment, to extract the BOM and title information, it is necessary to filter out the INSERT and ATTRIB objects as filter data for subsequent processing. In this invention, the title information includes information such as the drawing number, drawing name, and drawing version, and the BOM includes product part information, etc.
[0033] An INSERT object contains no data. An ATTRIB object contains a tag attribute and a value attribute. The tag attribute is the attribute name of the ATTRIB object, and the value attribute is the attribute data of the ATTRIB object. For example, in a CAD file, the tag attribute of an ATTRIB object is the quantity, and its value attribute is 2. Testing and verification have shown that BOMs are generally stored in adjacent ATTRIB objects. To improve subsequent processing efficiency, the CAD file is read and CAD file objects that are not useful for BOM and title information extraction are filtered out. Only two key objects, INSERT objects and ATTRIB objects, are retained as filtered data for subsequent processing.
[0034] For the convenience of description, the INSERT objects and ATTRIB attribute objects in the filtered data are numbered in sequence, such as Figure 2 As shown, there are 64 INSERT objects and ATTRIB attribute objects. Serial numbers 0, 12, 13, 16, 24, 32, 40, 48, 52, 56, and 61 are INSERT objects, and the remaining serial numbers, such as 1, 2, 3, ..., are ATTRIB attribute objects.
[0035] Step 2: Extract BOM and title information from the filtered data through a preset rule matching algorithm. If the extraction is successful, the BOM and title information are output. If the extraction fails, proceed to step 3.
[0036] like Figure 6 As shown, extracting BOM and title information from filtered data through a preset rule matching algorithm includes the following steps:
[0037] Step 21. Preset a rule configuration file, which defines several title extraction fields of the title information and several material extraction fields of the BOM. In this embodiment, the title extraction fields include "drawing code", "drawing name", and "version number", and the material extraction fields include "serial number", "code", "name", "quantity", "material", "unit weight", "total weight", "remarks", and "material code". The title extraction fields and material extraction fields include necessary fields and non-essential fields. Necessary fields are defined as fields that must be extracted, that is, if the field is not extracted during the extraction process, the extraction failure will be fed back. Non-essential fields are fields that do not have to be extracted, that is, if the field is not extracted during the extraction process, no feedback will be given. In this embodiment, "drawing code", "drawing name", "serial number", "code", and "name" are defined as necessary fields, and "version number", "quantity", "material", "unit weight", "total weight", "remarks", and "material code" are defined as non-essential fields.
[0038] There can be several rule configuration files. In this embodiment, the rule configuration files include a first basic rule configuration file and a second extended rule configuration file. The first basic rule configuration file defines general rule information, such as defining several title extraction fields of title information and several material extraction fields of BOM; the second extended rule configuration file defines extended rule information, that is, user-specific rule requirements. For example, for the needs of a certain type of enterprise users, the extended rule information is that the extracted "drawing code" field must be preceded by an INSERT insertion object, and the extracted "drawing code" field must be followed by an ATTRIB attribute object.
[0039] In this embodiment, the first basic rule configuration file is as follows:
[0040] <?xml version="1.0" encoding="utf-8"?>
[0041] <fields>
[0042] <field key="drawing-code" name="图样代号" required="true" / >
[0043] <field key="drawing-name" name="图样名称" required="true" / >
[0044] <bom>
[0045] <field key="sequence" name="序号" required="true" / >
[0046] <field key="code" name="代号" required="true" / >
[0047] <field key="name" name="名称" required="true" / >
[0048] <field key="material" name="材料" / >
[0049] <field key="material-code" name="物料编码" / >
[0050] <field key="quantity" name="数量" / >
[0051] <field key="weidget" name="单重" / >
[0052] <field key="tatal-weidget" name="总重" / >
[0053] <field key="comments" name="备注" / >
[0054] < / bom>
[0055] < / fields>
[0056] The second extended rule configuration file is as follows:
[0057] <?xml version='1.0' encoding='utf-8'?>
[0058] <schema encoding="GB2312">
[0059] <Object tag="Drawing number" key="drawing-code" object="ATTRIB"
[0060] object-before="INSERT,ATTRIB,ATTRIB" object-after="" / >
[0061] [[ID=,8]] <object tag="产品名称" key="drawing-name" object="ATTRIB" object-before="" object-after="">< / object>
[0062] <bom>
[0063] <object object="INSERT">< / object>
[0064] <object tag="序号" key="sequence" object="ATTRIB">< / object>
[0065] <object tag="代号" key="code" object="ATTRIB">< / object>
[0066] <object tag="名称" key="name" object="ATTRIB">< / object>
[0067] <object tag="数量" key="quantity" object="ATTRIB">< / object>
[0068] <object tag="材料" key="material" object="ATTRIB">< / object>
[0069] <object tag="单重" key="weidget" object="ATTRIB">< / object>
[0070] <object tag="总重" key="tatal-weidget" object="ATTRIB">< / object>
[0071] <object tag="备注" key="comments" object="ATTRIB">< / object>
[0072] <object tag="物料编码" key="material-code" object="ATTRIB">< / object>
[0073] < / bom>
[0074] < / schema>
[0075] The second extension rule configuration file defines the preceding object type list [object-before] and the following object type list [object-after].
[0076] Step 22: After filtering the data through the rule configuration file, the BOM information extraction sub-process is entered. If the BOM information extraction is successful, the title information extraction sub-process is entered. If the BOM information extraction fails, the extraction failure information is returned. If the title information extraction is successful, the extraction success information is returned and the BOM and title information are output. If the title information extraction fails, the extraction failure information is returned.
[0077] Step 23: Return the extraction failure information and go to step 3.
[0078] Figure 7 This is the BOM extraction sub-flowchart. In the BOM information extraction sub-flow, the BOM list used for initialization return is empty. After filtering the data and traversing the rule configuration file, if the tag attribute of the ATTRIB attribute object is the same as the material extraction field in the rule configuration file, the match is judged to be successful, and the value attribute of the ATTRIB attribute object is extracted to form a BOM row object, which is appended to the BOM list until all filtered data are traversed and the BOM list is output.
[0079] Figure 8 This is the sub-flow chart for title extraction. In the sub-flow of title extraction, the steps are as follows:
[0080] Step 221: filter the data traversal rule configuration file and initialize the matching action counter to 0.
[0081] Step 222: Determine whether the title extraction field in the title extraction field list has been extracted. If so, proceed to step 225; if not, proceed to step 223.
[0082] Step 223: The matching action counter is incremented by 1.
[0083] Step 224: Determine whether the tag attribute of the ATTRIB attribute object matches the title extraction field in the rule configuration file. If so, extract the value attribute of the ATTRIB attribute object, mark the title extraction field as extracted, and return to step 222. If not, return to step 222.
[0084] Step 225: After all the title extraction fields are traversed, determine whether the matching action counter is 0. If so, proceed to step 227. If not, determine whether all the filtering data are traversed. If not, return to step 221. If so, proceed to step 226.
[0085] Step 226: Determine whether the necessary fields in the title extraction field are matched successfully. If so, proceed to step 227; if not, proceed to step 228;
[0086] Step 227: Return the matching success information and output the title information;
[0087] Step 228: Feedback matching failure information.
[0088] In the title extraction sub-process, in addition to requiring the tag attribute of the current ATTRIB attribute object to be equal to the definition in the rule configuration file, it can also be required to be consistent with the definition in the second extended rule configuration file, such as requiring the object types before and after the target attribute object to match, that is, object-before="INSERT,ATTRIB,ATTRIB" object-after; if all are met, the title information is determined.
[0089] Step 3: Extract BOM and title information from the filtered data according to the preset dictionary matching algorithm, and output BOM and title information; Figure 9 As shown, the specific steps include:
[0090] Step 31: Group and sort the filtered data, and put the ATTRIB attribute objects with a higher probability of BOM information appearing in the front to obtain grouped data;
[0091] The acquisition of grouped data includes the following steps:
[0092] Step 311: In the filtered data, the ATTRIB attribute objects are divided using the INSERT object as a dividing point to obtain a plurality of ATTRIB attribute object sequences. Each ATTRIB attribute object sequence is sorted in sequence. Each ATTRIB attribute object sequence includes a plurality of ATTRIB attribute objects, and each ATTRIB attribute object sequence is preceded and followed by an INSERT object.
[0093] Step 312: Group adjacent ATTRIB attribute object sequences with the same number of ATTRIB attribute objects into one group to obtain a plurality of first sequence groups.
[0094] In this embodiment, Figure 2 Based on the filtered data shown, all INSERT objects are marked and used as the split point to obtain 10 ATTRIB attribute object sequences. Since the lengths of the adjacent 3rd to 6th ATTRIB attribute object sequences are equal, that is, the number of ATTRIB attribute objects in the ATTRIB attribute object sequence is the same, they are merged and divided into group G2. The lengths of the adjacent 7th to 8th ATTRIB attribute object sequences are equal, so they are merged and divided into group G3. The others are each grouped, and finally a total of 6 first sequence groups G0-G5 are formed, as shown in the following figure. Figure 3 As shown;
[0095] Step 313: Split the first sequence group into a plurality of second sequence groups, so that the tag attributes of the ATTRIB attribute objects at the same offset position of the ATTRIB attribute object sequence in each second sequence group are the same;
[0096] For each first sequence group, determine whether the tag attributes of the ATTRIB attribute objects at the same offset position in each ATTRIB attribute object sequence are the same. If they are different, split the first sequence group into multiple second sequence groups to ensure that the tag attributes of the ATTRIB attribute objects at the same offset position in each ATTRIB attribute object sequence in all second sequence groups are the same.
[0097] In this embodiment, Figure 3In the G2 group of the filtered data shown, in the fourth ATTRIB attribute object sequence, the tag attribute in the ATTRIB attribute object at position 41 is different from the tag attribute in the ATTRIB attribute objects at positions 17, 25, and 33 in the first three columns of the ATTRIB attribute object sequence. The tag attributes of the ATTRIB attribute objects at the same offset positions in the first three columns of the ATTRIB attribute object sequence are the same, that is, the tag attributes in the ATTRIB attribute objects at positions 17, 25, and 33 are the same, the tag attributes in the ATTRIB attribute objects at positions 18, 26, and 34 are the same, and so on, until the tag attributes in the ATTRIB attribute objects at positions 23, 31, and 39 are the same; therefore, the G2 group is split into two groups, and finally split into 7 second sequence groups, G0-G6, as shown Figure 4 shown.
[0098] Step 314: Sort the second sequence group according to the number of ATTRIB attribute object sequences to obtain grouped data;
[0099] After testing and verification, BOM information is stored in a series of adjacent attribute sequences, and the tag attributes at the same offset position in each sequence are the same. At the same time, the number of ATTRIB attribute object sequences in this second sequence group is relatively high. In order to improve the efficiency of BOM matching extraction, the number of ATTRIB attribute object sequences is sorted from large to small to obtain grouped data. In this embodiment, Figure 4 The 7 second sequence groups shown are sorted according to the number of ATTRIB attribute object sequences. The second sequence group with 3 objects is sorted as G0, the second sequence group with 2 objects is sorted as G1, and the rest are sorted as G2-G6 in sequence to obtain grouped data. Figure 5 shown.
[0100] Step 32: Extract BOM information from the grouped data according to the preset dictionary matching file and enter the BOM information extraction sub-process. If the BOM information extraction is successful, proceed to step 33; if the BOM information extraction fails, proceed to step 35;
[0101] Step 33: Extract title information from the grouped data according to the preset dictionary matching file, and enter the title information extraction sub-process; if the title information extraction is successful, proceed to step 34; if the title information extraction fails, proceed to step 35;
[0102] Step 34: Output BOM and title information;
[0103] Step 35: Return the extraction failure information;
[0104] The dictionary matching file defines several title extraction fields of the title information and several material extraction fields of the BOM. In this embodiment, the title extraction fields include "drawing code", "drawing name", and "version number", and the material extraction fields include "serial number", "code", "name", "quantity", "material", "unit weight", "total weight", "remarks", and "material code". The title extraction fields and material extraction fields include necessary fields and non-essential fields. Necessary fields are defined as fields that must be extracted, that is, if the field is not extracted during the extraction process, the extraction failure will be fed back. Non-essential fields are fields that do not have to be extracted, that is, if the field is not extracted during the extraction process, no feedback will be given. In this embodiment, "drawing code", "drawing name", "serial number", "code", and "name" are defined as necessary fields, and "version number", "quantity", "material", "unit weight", "total weight", "remarks", and "material code" are defined as non-essential fields.
[0105] There can be multiple dictionary matching files. In this embodiment, the dictionary matching files include a first basic dictionary matching file and a second extended dictionary matching file. The first basic dictionary matching file defines general information, such as several title extraction fields for title information and several material extraction fields for BOM. The second extended dictionary matching file defines extended information, that is, synonymous expansion of the extraction fields. Because fields with the same meaning may have different names, the names of the fields in the first basic dictionary matching file can be expanded through the dictionary library to improve the breadth of tag attribute matching in the ATTRIB attribute object. For example, for the "drawing code" field, "drawing number" is added as an expansion word; for the "drawing name" field, "product name" is added as an expansion word; for the "code" field, "drawing number" is added as an expansion word, and so on.
[0106] In this embodiment, the first basic dictionary matching file is as follows:
[0107] <?xml version="1.0" encoding="utf-8"?>
[0108] <fields>
[0109] <field key="drawing-code" name="图样代号" required="true" / >
[0110] <field key="drawing-name" name="图样名称" required="true" / >
[0111] <bom>
[0112] <field key="sequence" name="序号" required="true" / >
[0113] <field key="code" name="代号" required="true" / >
[0114] <field key="name" name="名称" required="true" / >
[0115] <field key="material" name="材料" / >
[0116] <field key="material-code" name="物料编码" / >
[0117] <field key="quantity" name="数量" / >
[0118] <field key="weidget" name="单重" / >
[0119] <field key="tatal-weidget" name="总重" / >
[0120] <field key="comments" name="备注" / >
[0121] < / bom>
[0122] < / fields>
[0123] The second extended dictionary matching file is as follows:
[0124] {
[0125] "drawing-code":["drawing number"],
[0126] "drawing-name":["product name"],
[0127] "bom": {
[0128] "sequence": [],
[0129] "code": ["Image number"],
[0130] "name": [],
[0131] "material": [],
[0132] "material-code": [],
[0133] "quantity": [],
[0134] "weidget": [],
[0135] "tatal-weidget": [],
[0136] "comments": []
[0137] }
[0138] }
[0139] After entering the BOM information extraction sub-process, because the character encoding in the current CAD drawing is uncertain, the character encoding is first traversed. The character encoding in this embodiment includes UTF-16, GB2312, and UTF-8. Based on the current character encoding, the grouped data is traversed and the BOM information is extracted from the grouped data. The processing logic is as follows: Figure 10 As shown;
[0140] Extracting BOM information from grouped data includes: first determining whether the tag attribute of the ATTRIB attribute object in the grouped data matches the BOM field required by the first basic dictionary matching file; if so, traversing the grouped data to extract the BOM line field information; after traversing, the BOM list is returned; the processing logic is as follows: Figure 11 As shown; the method for judging whether the tag attribute of the ATTRIB attribute object in the grouped data matches the BOM field required by the first basic dictionary matching file is: take out the first ATTRIB attribute object in the ATTRIB attribute object sequence in the grouped data, then traverse the BOM field in the first basic dictionary matching file, and then traverse all ATTRIB attribute objects in the ATTRIB attribute object sequence to judge whether the tag attribute of the ATTRIB attribute object sequence is in the current BOM field name and the extended name defined in the second extended dictionary matching file. If so, lock the position of the BOM field in the ATTRIB attribute object sequence, and the whole process is traversed; if the defined necessary fields are found in the corresponding positions, the match is successful and the BOM information is retained, otherwise the match fails. The processing logic is as follows Figure 12 shown.
[0141] After entering the title information extraction sub-process, first determine the character encoding used by the CAD file according to the BOM information extraction sub-process, exclude the second sequence group with more than 1 ATTRIB attribute object sequence in the grouped data, and the second sequence group storing BOM information determined in the BOM information extraction sub-process, traverse the remaining second sequence groups according to the preset dictionary matching file, and determine whether the tag attribute of the ATTRIB attribute object sequence is in the current title field name and the extended name defined in the second extended dictionary matching file. If so, the title information is successfully extracted, otherwise the match fails. The processing logic is as follows Figure 13 shown.
[0142] In the present invention, if the correct BOM and title information cannot be output for a long time, multiple second extended rule configuration files can be set in the rule matching to support different CAD drawing files.
[0143] This invention makes full use of the dictionary matching and rule matching algorithms in natural language processing (NLP) and text analysis, and perfectly solves the pain point of manually entering BOMs during the use of ERP (Enterprise Resource Planning) systems. The BOM format required by ERP can be automatically generated in a timely and rapid manner through CAD files, reducing the BOM maintenance cost and usage difficulty of ERP. At the same time, it provides experience for using natural language processing (NLP) to extract information such as dimensions from CAD files and directly generate the format files required for quality management in ERP (Enterprise Resource Planning) and MES (Manufacturing Execution System).
[0144] The "first" and "second" in the names such as "first" and "second" (if any) mentioned in the embodiments of this application are only used as name identifiers and do not represent the first or second in order.
[0145] This embodiment also discloses an electronic device, comprising: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the electronic device executes the above-mentioned method of extracting bill of materials and title information in CAD.
[0146] In addition, this embodiment further discloses a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned method for extracting bill of materials and title information in CAD.
[0147] The methods described in the above embodiments can be implemented in whole or in part through software, hardware, firmware, or any combination thereof. If implemented in software, the functions can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. Computer-readable media can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium that can be accessed by a computer.
[0148] Computer-readable media may include random access memory (RAM), read-only memory (ROM), compact disc read-only memory (CD-ROM) or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium designed to carry or store the desired program code in the form of instructions or data structures and accessible by a computer. Also, any connection is appropriately termed a computer-readable medium. For example, if software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, include optical discs, laser discs, optical discs, digital versatile discs (DVDs), floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs reproduce data optically using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0149] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices, and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0150] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for extracting bill of materials and title information in CAD, characterized in that: Methods include: Extract the INSERT object and ATTRIB object from the drawing object list of the CAD file as the filtering data; the INSERT object has no data inside, and the ATTRIB object includes the tag attribute and the value attribute, wherein the tag attribute is the attribute name of the ATTRIB object, and the value attribute is the attribute data of the ATTRIB object; Extract BOM and title information from filtered data through preset rule matching algorithm. If the extraction is successful, the BOM and title information will be output; if the extraction fails, the following will be performed: Extract BOM and title information from filtered data according to preset dictionary matching algorithm and output BOM and title information; The BOM and title information are extracted from the filtered data through a preset rule matching algorithm, including the following steps: A preset rule configuration file defines several title extraction fields of the title information and several material extraction fields of the BOM; the title extraction fields and material extraction fields include necessary fields and non-essential fields; After filtering the data through the rule configuration file, the process enters the BOM information extraction sub-process. If the BOM information extraction is successful, the process enters the title information extraction sub-process. If the BOM information extraction fails, the extraction failure message is returned. If the title information extraction is successful, the extraction success message is returned and the BOM and title information are output. If the title information extraction fails, the extraction failure message is returned. Extract BOM and title information from filtered data based on the preset dictionary matching algorithm and output BOM and title information. The process includes: Step 31: Group and sort the filtered data, placing ATTRIB attribute objects with a higher probability of appearing in BOM information at the front to obtain grouped data. Acquiring the grouped data includes: dividing the ATTRIB attribute objects in the filtered data using the INSERT object as a delimiter to obtain a plurality of ATTRIB attribute object sequences; grouping adjacent ATTRIB attribute object sequences with the same number of ATTRIB attribute objects into a group to obtain a plurality of first sequence groups; splitting the first sequence group into a plurality of second sequence groups such that the tag attributes of the ATTRIB attribute objects at the same offset position in each second sequence group are the same; and sorting the second sequence groups according to the number of ATTRIB attribute object sequences to obtain grouped data. Step 32: Extract BOM information from the grouped data according to the preset dictionary matching file and enter the BOM information extraction sub-process. If the BOM information extraction is successful, proceed to step 33; if the BOM information extraction fails, proceed to step 35; Step 33: Extract title information from the grouped data according to the preset dictionary matching file, and enter the title information extraction sub-process; if the title information extraction is successful, proceed to step 34; if the title information extraction fails, proceed to step 35; Step 34: Output BOM and title information; Step 35: Return the extraction failure information.
2. The method for extracting bill of materials and title information from CAD according to claim 1, characterized in that: In the BOM information extraction sub-process, the BOM list used for initial return is empty. After filtering the data and traversing the rule configuration file, if the tag attribute of the ATTRIB attribute object is the same as the material extraction field in the rule configuration file, the match is judged to be successful, and the value attribute of the ATTRIB attribute object is extracted to form a BOM row object, which is appended to the BOM list until all filtered data are traversed and the BOM list is output.
3. The method for extracting bill of materials and title information from CAD according to claim 1, characterized in that: The dictionary matching file defines several title extraction fields of the title information and several material extraction fields of the BOM. The title extraction fields and material extraction fields include necessary fields and non-essential fields. The dictionary matching file includes a first basic dictionary matching file and a second extended dictionary matching file. The first basic dictionary matching file defines general information, and the second extended dictionary matching file defines extended information, that is, synonymous expansion of the extraction fields.
4. The method for extracting bill of materials and title information from CAD according to claim 3, characterized in that: Extracting BOM information from grouped data includes: first determining whether a tag attribute of an ATTRIB attribute object in the grouped data matches a BOM field required by a first basic dictionary matching file; if so, traversing the grouped data to extract BOM row field information, and returning a BOM list after traversal; determining whether a tag attribute of an ATTRIB attribute object in the grouped data matches a BOM field required by the first basic dictionary matching file by taking out the first ATTRIB attribute object in the grouped data, then traversing the BOM field in the first basic dictionary matching file, and then traversing all ATTRIB attribute objects in the ATTRIB attribute object sequence, determining whether the tag attribute of the ATTRIB attribute object sequence is within a current BOM field name and an extended name defined in a second extended dictionary matching file; if so, locking the position of the BOM field in the ATTRIB attribute object sequence, and completing the entire traversal process; if all defined necessary fields are found in corresponding positions, the match is successful and the BOM information is retained; otherwise, the match fails.
5. The method for extracting bill of materials and title information from CAD according to claim 4, characterized in that: After entering the title information extraction sub-process, first determine the character encoding used by the CAD file according to the BOM information extraction sub-process, exclude the second sequence group in which the number of ATTRIB attribute object sequences in the grouped data is greater than 1, and the second sequence group storing BOM information determined in the BOM information extraction sub-process, traverse the remaining second sequence groups according to the preset dictionary matching file, and determine whether the tag attribute of the ATTRIB attribute object sequence is in the current title field name and the extended name defined in the second extended dictionary matching file. If so, the title information is successfully extracted, otherwise the match fails.
6. An electronic device, characterized in that: include: processor and memory; The memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the electronic device performs a method for extracting bill of materials and title information in CAD as described in any one of claims 1 to 5.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for extracting bill of materials and title information in CAD according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Bill of material statistical method and system based on CAD
CN111914315A
Material management method
CN116911751A
Part position determination method and system
CN119294697A