A cad-based engineering material automatic generation method and system
Patent Information
- Application Number
- CN202611094407.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-22
- Publication Date
- 2026-10-27
AI Technical Summary
然而,通信工程CAD图纸中包含设备表、电源线表、天面设备表、走线架表等7种以上不同类型的表格,每种表格的行列结构、字段含义都不同,该自动录入方式难以做到自动区分表格类型并正确解析;且同一物资信息可能分布在多个表格中,该自动录入方式同样难以做到自动合并去重
[0017]相比于相关技术,本申请实施例提供的一种基于CAD的工程物资自动生成方法和系统,其中,该方法通过遍历用户输入的CAD图纸中的图元,从中筛选出属性文字图元,其中,属性文字图元各自具有一个Tag标签; 基于Tag标签中的表格标识和行号数字,自动识别出属性文字图元所属物资表格的表格类型和有效数据行;基于Tag标签中的列号数字,自动映射定位到物资表格的有效数据行上对应的字段位置,以提取对应的物资信息;按统一的物资数据合并规则,对提取到的不同物资表格的物资信息进行合并,并将合并后的数据输出为预设格式的物资清单,实现了利用统一的Tag标签将属性文字图元转换成物资表格的单元格,通过Tag标签的表格标识自动识别表格类型、解析行列号数字自动识别有效数据与提取物资数据,有效提高CAD图纸的自动化录入准确性,并自动合并去重以输出标准化物资清单,解决了如何提高对CAD图纸的自动化录入准确性的问题。
Smart Images

