Two-dimensional drawing detail column universal export system and method based on region self-adaption
The information of two-dimensional engineering drawing details is automatically identified and exported through the area adaptive method, which solves the problems of low export efficiency and poor accuracy in the existing technology, and realizes efficient and accurate export across software and styles.
Patent Information
- Application Number
- CN202510444123.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-07-25
AI Technical Summary
The prior art is difficult to achieve efficient, accurate and general automatic export of two-dimensional engineering drawing details columns, especially when different CAD software and enterprise style specifications vary greatly, resulting in time-consuming and labor-intensive manual operations and prone to errors.
Using a region-based adaptive method, through data collection, data processing, area customization and text information export modules, we automatically identify and match the drawing details bar area, obtain and export information into Excel templates, avoiding relying on a single text identifier.
It realizes efficient and accurate export of multi-style drawings, reduces manual operations, improves export speed and accuracy, and is suitable for standardized export in multiple fields.
Smart Images

Figure CN120373277A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a general export method for the bill of materials in 2D drawings based on region adaption, specifically involving the adaptive generation of data points in the bill of materials region of the drawing and the reading and automatic export of bill of materials information. Background Art
[0002] 2D engineering drawings refer to 2D drawings drawn by 2D software such as AutoCAD and 3D software such as NX and CATIA, which mainly express the geometric information, dimensions, tolerances, manufacturing information of parts, as well as auxiliary information including part numbers, names, materials, etc. in the bill of materials. They are important bases for part processing, manufacturing, assembly, and inspection. Engineering Figure 1 Generally, it is based on one part as a unit, and one part corresponds to one drawing frame. For general large-scale equipment, it consists of hundreds of parts and corresponds to hundreds of drawing frames. These drawing frames of the drawings are generally designed in a document, such as a dwg file of AutoCAD. To facilitate part management, it is necessary to export the data information in the bill of materials of the drawings to software such as Excel, and then import this information into an information management system for production or collaboration. Therefore, they need a general export method that is efficient, accurate, and adaptable to avoid errors caused by manual operations.
[0003] Since there is no unified standard for the style of the bill of materials, each enterprise has its own style specification for the bill of materials, and there are also significant differences in the exported information or Excel templates, making its export very difficult and it is hard to achieve a general export. The traditional method of manual export is time-consuming, laborious, and error-prone because there are a large number of drawings in the CAD file and it is necessary to manually export the data one by one. Therefore, how to ensure data consistency, how to handle the batch export of a large number of drawings, how to integrate with an ERP or PLM system, or how to verify whether the exported data is correct; at the same time, it is also necessary to consider the differences between different CAD software and how to unify the export method in these software. These are all difficult problems that need to be solved urgently. Currently, most CAD software has its own API or export function, and some enterprises have developed corresponding bill of materials export plugins, but these functions and plugins are not universal, cannot achieve the adaptive export of bill of materials data, and the format of the exported Excel template file is also restricted. Therefore, it is necessary to balance the generality of the export method and the specific operation steps. Summary of the Invention
[0004] To solve the above problems, in view of the unified export requirements of the bill of materials for multi-CAD platforms and multi-version drawings, combined with engineering data management practices, the present invention provides a general method for exporting the bill of materials of two-dimensional drawings based on region adaptability. This method first adaptively customizes the bill of materials area for each type and size of drawing, locates and identifies the text information in different areas of the bill of materials. Then, it matches the drawing for which the bill of materials needs to be exported with the customized drawing size and bill of materials area, and outputs the matching information to a specified Excel template.
[0005] A general system for exporting the bill of materials of two-dimensional drawings based on region adaptability includes a data acquisition module, a data processing module, a region customization module, and a text information export module.
[0006] A general method for exporting the bill of materials of two-dimensional drawings based on region adaptability includes the following steps:
[0007] S1: Open the Excel template file through the data acquisition module to automatically obtain the title bar text;
[0008] S2: Open the template drawing file for which the bill of materials needs to be exported through the data processing module, calculate the drawing area, and thus obtain the drawing type. Respectively obtain the coordinates P0 of the lower left corner of the outer frame in the drawing, the coordinates P1 of the upper right corner, the coordinates P2 of the lower left corner of the inner frame, and the coordinates P3 of the upper right corner of the inner frame, and use P0 as the base point of the template drawing;
[0009] S3: Determine the area corresponding to the detailed information of the title bar text;
[0010] S4: Obtain the relevant information of the area corresponding to the title bar that needs to be exported from the target drawing and export it.
[0011] Further, step S3 is specifically as follows:
[0012] S31: Screen all horizontal and vertical lines in the template drawing through the region customization module, and mark the horizontal line set in red and the vertical line set in green;
[0013] S32: Sort the horizontal lines in ascending order of the ordinate of the endpoints;
[0014] S33: Sort the vertical lines in ascending order of the abscissa of the endpoints;
[0015] S34: Manually select any rectangular area where the detailed information corresponding to a title text is located on the template drawing, and calculate the coordinates of the lower left corner point and the upper right corner point of the area represented by this point and the relative coordinates relative to P0 through the region customization module;
[0016] Further, step S34 is specifically as follows:
[0017] S341: Locate the rectangular area where the detailed information corresponding to the title bar text is in the template drawing;
[0018] S342: Click on any point within the rectangular area as the seed point of the rectangular area where the detailed information corresponding to the title bar text is located, denoted as point U. Note that the rectangular boundary cannot be clicked.
[0019] S343: Through point U, the area customization module filters out the four straight lines of the corresponding rectangular area, namely L1, L2, L3, and L4;
[0020] S344: The area customization module obtains the ordinate y of the starting point of the horizontal line L1 UH , the abscissa x of the starting point of the vertical line L4 RV . Let the upper right corner coordinates of the rectangular area be P UR (x UR , y UR ). Let x UR = x RV , y UR = y UH . The area customization module obtains the ordinate y of the starting point of the horizontal line L3 BH , the abscissa x of the starting point of the vertical line L4 LV . Let the lower left corner coordinates of the rectangular area be P LB (x BL , y BL ). Let x BL = x LV , y BL = y BH ;
[0021] S345: Through the area customization module, obtain the relative coordinates of the upper right corner and the lower left corner of the area where the text information is located relative to the drawing base point P0.
[0022] S346: Repeat steps S341 - S345 to calculate the coordinates of the lower left corner point and the upper right corner point of the rectangular area where all the detailed information corresponding to the title bar text is located, as well as the relative coordinates relative to P0.
[0023] Furthermore, step S4 is specifically as follows:
[0024] S41: Use the area customization module to obtain the lower left corner point P' o (x'0, y'0),, the upper right corner point P'1(x'1, y'1) of the outer frame of the target drawing;
[0025] S42: Use the area customization module to calculate the coordinate range of the detailed information area corresponding to the keyword set, and then export the qualified detailed information through the text information export module.
[0026] Further, step S42 is specifically as follows:
[0027] S421: Calculate the size of the target drawing through the data processing module to obtain the drawing type and the drawing base point coordinates;
[0028] S422: Determine whether the selected target drawing is of the same type as the template drawing. If so, proceed to S423; if not, return to S2;
[0029] S423: According to the relative coordinates of the lower left corner point and the upper right corner point of the bill of materials corresponding drawing area obtained in S3, add the target drawing base point coordinates to the relative coordinates to obtain the absolute coordinates of the lower left corner point and the upper right corner point of the bill of materials area of the target drawing;
[0030] The lower left corner point P' of the detailed information area corresponding to "Product Name" in the target drawing BL Absolute coordinates (x' BL , y' BL ), and the upper right corner point P' UR Absolute coordinates (x' UR , y' UR ), thereby calculating the coordinate range of the corresponding detailed information area;
[0031] S424: According to the bill of materials area obtained in S423, obtain the text information in this area as "helical gear", and export the "helical gear" text in this detailed information area to the next row of the column corresponding to "Product Name" in the Excel template file through the text information export module.
[0032] S425: Repeat steps S421 - S424 to import the information of one drawing into the table in sequence until all drawing data is exported, as Figure 9 shown;
[0033] S426: Save the Excel file to complete the export of the bill of materials.
[0034] Further, there can be multiple template drawings, which are drawing No. A0, drawing No. A1, drawing No. A2, drawing No. A3, etc.
[0035] Compared with the traditional manual export method and other software for exporting bill of materials information, the method of the present invention has the following distinct features:
[0036] 1. Manual participation is greatly reduced compared with traditional export methods. Only simple operations for area customization are required, and it can be applied to the export of bill of materials information in any specification and style. The bill of materials information is matched by area location and located by coordinates, greatly improving the export speed and content accuracy. This method identifies all the drawings in a drawing file and obtains the drawing information. Therefore, this method has good applicability in certain specific situations that require ensuring the export order of information, selective export, etc.
[0037] 2. Compared with the method of directly obtaining text by identifying the text name identifier of the bill of materials, the method described in this paper of indirectly obtaining the text in the area by obtaining the area adaptive coordinates as the identifier has the following advantages: The universality of this export method is strong and meets the requirements of drawing types: it can adapt to the export of bill of materials information in various styles of drawings and is not limited to a single drawing form, such as drawing blocks and ordinary non-block drawings are all applicable to this method; it meets the requirements of dynamic adjustment of the form of the bill of materials in the drawing, the content of the drawing, etc.: allowing dynamic modification of the drawing, and the modification of the text content and identifier has no impact on the export accuracy of this method; it meets the requirements of multiple output template styles: The traditional method uses the text name of the bill of materials item, such as "product name", as the text identifier to obtain text information, so the Excel template cannot be changed. However, the method described in this paper does not obtain text by means of "text identifier", and the export content can be customized without any requirements for the form and content of the Excel template.
[0038] 3. Through the above method, the standardized and general export of the bill of materials in 2D drawings can be efficiently realized, which is applicable to multiple fields such as mechanical design, architecture, and electronics. Brief Description of the Drawings
[0039] Figure 1 Flowchart of the CAD bill of materials export method of the present invention;
[0040] Figure 2 Schematic diagram of a CAD drawing;
[0041] Figure 3 Open Excel template file;
[0042] Figure 4 Schematic diagram of the bill of materials;
[0043] Figure 5 Schematic diagram of area customization;
[0044] Figure 6 Open CAD drawing file;
[0045] Figure 7 Result diagram of straight line set screening
[0046] Figure 8 Bill of materials of drawing 1
[0047] Figure 9 It is an Excel file after information export. Specific implementation manners
[0048] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0049] A general export system for the bill of materials of two-dimensional drawings based on region adaptability, comprising a data acquisition module, a data processing module, a region customization module and a text information export module.
[0050] A general export method for the bill of materials of two-dimensional drawings based on region adaptability, comprising the following steps:
[0051] S1: Open an Excel template file through the data acquisition module, as Figure 3 shown, and automatically obtain the title bar text, which are respectively "Part Number", "Product Name", "Quantity", "Material", "Unit", "Number of Teeth", "Addendum Coefficient", "Normal Module";
[0052] S2: Open the template drawing file for which the bill of materials needs to be exported through the data processing module, select "Drawing 1" as the template drawing, calculate the drawing area as 62370 through the data processing module, so as to obtain that the drawing type is A4 standard drawing. Respectively obtain the coordinates of the lower left corner of the outer frame in the drawing P0(1739.153, 451.8671), the upper right corner coordinates P1(2036.153, 661.8671), the lower left corner coordinates P2(1744.153, 456.8671) of the inner frame, the upper right corner coordinates P3(2031.153, 656.8671) of the inner frame, and use P0 as the base point of the template drawing;
[0053] S3: Determine the area corresponding to the detailed information of the title bar text
[0054] The specific steps are as follows:
[0055] S31: Screen all horizontal lines and vertical lines in the template drawing through the region customization module, as Figure 7 shown, and mark the horizontal line set with red and the vertical line set with green;
[0056] S32: Sort the horizontal lines in ascending order according to the ordinate of the endpoints;
[0057] S33: Sort the vertical lines in ascending order according to the abscissa of the endpoints;
[0058] S34: Manually select the rectangular area corresponding to the detailed information of any title text on the template drawing, and calculate the coordinates of the lower left corner point and the upper right corner point of the area represented by this point and the relative coordinates with respect to P0 through the area customization module;
[0059] The specific steps are as follows:
[0060] S341: Find the rectangular area corresponding to the detailed information of "Product Name" in Drawing 1, that is, the rectangular area where the text "Straight Gear" is located, as Figure 8 shown in the red frame area;
[0061] S342: Use the mouse to click on any point within this rectangular area as the seed point of the rectangular area corresponding to the detailed information of "Product Name", denoted as U(1929.9133, 514.5061). Note that the rectangular boundary cannot be clicked;
[0062] S343: Through point U, the area customization module filters out the four straight lines of the rectangular area corresponding to "Straight Gear". The schematic diagram is as Figure 8 shown. The four selected straight lines in the figure are the ones sought, namely L1, L2, L3, and L4;
[0063] S344: The area customization module calculates the ordinate y of the starting point of the horizontal line L1 UH = 517.7552, and the abscissa x of the starting point of the vertical line L4 RV = 1951.8481. Let the upper right corner coordinates of the rectangular area be P UR (x UR , y UR ). Let x UR = x RV , y UR = y UH . The area customization module calculates the ordinate y of the starting point of the horizontal line L3 BH = 497.6768, and the abscissa x of the starting point of the vertical line L4 LV = 1911.4611. Let the lower left corner coordinates of the rectangular area be P BL (x BL , y BL ). Let x BL = x LV , y BL = y BH ;
[0064] S345: Through the area customization module, obtain the relative coordinates of the upper right corner and the lower left corner of the area where this text information is located with respect to the drawing base point P0.
[0065] Among them, the coordinates of the upper right corner P of the area where the text information is located UR with respect to P0 are (xR1 , y R1 ), x R1 = x UR -x P0 = 212.6951, y R1 = y UR -y P0 = 65.8881, the lower left corner coordinate P of the text information area BL The coordinate relative to P0 is (x R2 , y R2 ), x R2 = x BL -x P0 = 172.3081, y R2 = y BL -y P0 = 45.8097;
[0066] S346: Repeat steps S341 - S345 to calculate the coordinates of the lower left corner point and the upper right corner point of the rectangular area corresponding to the detailed information of all title bar texts and the relative coordinates relative to P0.
[0067] S4: Obtain and export the relevant information of the area corresponding to the title bar to be exported from the target drawing. The specific steps are as follows. Taking "Drawing 2" as the target drawing as an example, the specific operations are as follows:
[0068] S41: Use the area customization module to obtain the lower left corner point P' of the outer frame of Drawing 2 o (x'0, y'0), where x'0 = 2081.8297, y'0 = 451.8671, and the upper right corner point P'1(2378.8297, 661.8671);
[0069] S42: Use the area customization module to calculate the coordinate range of the detailed information area corresponding to the keyword set {"Part Number", "Product Name", "Quantity", "Material", "Unit", "Number of Teeth", "Addendum Coefficient", "Normal Module"}, and then export the qualified detailed information through the text information export module.
[0070] Now, a detailed description of obtaining the relevant information of the detailed information area corresponding to the title bar text "Product Name" is given. The acquisition of the remaining title bar text information is the same as this. The specific steps are as follows:
[0071] S421: Calculate the size of the target drawing through the data processing module to obtain the drawing type and the drawing base point coordinates;
[0072] S422: Determine whether the selected target drawing is of the same type as the template drawing. If so, perform S423. If not, return to S2;
[0073] S423: Based on the relative coordinates of the lower left corner point and the upper right corner point of the bill of materials corresponding to the drawing area obtained in S3, add the relative coordinates to the base point coordinates of the target drawing to obtain the absolute coordinates of the lower left corner point and the upper right corner point of the bill of materials area of the target drawing;
[0074] The lower left corner point P' of the detailed information area corresponding to "Product Name" in the target drawing BL Absolute coordinate (x' BL , y' BL ), and the upper right corner point P' UR Absolute coordinate (x' UR , y' UR ), thereby calculating the coordinate range of the corresponding detailed information area;
[0075] Among them, x' BL = x'0 + x R1 = 2081.8297 + 172.3081 = 2254.1378, y' BL = y'0 + y R1 = 451.8671 + 45.8097 = 497.6768, x' UR = x'0 + x R2 = 2081.8297 + 212.6951 = 2294.5248, y' UR = y'0 + y R2 = 451.8671 + 65.8881 = 517.7552;
[0076] S424: According to the bill of materials area obtained in S423, obtain the text information in this area as "helical gear", and export the "helical gear" text in this detailed information area to the next row of the column corresponding to "Product Name" in the Excel template file through the text information export module.
[0077] S425: Repeat steps S421 - S424, and import the information of one drawing into the table in sequence until all the drawing data is exported, as Figure 9 shown;
[0078] S426: Save the Excel file to complete the export of the bill of materials.
[0079] In this application, there can be multiple template drawings, which are drawing No. A0, drawing No. A1, drawing No. A2, drawing No. A3, and so on.
[0080] In summary, these are only the preferred examples of the present invention. Those skilled in the art should understand that making some simple modifications, equivalent changes or decorations using the disclosed technical content all fall within the protection scope of the present invention.
Claims
1. A general export system for the bill of materials in 2D drawings based on regional adaptability, characterized in that It includes a data acquisition module, a data processing module, a region customization module, and a text information export module.
2. A method for exporting a bill of materials of a general system for two-dimensional drawing bills of materials based on region adaption as described in claim 1, characterized in that, It includes the following steps: S1: Open the Excel template file through the data acquisition module to automatically obtain the title bar text. S2: Open the template drawing file that needs to export the bill of materials through the data processing module, calculate the drawing area to obtain the drawing type, respectively obtain the coordinates P0 of the lower left corner of the outer frame in the drawing, the coordinates P1 of the upper right corner, the coordinates P2 of the lower left corner of the inner frame, and the coordinates P3 of the upper right corner of the inner frame, and use P0 as the base point of the template drawing. S3: Determine the area corresponding to the detailed information of the title bar text. S4: Obtain the relevant information of the area corresponding to the title bar that needs to be exported from the target drawing and export it.