Figure CN122987129A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication engineering technology, and in particular to a method and system for automatically generating engineering materials based on CAD. Background Technology
[0002] In the field of telecommunications engineering, construction drawings are the core deliverable of a project, while the bill of materials (BOM) is the key basis for budget preparation, material procurement, and construction material preparation. Currently, the engineering design industry commonly uses a manual method of reading and compiling the bill of materials. This involves designers opening CAD drawings, manually reading various tables (equipment lists, power cord lists, rooftop equipment lists, cable tray lists, etc.), identifying the names, specifications, and quantities of materials, and then manually entering the data into an Excel spreadsheet. This manual method has many problems. For example, taking a moderately complex telecommunications equipment room drawing (approximately 120 graphic elements) as an example, a skilled engineer needs about 12-18 minutes to complete the bill of materials compilation. However, for large projects with hundreds of drawings, the workload is enormous and inefficient. Manual entry is prone to omissions and errors, especially with materials of the same specification but different colors being easily confused. Different designers output bills of materials in different formats, causing difficulties for subsequent procurement and budgeting work. Furthermore, after the drawings are updated or modified, the bill of materials needs to be manually compiled again.
[0003] As for automatic data entry methods, existing technologies also exist, such as the patent application No. 202310928292.4 which discloses a list compilation method based on drawing tables. This method includes: acquiring the CAD drawing to be identified, identifying the smallest drawing area containing table information in the CAD drawing; acquiring line elements in the smallest drawing area, assembling the line elements to generate a first table containing multiple cells; acquiring text elements in the smallest drawing area, matching the text elements with the cells of the first table to fill the text elements into the cells of the first table to generate a second table; and matching the second table with a standard list database to generate a target recommendation list.
[0004] This automatic data entry method uses the smallest drawing area of the CAD drawing as a unit, filling text elements into the cells of the corresponding line elements. It simply uses the positional information of elements on the CAD drawing to convert the CAD into a table format and fill in the corresponding text. However, communication engineering CAD drawings contain more than seven different types of tables, such as equipment tables, power line tables, roof equipment tables, and cable tray tables. Each type of table has a different row and column structure and field meanings. This automatic data entry method struggles to automatically distinguish table types and parse them correctly. Furthermore, the same material information may be distributed across multiple tables, making it difficult for this automatic data entry method to automatically merge and deduplicate data.
[0005] Currently, no effective solution has been proposed for improving the accuracy of automated CAD drawing input in related technologies. Summary of the Invention
[0006] This application provides a method and system for automatically generating engineering materials based on CAD, so as to at least solve the problem of how to improve the accuracy of automated input of CAD drawings in related technologies.
[0007] In a first aspect, embodiments of this application provide a method for automatically generating engineering materials based on CAD, the method comprising: Traverse the graphic elements in the CAD drawing input by the user, and filter out attribute text graphic elements, wherein each attribute text graphic element has a tag. Based on the table identifier and row number in the tag, the table type and valid data row of the material table to which the attribute text graphic element belongs are automatically identified; Based on the column number in the tag, the corresponding field position on the valid data row of the material table is automatically mapped and located to extract the corresponding material information; According to the unified material data merging rules, the material information of different material tables extracted are merged, and the merged data is output as a material list in a preset format.
[0008] In some embodiments, the tag includes a table identifier, row number numbers, and column number numbers; wherein: The table identifier is used to mark different types of material tables, including main equipment tables, color light tables, power supply surface wiring tables, rooftop equipment tables, GPS equipment tables, and cable tray tables. The row number is used to mark different data rows in the materials table; The column numbers are used to mark different data columns in the materials table.
[0009] In some embodiments, the table type of the material table to which the attribute text element belongs is automatically identified based on the table identifier in the tag, including: Extract the tag of the attribute text graphic element, automatically identify the material table marked by the table identifier in the tag, and determine the table type of the material table to which the attribute text graphic element belongs.
[0010] In some embodiments, based on the row number in the tag, the valid data rows of the material table to which the attribute text element belongs are automatically identified, including: The row number counter is dynamically maintained by parsing the row number in the tag of the attribute text element, wherein the row number counter is traversed and counted based on the data column in the material table to which the attribute text element belongs. The row number counter is incremented to traverse the attribute text elements of each row in the starting data column one by one. If the text content of the attribute text element is not empty, the current row is a valid data row, until all data rows of the starting data column have been traversed. In the identification of valid data rows in the subsequent data columns of the material table, the row number counter only traverses and identifies data rows in the subsequent data columns that have not been determined as valid data rows until the valid data rows of the material table are obtained.
[0011] In some embodiments, based on the column number in the tag, the corresponding field position on the valid data row of the material table is automatically mapped and located to extract the corresponding material information, including: Obtain the column number mapping rules of the material table to which the attribute text element belongs; Based on the column number in the tag and the column number mapping rule, the corresponding field position on the valid data row of the material table is automatically mapped and located to extract the corresponding material information.
[0012] In some embodiments, the material information from different extracted material tables is merged according to a unified material data merging rule, and the merged data is output as a material list in a preset format, including: According to the unified material data merging rules, the material information of different material tables extracted are merged. The material data merging rules include the net increase in the quantity of materials within the table and the cumulative quantity of materials between the tables. The material tables include the main equipment table, color light table, power supply surface wiring table, rooftop equipment table, GPS equipment table, and cable tray table. Based on the preset list template, the merged data is output as material lists in different formats.
[0013] In some embodiments, traversing the graphic elements in the user-input CAD drawing and filtering out attribute text graphic elements includes: Obtain the CAD drawing input by the user, open the block table of the CAD drawing in read-only mode, and then open the model space of the block table in read-only mode; Traverse all elements in the block table model space of the CAD drawing to filter out attribute text elements.
[0014] Secondly, embodiments of this application provide a CAD-based automatic engineering material generation system, the system being used to execute the method described in the first aspect above, the system comprising an extraction module and a merging module: The extraction module is used to traverse the graphic elements in the CAD drawing input by the user and filter out attribute text graphic elements, wherein each attribute text graphic element has a tag. The extraction module is used to automatically identify the table type and valid data rows of the material table to which the attribute text graphic element belongs, based on the table identifier and row number in the tag. The extraction module is used to automatically map and locate the corresponding field position on the valid data row of the material table according to the column number in the tag, so as to extract the corresponding material information. The merging module is used to merge the material information from different material tables according to a unified material data merging rule, and output the merged data as a material list in a preset format.
[0015] Thirdly, embodiments of this application provide an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.
[0016] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect above.
[0017] Compared to related technologies, this application provides a method and system for automatically generating engineering materials based on CAD. The method involves traversing the elements in a user-input CAD drawing and filtering out attribute text elements, each with a tag. Based on the table identifier and row number in the tag, the method automatically identifies the table type and valid data row of the material table to which the attribute text element belongs. Based on the column number in the tag, the method automatically maps and locates the corresponding field position on the valid data row of the material table to extract the corresponding material information. Following a unified material data merging rule, the extracted material information from different material tables is merged, and the merged data is output as a material list in a preset format. This method effectively improves the accuracy of automated CAD drawing input by using unified tags to convert attribute text elements into material table cells, automatically identifying the table type through the tag's table identifier, and automatically identifying valid data and extracting material data by parsing the row and column numbers. It also automatically merges and removes duplicates to output a standardized material list, thus solving the problem of how to improve the accuracy of automated CAD drawing input. Attached Figure Description
[0018] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart of the steps of the automatic generation method for engineering materials according to an embodiment of this application; Figure 2 This is a schematic diagram of the internal structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this application clearer, the application is described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application.
[0020] Obviously, the accompanying drawings described below are merely some examples or embodiments of this application. Those skilled in the art can apply this application to other similar scenarios based on these drawings without any inventive effort. Furthermore, it is understood that although the efforts made in this development process may be complex and lengthy, for those skilled in the art related to the content disclosed in this application, any changes to design, manufacturing, or production based on the technical content disclosed in this application are merely conventional technical means and should not be construed as insufficient disclosure of the content of this application.
[0021] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment that is mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0022] Unless otherwise defined, the technical or scientific terms used in this application shall have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms “a,” “an,” “an,” “the,” and similar words used in this application do not indicate quantity limitation and may indicate singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units not listed, or may include other steps or units inherent to these processes, methods, products, or devices. The terms “connected,” “linked,” “coupled,” and similar words used in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. “Multiple” used in this application refers to two or more. “And / or” describes the relationship between related objects, indicating that three relationships may exist; for example, “A and / or B” can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following objects are in an "or" relationship. The terms "first," "second," and "third" used in this application are merely to distinguish similar objects and do not represent a specific ordering of the objects.
[0023] This application provides a method for automatically generating engineering materials based on CAD. Figure 1 This is a flowchart illustrating the steps of the automatic generation method for engineering materials according to an embodiment of this application, such as... Figure 1 As shown, the method includes the following steps: Step S102: Traverse the graphic elements in the CAD drawing input by the user and filter out the attribute text graphic elements, where each attribute text graphic element has a tag. Specifically, step S102 involves obtaining the CAD drawing input by the user, opening the block table of the CAD drawing in read-only mode, and then opening the model space of the block table in read-only mode; traversing all the graphic elements in the block table model space of the CAD drawing to filter out attribute text graphic elements.
[0024] Preferably, in step S102, the user opens a CAD drawing (.dwg) in AutoCAD. First, the currently active document in AutoCAD (Application.DocumentManager.MdiActiveDocument) is obtained, and the block table is opened in read-only mode. Then, the model space block table record (BlockTableRecord) is opened in read mode. Then, all entities in the model space are traversed, and entities of the attribute reference type are filtered out.
[0025] It should be noted that attribute text elements are a special type of text object in CAD, different from ordinary text elements or other basic elements (such as points, lines, circles, polylines, etc.). Attribute text elements are text data attached to block objects and must be attached to the block object. Furthermore, a block object is a composite object; it is considered an independent entity in CAD, but it contains multiple sub-elements. That is, attribute text elements are actually one of the sub-elements within the block object. Therefore, step S102 iterates through the sub-elements within the block object, selecting attribute text type elements from them.
[0026] It should be further noted that the tags for attribute text elements include table identifiers, row numbers, and column numbers. Specifically: the table identifier is used to mark different types of material tables, including main equipment tables, color lighting tables, power supply wiring tables, rooftop equipment tables, GPS equipment tables, and cable tray tables; the row numbers are used to mark different data rows within the material table; and the column numbers are used to mark different data columns within the material table. By using unified tags to convert attribute text elements into cells of material tables, and by automatically identifying the table type through the table identifier in the tags and automatically identifying valid data and extracting material data by parsing the row and column numbers, the accuracy of automated CAD drawing input is effectively improved. Step S104: Based on the table identifier and row number in the tag, automatically identify the table type and valid data row of the material table to which the attribute text graphic element belongs; Step S104 specifically includes the following steps: Step S1041: Extract the Tag of the attribute text element, automatically identify the material table marked by the table identifier in the Tag, and determine the table type of the material table to which the attribute text element belongs.
[0027] Step S1041 specifically involves each attribute text having a tag. This embodiment of the invention adopts a unified tag specification, such as "table identifier_row number_column number," but other separator formats such as "table identifier:row number:column number" or "table identifier-row number-column number" can also be used. An example of a tag structure using "table identifier_row number_column number" is illustrated below: WJFSB1_3_4: Represents the cell in the 3rd row and 4th column of the "Equipment Table (WJFSB1)"; WDYDXB1_2_6: Represents the cell in the 2nd row and 6th column of the "Power Supply Wiring Table (WDYDXB1)".
[0028] The system automatically identifies the table type of the current attribute text element by determining whether the tag contains a specific table identifier. Table 1 is an example table of the correspondence between table identifiers and table types.
[0029] Table 1
[0030] The following is a pseudocode example of identifying table types based on tag table identifiers: csharp string Tag = attR.Tag; / / Get the Tag identifier of the attribute text / / Identify table type based on tag table identifier if (Tag.Contains("WJFSB1_")) { / / Recognized as a device table, proceed to device table processing logic } if (Tag.Contains("WDYDXB1_")) { / / Identified as a power supply open wiring table, proceeding to the power supply open wiring table processing logic. } if (Tag.Contains("WTX12_")) { / / Identified as a rooftop cable table, proceeding to the rooftop cable table processing logic. } In addition to the above-mentioned method of identifying table types based on tag table identifiers, regular expression matching or lookup table mapping can also be used to identify table types.
[0031] Step S1042: The row number counter is dynamically maintained by parsing the row number in the tag of the attribute text graphic element. The row number counter uses the data column in the material table to which the attribute text graphic element belongs as the traversal counting object. Step S1043: Increment the row number counter to traverse the attribute text elements of each row of the starting data column one by one. If the text content of the attribute text element is not empty, the current row is a valid data row, until all data rows of the starting data column have been traversed. In step S1044, during the identification of valid data rows in subsequent data columns of the material table, the row number counter only traverses and identifies data rows in subsequent data columns that have not been determined as valid data rows until the valid data rows of the material table are obtained.
[0032] It should be noted that, for steps S1042 to S1044 above, the system dynamically maintains a row number counter by parsing the row number numbers in the Tag tags, and records which data rows contain valid data. Specifically: (a) Row number identification rules: Divide the tag into an array by the underscore "_", i.e. [table identifier, row number, column number]; starting from column number "1" (i.e. the starting data column of the material table), the row number counter increments the row number count, which means entering a new row; (ii) Rules for recording valid data rows: When the text content of the attribute text element in a row of a specific column (such as the 4th column "Quantity of New Additions" in the device table) is not empty, the data row is recorded as a valid data row. The pseudocode implementation example is shown below: csharp int sbRow = 1; / / Device table row number counter / / Separate tags by "_" string[] sbColumn = Tag.Split('_'); / / Starting from column number 1, row numbers increment. if (sbColumn.Length>2&&sbColumn[2] == "1") {sbRow++;} / / Record a row as a valid data row if it is not empty in column 4. if(Tag.Contains("WJFSB1_" + sbRow + "_4")&&attR.TextString!= "") { sbRecordRowNumber.Add(sbRow); / / Record the valid row number } Step S106: Based on the column number in the tag, automatically map and locate the corresponding field position on the valid data row of the material table to extract the corresponding material information. Specifically, step S106 involves obtaining the column number mapping rules of the material table to which the attribute text graphic element belongs; based on the column number and column number mapping rules in the tag, automatically mapping and locating the corresponding field position on the valid data row of the material table to extract the corresponding material information.
[0033] In step S106, preferably, the corresponding material information is extracted by automatically locating different field positions based on the column number in the tag. Different table types have different preset column number mapping rules. Table 2 is an example table of mapping rules for the equipment table (WJFSB1_), and Table 3 is an example table of mapping rules for the power supply wiring table (WDYDXB1_).
[0034] Table 2
[0035] Table 3
[0036] The process of extracting resource information also involves corresponding data calculations. For example, for Table 3 (Power Cable Table, WDYDXB1_), the total length of power cables is calculated as: Column 6 (number of cables) × Column 7 (length of each cable). The pseudocode implementation example for extracting resource information from Table 2 (Equipment Table, WJFSB1_) is shown below: csharp / / Locate the specific dictionary key based on the column number in the tag and extract the data. string tagKey = "WJFSB1_" + data + "_2"; / / Construct the tag and locate the second column. string materialName = sbTableData[tagKey]; / / Get the material name tagKey = "WJFSB1_" + data + "_3";string unit = sbTableData[tagKey]; / / Acquisition Unit tagKey = "WJFSB1_" + data + "_4";string addNumber = sbTableData [tagKey]; / / Get the number of new entries Step S108: According to the unified material data merging rules, merge the material information of the different material tables extracted, and output the merged data as a material list in a preset format.
[0037] Step S108 specifically includes the following steps: Step S1081: Merge the material information of the different material tables extracted according to the unified material data merging rules. The material data merging rules include the net increase in the quantity of materials within the table and the cumulative quantity of materials between the tables. The material tables include the main equipment table, color light table, power supply wiring table, rooftop equipment table, GPS equipment table and cable tray table. It should be noted that the calculation rules for the net increase in the quantity of materials in the table are for "one dismantling and one installation" scenarios (such as dismantling old equipment and installing new equipment). The system automatically recognizes the dismantling quantity field and calculates the net increase in quantity. Specifically: Taking the equipment table (WJFSB1_) in Table 2 above as an example, if both the quantity added (column 4) and the quantity removed (column 5) exist, and the quantity added > the quantity removed, then the net quantity added = the quantity added - the quantity removed; if only the quantity added exists, then the net quantity added = the quantity added; if the quantity removed ≥ the quantity added, then no record of this material is generated (net quantity added is 0). The pseudocode implementation example is shown below: csharp / / If there is a demolition quantity and the new quantity > demolition quantity if (data6 == null&&CADDataRow.GetCell(4).StringCellValue != ""&& CADDataRow.GetCell(3).StringCellValue != ""&&Convert.ToDouble (CADDataRow.GetCell(3).StringCellValue) -Convert.ToDouble(CADDataRow.GetCell (4).StringCellValue)>0){double netNumber = Convert.ToDouble (CADDataRow.GetCell(3).StringCellValue) -Convert.ToDouble(CADDataRow.GetCell (4).StringCellValue);MaterialNumber = netNumber.ToString(); / / Net new quantity } It should be further explained that the rule for accumulating material quantities between tables is for merging data from multiple tables. All data extracted from the equipment table, color lighting table, power supply wiring table, rooftop equipment table, GPS table, and cable tray table will be merged according to a unified material data merging rule (e.g., records with the same material name (Key) will have their quantities accumulated, while records with different material names will be retained separately). A pseudocode example is shown below: csharp Dictionary<string, MaterialRepository> CADContent = new Dictionary< string, MaterialRepository<string>(); / / If the material already exists in the dictionary, increment the quantity. if (CADContent.ContainsKey(materialName)) {double existingNumber = Convert.ToDouble(CADContent[materialName] .MaterialNumber);double newNumber = Convert.ToDouble(addNumber);CADContent [materialName].MaterialNumber = (existingNumber + newNumber).ToString(); } / / If it does not exist, add a new record. else { CADContent.Add(materialName, new MaterialRepository() {MaterialNumber = addNumber, MaterialUnit = unit }); } Step S1082: Based on the preset list template, output the merged data as material lists in different formats.
[0038] It should be noted that the system outputs the merged data into different formats of material lists based on the preset list template file. Table 4 is a sample table of the supported output material list versions.
[0039] Table 4
[0040] The pseudocode implementation example is shown below: csharp / / Open template file using (FileStream file = new FileStream(TableDirectory + "\\template\\set) Material Import Template (Design Product).xlsx, FileMode.Open) { MaterialWorkbookSB = new XSSFWorkbook(file); } / / Get the worksheet and write data ISheet MaterialSheetSB = MaterialWorkbookSB.GetSheet("Sheet1"); IRow MaterialSheetSBRow = MaterialSheetSB.CreateRow(rowNumber); MaterialSheetSBRow.CreateCell(4).SetCellValue(netNumber); / / Write the net number of new cells / / Save file FileStream fileSb = new FileStream(TableDirectory + "\\" + stationName + "-Master Device.xlsx", FileMode.Create);MaterialWorkbookSB.Write (fileSb);fileSb.Close(); In addition to outputting a material list in Excel format (.xlsx), it can also output CSV, XML, JSON or other formats, or write directly to a database.
[0041] Through the methods and steps provided in this application embodiment, users only need to input a CAD drawing file (.dwg) that conforms to the Tag specification and enter a custom command (such as "cl") in the CAD command line to obtain a standardized material list Excel file (.xlsx) with one click. The material list generation is time-saving, accurate, and has a unified format. It also has traceability and multi-version output functions. Ordinary designers do not need programming knowledge and can use it by entering commands. In addition, new table types and field mappings can be flexibly extended through the Tag specification.
[0042] It should be noted that the steps shown in the above process or in the flowchart of the accompanying figures can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0043] This application provides a CAD-based automatic engineering material generation system. This system executes the method provided in the above embodiments and includes an extraction module and a merging module. The extraction module is used to traverse the graphic elements in the CAD drawing input by the user and filter out the attribute text graphic elements, where each attribute text graphic element has a tag. The extraction module is used to automatically identify the table type and valid data rows of the material table to which the attribute text graphic element belongs, based on the table identifier and row number in the tag. The extraction module is used to automatically map and locate the corresponding field position on the valid data row of the material table based on the column number in the tag, so as to extract the corresponding material information. The merging module is used to merge the material information from different material tables according to a unified material data merging rule, and output the merged data as a material list in a preset format.
[0044] It should be noted that the above modules can be functional modules or program modules, and can be implemented through software or hardware. For modules implemented through hardware, the above modules can reside in the same processor; or the above modules can be located in different processors in any combination.
[0045] This embodiment provides an electronic device including a memory and a processor. The memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0046] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0047] Optionally, the electronic device may further include a processor, memory, network interface, display screen, and input device connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a CAD-based automatic generation method for engineering materials. The display screen may be an LCD screen or an e-ink screen. The input device may be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the device's casing, or an external keyboard, touchpad, or mouse.
[0048] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0049] Furthermore, in conjunction with the CAD-based automatic engineering material generation method in the above embodiments, this application embodiment can provide a storage medium for implementation. This storage medium stores a computer program; when executed by a processor, the computer program implements any of the CAD-based automatic engineering material generation methods in the above embodiments.
[0050] In one embodiment, Figure 2 This is a schematic diagram of the internal structure of an electronic device according to an embodiment of this application, such as... Figure 2 As shown, an electronic device is provided, which can be a server, and its internal structure diagram can be as follows. Figure 2 As shown, the electronic device includes a processor, a network interface, internal memory, and non-volatile memory connected via an internal bus. The non-volatile memory stores the operating system, computer programs, and a database. The processor provides computing and control capabilities, the network interface communicates with external terminals via a network, the internal memory provides the environment for the operating system and computer programs to run, the computer programs are executed by the processor to implement a CAD-based automatic engineering material generation method, and the database stores data.
[0051] Those skilled in the art will understand that Figure 2 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. A specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0052] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0053] Those skilled in the art should understand that 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 have been 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.
[0054] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for automatically generating engineering materials based on CAD, characterized in that, The method includes: Traverse the graphic elements in the CAD drawing input by the user, and filter out attribute text graphic elements, wherein each attribute text graphic element has a tag. Based on the table identifier and row number in the tag, the table type and valid data row of the material table to which the attribute text graphic element belongs are automatically identified; Based on the column number in the tag, the corresponding field position on the valid data row of the material table is automatically mapped and located to extract the corresponding material information; According to the unified material data merging rules, the material information of different material tables extracted are merged, and the merged data is output as a material list in a preset format.
2. The method according to claim 1, characterized in that, The tag contains a table identifier, row number, and column number; where: The table identifier is used to mark different types of material tables, including main equipment tables, color light tables, power supply surface wiring tables, rooftop equipment tables, GPS equipment tables, and cable tray tables. The row number is used to mark different data rows in the materials table; The column numbers are used to mark different data columns in the materials table.
3. The method according to claim 2, characterized in that, Based on the table identifier in the tag, the table type of the material table to which the attribute text element belongs is automatically identified, including: Extract the tag of the attribute text graphic element, automatically identify the material table marked by the table identifier in the tag, and determine the table type of the material table to which the attribute text graphic element belongs.
4. The method according to claim 2, characterized in that, Based on the row number in the tag, the valid data rows of the material table to which the attribute text element belongs are automatically identified, including: The row number counter is dynamically maintained by parsing the row number in the tag of the attribute text graphic element. The row number counter is traversed and counted based on the data column in the material table to which the attribute text graphic element belongs. The row number counter is incremented to traverse the attribute text elements of each row in the starting data column one by one. If the text content of the attribute text element is not empty, the current row is a valid data row, until all data rows of the starting data column have been traversed. In the identification of valid data rows in the subsequent data columns of the material table, the row number counter only traverses and identifies data rows in the subsequent data columns that have not been determined as valid data rows until the valid data rows of the material table are obtained.
5. The method according to claim 2, characterized in that, Based on the column number in the tag, the system automatically maps and locates the corresponding field position on the valid data row of the material table to extract the corresponding material information, including: Obtain the column number mapping rules of the material table to which the attribute text element belongs; Based on the column number in the tag and the column number mapping rule, the corresponding field position on the valid data row of the material table is automatically mapped and located to extract the corresponding material information.
6. The method according to claim 1, characterized in that, According to unified material data merging rules, the material information from different material tables is merged, and the merged data is output as a material list in a preset format, including: According to the unified material data merging rules, the material information of different material tables extracted are merged. The material data merging rules include the calculation rules for the net increase in the quantity of materials within the table and the accumulation rules for the quantity of materials between tables. The material tables include the main equipment table, color light table, power supply surface wiring table, rooftop equipment table, GPS equipment table, and cable tray table. Based on the preset list template, the merged data is output as material lists in different formats.
7. The method according to claim 1, characterized in that, Iterate through the graphic elements in the user-input CAD drawing and filter out graphic elements with attribute text, including: Obtain the CAD drawing input by the user, open the block table of the CAD drawing in read-only mode, and then open the model space of the block table in read-only mode; Traverse all elements in the block table model space of the CAD drawing to filter out attribute text elements.
8. A CAD-based automatic engineering material generation system, characterized in that, The system is used to perform the method according to any one of claims 1 to 7, the system comprising an extraction module and a merging module: The extraction module is used to traverse the graphic elements in the CAD drawing input by the user and filter out attribute text graphic elements, wherein each attribute text graphic element has a tag. The extraction module is used to automatically identify the table type and valid data rows of the material table to which the attribute text graphic element belongs, based on the table identifier and row number in the tag. The extraction module is used to automatically map and locate the corresponding field position on the valid data row of the material table according to the column number in the tag, so as to extract the corresponding material information. The merging module is used to merge the material information from different material tables according to a unified material data merging rule, and output the merged data as a material list in a preset format.
9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method of any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
List compilation method and device based on drawing table, equipment and storage medium
CN116933350A