An electrical secondary technical service data acquisition method and device
Through software library and target keyword recognition technology, cable number information in CAD drawings is extracted and matched, which solves the problems of low efficiency and insufficient precision in existing technologies and realizes fast and accurate acquisition of cable number and cable label information.
Patent Information
- Application Number
- CN202411452138.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-10-17
Smart Images

Figure CN119296112B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power distribution network inspection, and in particular to a method and device for acquiring electrical secondary technical data. Background Art
[0002] In scenarios such as the power industry, petrochemical industry, and production workshops, equipment modification requires CAD drawings of secondary electrical engineering projects. This involves laying multiple secondary cables. Each secondary cable is typically composed of several twisted conductors or groups of conductors, each group of conductors insulated from each other. The entire cable is shielded with a copper foil layer, which is then covered with a highly insulating coating. A single cable, installed between sites A and B, contains several conductors. Therefore, printed cable tags are required and tied to both ends of the same secondary cable to distinguish between different cables. Specific cable numbers are also required to distinguish the inner conductors within the same cable.
[0003] Currently, there are three main methods for obtaining secondary cable header and cable tag information from CAD drawings of secondary electrical engineering projects. The first method involves manually entering the cable header and cable tag information from the CAD drawings into Excel. However, this method is time-consuming and labor-intensive, and has a high error rate.
[0004] The second method is to use CAD software. This software allows users to manually select and capture a portion of a CAD drawing, convert it into an Excel spreadsheet, and then manually process it again within the Excel spreadsheet according to a specific format. However, this solution has the disadvantages of a limited capture range, inability to capture in batches, and insufficient capture accuracy.
[0005] The third approach involves reading and converting CAD drawings based on convolutional neural networks. This method uses a convolutional neural network to first segment the image, then applies a 2D convolution kernel to weight the pixels in the drawing, and then fits an Excel spreadsheet. However, this method requires a large training set, and the model cannot be updated after it is formed. The accuracy of the generated Excel spreadsheet is determined by the similarity between the input drawing and the training set. When the difference between the drawing and the drawings in the training set is too large, the fitting effect decreases linearly. Secondly, when the image and text are complex, especially when the text in the image overlaps on the same layer, the convolutional model cannot recognize it. Summary of the Invention
[0006] The technical problem to be solved by the present invention is to provide a method and device for acquiring electrical secondary technical data, which can quickly and accurately acquire data in electrical secondary technical CAD drawings.
[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0008] A method for acquiring electrical secondary technical data, comprising:
[0009] Extract cable brand information, cable number information and graphic information from CAD drawings through the software library;
[0010] Identify the target cable sign and target drawing name corresponding to the target keyword in the cable sign information by using the target keyword;
[0011] Obtain a cable sign document according to the target cable sign and the target drawing name;
[0012] Extracting a table graphic from the graphic information and determining the coordinates of each data cell in the table graphic;
[0013] Matching the coordinates of the target text in the cable header information with the coordinates of each data cell to obtain the data cell to which each target text belongs;
[0014] The row-column relationship and column attributes of each target text are obtained, and a secondary cable header document is obtained according to the row-column relationship and column attributes of the target text.
[0015] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0016] An electrical secondary technical data acquisition device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step of the above-mentioned electrical secondary technical data acquisition method is implemented.
[0017] The beneficial effects of the present invention are: extracting information from CAD drawings through the software library can solve the problems of low efficiency and high error rate in manual information extraction; after extracting relevant information, the target cable sign and the target drawing name are identified based on the target keyword and the cable sign document is directly generated, and after obtaining the coordinates of the data grid by processing the graphic information, the data grid is matched with the target text, so that each target text is set in the corresponding data grid, and then the information related to the cable head in the target text is extracted through the row and column relationship and column attributes of the target text to obtain a secondary cable head document, thereby eliminating the need for manual secondary processing, and being able to quickly and accurately obtain the data in the electrician secondary technical CAD drawings and generate corresponding documents. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 This is a flowchart of a method for acquiring electrical secondary technical data according to an embodiment of the present invention;
[0019] Figure 2 is the schematic diagram of the drawing to be extracted;
[0020] Figure 3 Schematic diagram of text point cloud information extracted based on the electrical secondary technology data acquisition method in an embodiment of the present invention;
[0021] Figure 4 This is a schematic diagram of graphic information extracted based on the electrical secondary technical data acquisition method in an embodiment of the present invention;
[0022] Figure 5 A schematic diagram of extracting cable brand information in a method for acquiring electrician secondary technical data in an embodiment of the present invention;
[0023] Figure 6 A schematic diagram of extracting table graphics in a method for acquiring electrical secondary technical data in an embodiment of the present invention;
[0024] Figure 7 A schematic diagram of a cable label document generated by a method for acquiring electrician secondary technical data in an embodiment of the present invention;
[0025] Figure 8 Schematic diagram of straight line mapping in a method for acquiring electrical secondary technical data in an embodiment of the present invention;
[0026] Figure 9 Schematic diagram of generating a data grid in a method for acquiring electrical secondary technical data in an embodiment of the present invention;
[0027] Figure 10 Schematic diagram of the matching relationship between target text and data grid in a method for acquiring electrician secondary technical data in an embodiment of the present invention;
[0028] Figure 11 Schematic diagram of obtaining column attributes in a method for obtaining electrical secondary technical data in an embodiment of the present invention;
[0029] Figure 12 Schematic diagram of obtaining row relationships in a method for obtaining electrical secondary technical data in an embodiment of the present invention;
[0030] Figure 13 Schematic diagram of a secondary cable header file in a method for acquiring electrical secondary technical data in an embodiment of the present invention;
[0031] Figure 14 Schematic diagram of the structure of an electrical secondary technology data acquisition device in an embodiment of the present invention. DETAILED DESCRIPTION
[0032] To illustrate the technical content, achieved objectives and effects of the present invention in detail, the following description is given in conjunction with the embodiments and accompanying drawings.
[0033] Please refer to Figure 1 , a method for acquiring electrician secondary technical data, comprising:
[0034] Extract cable brand information, cable number information and graphic information from CAD drawings through the software library;
[0035] Identify the target cable sign and target drawing name corresponding to the target keyword in the cable sign information by using the target keyword;
[0036] Obtain a cable sign document according to the target cable sign and the target drawing name;
[0037] Extracting a table graphic from the graphic information and determining the coordinates of each data cell in the table graphic;
[0038] Matching the coordinates of the target text in the cable header information with the coordinates of each data cell to obtain the data cell to which each target text belongs;
[0039] The row-column relationship and column attributes of each target text are obtained, and a secondary cable header document is obtained according to the row-column relationship and column attributes of the target text.
[0040] From the above description, it can be seen that the beneficial effects of the present invention are: extracting information from CAD drawings through the software library can solve the problems of low efficiency and high error rate in manual information extraction; after extracting relevant information, the target cable sign and target drawing name are identified based on the target keyword and the cable sign document is directly generated, and after obtaining the coordinates of the data grid by processing the graphic information, the data grid is matched with the target text, so that each target text is set in the corresponding data grid, and then the information related to the cable head in the target text is extracted through the row and column relationship and column attributes of the target text to obtain a secondary cable head document, thereby eliminating the need for manual secondary processing, and being able to quickly and accurately obtain the data in the electrician secondary technical CAD drawings and generate corresponding documents.
[0041] Furthermore, extracting the cable sign information from the CAD drawing through the software library includes:
[0042] Extracting point cloud data of the cable sign information from the CAD drawing; the point cloud data includes the cable sign text and the point cloud coordinates of the cable sign;
[0043] The step of identifying a target cable sign corresponding to the target keyword in the cable sign text by using the target keyword comprises:
[0044] Obtain target cable model text and target cable model point cloud coordinates through the target keyword;
[0045] The text adjacent to the target cable model text is obtained according to the target cable model point cloud coordinates to obtain the target cable number and the target cable direction.
[0046] From the above description, it can be seen that by performing target keyword recognition, the cable model text can be directly obtained, and then the adjacent cable numbers and cable directions can be obtained based on the point cloud coordinates of the cable model, thereby obtaining complete cable brand information.
[0047] Furthermore, the step of acquiring text adjacent to the target cable model text according to the target cable model point cloud coordinates to obtain the target cable number and the target cable direction includes:
[0048] Calculate the distance between the point cloud coordinates of all texts in the cable sign information and the point cloud coordinates of the target cable model;
[0049] The minimum two point cloud coordinates with a positive distance difference are queried to obtain the target cable number and the target cable direction.
[0050] As can be seen from the above description, by calculating the distance difference between texts, the text adjacent to the cable model text can be accurately identified, thereby obtaining accurate cable brand information.
[0051] Furthermore, extracting the tabular graphics from the graphic information includes:
[0052] Traversing and identifying each graphic in the graphic information, determining whether the traversed target graphic is a straight line type, and if so, retaining the target graphic;
[0053] The table graph is obtained according to all the retained target graphs.
[0054] As can be seen from the above description, by performing straight line judgment on each graphic and saving the straight line type graphics in the graphic information, a complete table graphic can be obtained.
[0055] Furthermore, the graphic information includes the coordinates of the starting point of the graphic;
[0056] The step of determining whether the traversed target graphic is a straight line type includes:
[0057] It is determined whether the target graphic is a straight line type according to the starting point coordinates of the target graphic.
[0058] From the above description, it can be seen that by changing the x-axis coordinate in the starting point coordinates of the graphic, it is possible to determine whether the graphic is a vertical straight line, and by changing the y-axis coordinate in the starting point coordinates, it is possible to determine whether the graphic is a horizontal straight line, thereby comprehensively identifying all the straight lines in the graphic information by combining the changes in the x-axis coordinates and the y-axis coordinates.
[0059] Furthermore, determining the coordinates of each data grid in the table graph includes:
[0060] Projecting all straight lines in the table graph onto the y-axis, and obtaining the starting coordinates and the ending coordinates of each target line segment to obtain a vertical coordinate interval; obtaining a vertical coordinate interval set based on the vertical coordinate intervals of all the target line segments;
[0061] Projecting all straight lines in the table graph onto the x-axis, obtaining the starting coordinates and the ending coordinates of each target line segment to obtain a horizontal coordinate interval, and obtaining a horizontal coordinate interval set based on the horizontal coordinate intervals of all the target line segments;
[0062] The coordinates of each data grid are obtained according to the vertical coordinate interval set and the horizontal coordinate interval set.
[0063] From the above description, it can be seen that by performing y-axis projection and x-axis projection on all the straight lines in the table graph respectively, and obtaining the vertical coordinate interval and horizontal coordinate interval respectively, the coordinates of each data grid can be accurately obtained based on the vertical coordinate interval and horizontal coordinate interval.
[0064] Furthermore, obtaining the coordinates of each data grid according to the vertical coordinate interval set and the horizontal coordinate interval set includes:
[0065] Performing an intersection judgment on all the vertical coordinate intervals in the vertical coordinate interval set, and merging the vertical coordinate intervals with intersection to obtain an integrated vertical coordinate interval set; and sequentially labeling the vertical coordinates of each vertical coordinate interval according to the size of the coordinates of the vertical coordinate interval;
[0066] Performing intersection determination on all the horizontal coordinate intervals in the horizontal coordinate interval set, and merging the horizontal coordinate intervals with intersection to obtain an integrated horizontal coordinate interval set; labeling the horizontal coordinates of each horizontal coordinate interval in turn according to the coordinate size of the horizontal coordinate interval;
[0067] The coordinates of each data grid are obtained according to the vertical coordinate label and the horizontal coordinate label.
[0068] As can be seen from the above description, by performing interval integration on the vertical coordinate interval set and the horizontal coordinate interval set respectively, the integration of redundant intervals is achieved.
[0069] Furthermore, matching the coordinates of the target text in the cable header information with the coordinates of each data grid includes:
[0070] Reshape the point cloud of all the target texts to obtain the point cloud space coordinates corresponding to each target text;
[0071] The point cloud space coordinates corresponding to each target text are matched with the coordinates of the data grid to obtain the data grid to which each target text belongs.
[0072] From the above description, it can be seen that by reshaping the point cloud of all target texts, the coordinates of the target text and the data grid can be matched more effectively, thereby achieving matching between the target text and the data grid.
[0073] Furthermore, the obtaining of the row-column relationship and column attributes of each target text includes:
[0074] Identifying all keywords related to the cable header in the target text;
[0075] Using the keyword as the column attribute and obtaining the horizontal coordinate of the keyword;
[0076] Matching the target text with the horizontal coordinates of the keywords to obtain a target paragraph with the column attributes;
[0077] Calculating the vertical coordinate difference of all the target paragraphs to obtain the row relationship between all the target paragraphs;
[0078] Read the target paragraph in the same row of the target text, and sort it according to the column attribute order to obtain target row number header information;
[0079] A secondary cable header document is obtained based on all the target line header information.
[0080] From the above description, it can be seen that by using keywords as column attributes and based on the horizontal coordinates of the keywords, the column attributes of the target paragraph can be quickly identified, and the target paragraphs in different rows can be distinguished by calculating the vertical coordinate difference, thereby realizing the reading of target paragraphs in the same row and sorting them in the order of column attributes to obtain an accurate secondary cable header document.
[0081] Another embodiment of the present invention provides an electrical secondary technical data acquisition device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step in the above-mentioned electrical secondary technical data acquisition method is implemented.
[0082] The method and device for acquiring electrical secondary technical data provided by the present invention can be applied to the acquisition of secondary cable numbers and cable brand documents in CAD drawings of electrical secondary technical renovation projects in the power industry, petrochemical industry, and production workshops. The following is an explanation of the specific implementation method:
[0083] Example 1
[0084] Please refer to Figure 1, a method for acquiring electrician secondary technical data, comprising:
[0085] S1. Extract cable label information, cable number information and graphic information from CAD drawings through software libraries; for example, programs developed based on the Python kernel, there are existing open source programs that can batch read mainstream CAD drawing formats such as dwg and dxf, and achieve "communication" with CAD drawings; Among them, this embodiment bypasses the complex restriction rules in CAD by calling the dxfgrabber library (a Python library for reading DXF files) to obtain text point cloud information and graphic information from the drawings; the text point cloud information includes the text content and the spatial coordinates of the text; the graphic information includes the type of the graphic and the coordinates of the starting point of the graphic; such as Figure 2 As shown in the figure, it is the CAD drawing to be extracted; Figure 3 as well as Figure 4 , which is the extracted text point cloud information and graphic information.
[0086] S2, identifying the target cable sign and target drawing name corresponding to the target keyword in the cable sign information by using the target keyword, specifically comprising the following steps:
[0087] Please refer to Figure 5 , S21, obtain the target cable model text and the target cable model point cloud coordinates through the target keyword; wherein, the corresponding keyword extraction method can be obtained according to the cable numbering rule, for example, the target keyword "ZR" (abbreviation for flame retardant) is used to locate part of the cable model point cloud on the drawing, such as Figure 5 The part marked as 1 in the text; use the "split" statement with the " " character as the separator to decompose the cable model text, retain the text after the " ", and then use the "split" statement to separate the text with "X", retain the number before "X", and record it as the number of cores of the cable; for example, ZR-KVVP2 / 22-1 4X2.5, after being separated by " " using the "split" statement, becomes "ZR-KVVP2 / 22-1", "4X2.5", and continue to use the "split" statement to separate "4X2.5" with "X", separating it into "4", "2.5", retaining "4" and recording it as the number of cores of the cable; and using the keywords "terminal diagram" and "wiring diagram" to locate the text information to obtain the drawing name, such as Figure 5 The part marked as 4;
[0088] S22. Acquire text adjacent to the target cable model text based on the target cable model point cloud coordinates to obtain the target cable number and target cable direction. In an optional embodiment, after calculating the distance between the point cloud coordinates of all texts in the cable sign information and the point cloud coordinates of the target cable model, query the minimum two point cloud coordinates whose distance difference is a positive value (i.e., using the target cable model point cloud coordinates as a subtrahend) to obtain the target cable number and target cable direction.
[0089] For example, calculate the distance between the Y-axis coordinate value of the spatial coordinates of all point clouds and the Y-axis coordinate value of the cable model information point cloud set, query the two point clouds with the smallest positive difference, and separate the cable numbers according to the principle of the smallest positive distance (such as Figure 5 The part marked as 2 in the figure) and the direction of the cable (such as Figure 5 The part marked as 3 in the figure); Figure 5 As shown in the part marked as 5 in FIG, all the cable information point clouds constitute a cable information point cloud set; Figure 4 Lieutenant General Figure 5 The straight lines contained in the coordinate range of the part marked as 5 are separated, that is, Figure 6 Remove the part marked as 1 in the figure, and the remaining part is the straight line that makes up the terminal table, that is, Figure 6 The part marked 2.
[0090] S3. Get the cable tag document according to the target cable tag and target drawing name. Specifically:
[0091] Please refer to Figure 7 , classify the drawing names to get the number of rows of the drawing cabinet, and write the drawing name of each row (i.e. Figure 5 The part marked as 4 in the figure) and the cable information point cloud set (i.e. Figure 5 The part marked as 5 in the figure is saved and saved as a cable brand document in a specific format; at the same time, the drawing name and the cable information point cloud set are separated, and the remaining text information is the terminal text point cloud set, that is, Figure 5 The part marked with 6.
[0092] S4, extracting a tabular graphic from the graphic information, and determining the coordinates of each data cell in the tabular graphic;
[0093] S41, traversing each graphic in the identified graphic information, determining whether the traversed target graphic is a straight line type, and if so, retaining the target graphic, and finally obtaining a table graphic based on all retained target graphics;
[0094] The step of determining whether the traversed target graphic is a straight line type includes determining whether the target graphic is a straight line type based on the coordinates of the starting point of the target graphic. In an optional embodiment, the step of determining whether the target graphic is a straight line type is implemented as follows:
[0095] S411. Project all the straight lines in the table onto the y-axis, and obtain the starting coordinates and the ending coordinates of each target line segment to obtain the ordinate interval; obtain the ordinate interval set based on the ordinate intervals of all target line segments; refer to Figure 8 , project all the straight lines that make up the terminal table onto the y-axis; take out the starting point coordinate ordinate [yn1] and the end point coordinate ordinate [yn2] of the Nth straight line segment to form the ordinate interval [yn1,yn2] of a single terminal straight line; read the ordinate intervals of all terminal straight lines to obtain a ordinate interval set including N ordinate interval ranges [y11,y12],[y21,y22],.....[yn1,yn2].
[0096] S412. Project all the straight lines in the table figure onto the x-axis, and obtain the starting coordinates and the ending coordinates of each target line segment to obtain the horizontal coordinate interval, and obtain the horizontal coordinate interval set according to the horizontal coordinate intervals of all target line segments; based on the same method in step S411, the horizontal coordinate interval set can be obtained, including N horizontal coordinate interval ranges [x11,x12], [x21,x22], .... [xn1,xn2].
[0097] S413. Obtain the coordinates of each data grid according to the ordinate interval set and the abscissa interval set:
[0098] S4131. Perform an intersection judgment on all ordinate intervals in the ordinate interval set, and merge the ordinate intervals with intersection to obtain an integrated ordinate interval set; label each ordinate interval with a ordinate number in sequence according to the coordinate size of the ordinate interval; perform an intersection judgment on all abscissa intervals in the abscissa interval set, and merge the abscissa intervals with intersection to obtain an integrated abscissa interval set; label each abscissa interval with abscissa number in sequence according to the coordinate size of the abscissa interval; that is, perform an intersection judgment on N ordinate / abscissa intervals, merge the intervals with intersection, and retain the intervals without intersection, and finally integrate the N ordinate / abscissa intervals into m ordinate / abscissa intervals and name them (1, 2, ...m); Figure 9 As shown, all the straight lines constituting the terminal table diagram are projected onto the Y axis to form two ordinate intervals, and all the straight lines constituting the terminal table diagram are projected onto the x axis to form two ordinate intervals.
[0099] Among them, in an optional embodiment, after obtaining the integrated vertical coordinate interval set, all terminal straight lines belonging to the first vertical coordinate interval can be read, and the horizontal coordinate xn1 of the starting point coordinate and the horizontal coordinate xn2 of the end point coordinate of a single straight line can be read one by one to form the horizontal coordinate interval [xn1, xn2] of a single terminal straight line, and the N horizontal coordinate interval ranges [x11, x12], [x21, x22], .... [xn1, xn2] of all terminal straight lines belonging to the first vertical coordinate interval are read, and then the horizontal coordinate intervals are integrated; the terminal straight lines belonging to the remaining vertical coordinate intervals are repeated according to the above part, and finally different horizontal coordinate intervals in different vertical coordinate intervals are obtained.
[0100] S4132, obtain the coordinates of each data grid according to the vertical coordinate label and the horizontal coordinate label; Figure 9 As shown, data grid 11 , data grid 12 , data grid 21 , and data grid 22 are formed.
[0101] S5. Match the coordinates of the target text in the cable header information with the coordinates of each data cell to obtain the data cell to which each target text belongs. Specifically:
[0102] S51, reshape the point cloud of all target texts to obtain the point cloud space coordinates corresponding to each target text;
[0103] S52, matching the point cloud space coordinates corresponding to each target text with the coordinates of the data grid to obtain the data grid to which each target text belongs; Figure 10 , is the matching relationship between the target text and the data grid.
[0104] S6. Obtain the row-column relationship and column attributes of each target text, and obtain the secondary cable header document based on the row-column relationship and column attributes of the target text. Specifically:
[0105] S61. Identify all keywords related to cable numbers in the target text; for example, locate the keyword "SCP" in each terminal table, where "SCP" represents the name of the panel, record the located point cloud text information, use the "split" command to separate the text information with the "—" character, and retain the text information after the "—" character, which is the terminal brand name; and obtain the keywords "cable number", "circuit number", and "terminal number" in the first terminal table;
[0106] S62. Take the keyword as a column attribute and obtain the horizontal coordinate of the keyword; that is, take the keyword "cable number", "loop number", and "terminal number" as column attributes, locate their horizontal coordinates in the terminal table, and record them as X. 电缆编号列名 、X 回路号列名 、X 端子号列名 .
[0107] S63, matching the target text with the horizontal coordinates of the keyword to obtain a target paragraph with column attributes; for example, matching the horizontal coordinates X of all the point cloud coordinates in the terminal table to the target paragraph. 点云 With X 电缆编号列名 Matching is performed with an allowable error within 5, i.e. , find all the point clouds that meet the conditions and record them as cable number point clouds; similarly, we can get the points that meet the conditions X 回路号列名 、X 端子号列名 All point clouds are recorded as circuit number point clouds and terminal number point clouds;
[0108] S64, calculate the vertical coordinate difference of all target segments to obtain the row relationship between all target segments; that is, read the vertical coordinates of the cable number point cloud, loop number point cloud, and terminal number point cloud, recorded as Y 电缆编号 、Y 回路号 、Y 端子号 , compare the vertical coordinates of the loop number point cloud, the terminal number point cloud and the cable number point cloud, and allow the error to be within 5, that is, ,Right now , the cable number point cloud, loop number point cloud, and terminal number point cloud that meet the requirements are recorded as peer point clouds;
[0109] S65. Read the target paragraphs in the same row in the target text and sort them according to the order of column attributes to obtain the target row header information; read the text information in the point cloud of the same row and record it as the header information in the format of "circuit number / cable number / terminal ranking + terminal name";
[0110] S66. Obtain a secondary cable header document based on all target line header information;
[0111] Please refer to Figure 11 as well as Figure 12 , taking the point cloud in the first terminal table as an example, first locate the point cloud text "=SCP01+DIA-XACO1" through the keyword "SCP", and then use "-" to separate the text, and retain the text information after "-": "XACO1", "XACO1" is the terminal brand name; Figure 11 As shown in the figure, all point clouds with the absolute value of the vertical coordinate difference of 5 from the point cloud text "cable number", "circuit number" and "terminal number" are found in the point cloud and are considered to be point clouds in the same column; Figure 12 As shown, then judge the point cloud text of the same industry, and save the text judged to be of the same industry line by line in the format of "circuit number / cable number / terminal ranking + terminal number" as Excel, as shown Figure 13 As shown, the final secondary cable header document is obtained.
[0112] Example 2
[0113] Please refer to Figure 14 , an electrical secondary technical data acquisition device, including a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step of the electrical secondary technical data acquisition method described in Example 1 is implemented.
[0114] In summary, the electrician secondary technical data acquisition method and device provided by the present invention is a program developed based on the Python kernel, which can read CAD drawings in batches, obtain text information, and quickly generate standard and accurate cable heads and cable brand executable documents, replacing manual screening and entry operations, saving a lot of labor and time, and speeding up the wiring progress of the renovation project; after obtaining the drawing text point cloud information and graphic shape and coordinate information, the cable model text can be located through keyword recognition, and the text distance is calculated to obtain the cable name and cable direction information, and then edit and save them as cable brand documents; and through After processing the graphic information to obtain the coordinates of the data grid, the data grid is matched with the target text so that each target text is set in the corresponding data grid. Then, the information related to the cable head in the target text is extracted through the row and column relationship and column attributes of the target text to obtain a secondary cable head document. That is, by reading the graphic and text space text point cloud information in the drawing, and restoring the spatial coordinate range of the terminal diagram according to the straight line coordinate interval, and then determining the ownership of the text point cloud according to the spatial coordinates, and restoring and sorting according to the keyword positioning and character ranging algorithm, the drawing information can be restored 100%, and then a standard document can be obtained.
[0115] At the same time, the method of the present invention is different from other methods of using crawling software to grab terminal tables from drawings one by one and convert them into Excel. The solution of the present invention does not require the use of specific software to open CAD drawings and then perform crawling operations in the software; instead, it directly obtains all the graphics and text space coordinate information of different layers in the DXF drawings, and saves the required documents to a specified path according to a specific format. The methods of using software crawling and convolutional neural networks to restore CAD drawings to Excel actually use image recognition methods, which are not suitable for complex terminal drawings, especially when the text information in the terminal drawings overlaps, the border lines of the terminal drawings are not square, etc., the recognition accuracy of the graphics will be greatly reduced; the solution of the present invention uses the coordinate method to locate the coordinate position of the restored graphics and text, which can achieve 100% accurate restoration of the drawing information.
[0116] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's description and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for acquiring electrical secondary technical data, characterized in that: include: Extract cable brand information, cable number information and graphic information from CAD drawings through the software library; Identify the target cable sign and target drawing name corresponding to the target keyword in the cable sign information by using the target keyword; Obtain a cable sign document according to the target cable sign and the target drawing name; Extracting a table graphic from the graphic information and determining the coordinates of each data cell in the table graphic; Matching the coordinates of the target text in the cable header information with the coordinates of each data cell to obtain the data cell to which each target text belongs; Obtaining the row-column relationship and column attributes of each target text, and obtaining a secondary cable header document according to the row-column relationship and column attributes of the target text; The extraction of cable sign information from the CAD drawing through the software library includes: Extracting point cloud data of the cable sign information from the CAD drawing; the point cloud data includes the cable sign text and the point cloud coordinates of the cable sign; The step of identifying a target cable sign corresponding to the target keyword in the cable sign text by using the target keyword comprises: Obtain target cable model text and target cable model point cloud coordinates through the target keyword; Acquire text adjacent to the target cable model text according to the target cable model point cloud coordinates to obtain the target cable number and target cable direction; The extracting of the tabular graphics from the graphic information comprises: Traversing and identifying each graphic in the graphic information, determining whether the traversed target graphic is a straight line type, and if so, retaining the target graphic; Obtain the table graph according to all the retained target graphs; Determining the coordinates of each data grid in the table graph includes: Projecting all straight lines in the table graph onto the y-axis, and obtaining the starting coordinates and the ending coordinates of each target line segment to obtain a vertical coordinate interval; obtaining a vertical coordinate interval set based on the vertical coordinate intervals of all the target line segments; Projecting all straight lines in the table graph onto the x-axis, obtaining the starting coordinates and the ending coordinates of each target line segment to obtain a horizontal coordinate interval, and obtaining a horizontal coordinate interval set based on the horizontal coordinate intervals of all the target line segments; Obtaining the coordinates of each data grid according to the vertical coordinate interval set and the horizontal coordinate interval set; The obtaining of the row-column relationship and column attributes of each target text includes: Identifying all keywords related to the cable header in the target text; Using the keyword as the column attribute and obtaining the horizontal coordinate of the keyword; Matching the target text with the horizontal coordinates of the keywords to obtain a target paragraph with the column attributes; Calculating the vertical coordinate difference of all the target paragraphs to obtain the row relationship between all the target paragraphs; Read the target paragraph in the same row of the target text, and sort it according to the column attribute order to obtain target row number header information; A secondary cable header document is obtained based on all the target line header information.
2. The method for acquiring electrical secondary technical data according to claim 1, characterized in that: The step of acquiring text adjacent to the target cable model text according to the target cable model point cloud coordinates to obtain the target cable number and the target cable direction includes: Calculate the distance between the point cloud coordinates of all texts in the cable sign information and the point cloud coordinates of the target cable model; The minimum two point cloud coordinates with a positive distance difference are queried to obtain the target cable number and the target cable direction.
3. The method for acquiring electrical secondary technical data according to claim 1, characterized in that: The graphic information includes the coordinates of the starting point of the graphic; The step of determining whether the traversed target graphic is a straight line type includes: It is determined whether the target graphic is a straight line type according to the starting point coordinates of the target graphic.
4. The method for acquiring electrical secondary technical data according to claim 1, characterized in that: The step of obtaining the coordinates of each data grid according to the vertical coordinate interval set and the horizontal coordinate interval set includes: Performing an intersection judgment on all the vertical coordinate intervals in the vertical coordinate interval set, and merging the vertical coordinate intervals with intersection to obtain an integrated vertical coordinate interval set; and sequentially labeling the vertical coordinates of each vertical coordinate interval according to the size of the coordinates of the vertical coordinate interval; Performing intersection determination on all the horizontal coordinate intervals in the horizontal coordinate interval set, and merging the horizontal coordinate intervals with intersection to obtain an integrated horizontal coordinate interval set; labeling the horizontal coordinates of each horizontal coordinate interval in turn according to the coordinate size of the horizontal coordinate interval; The coordinates of each data grid are obtained according to the vertical coordinate label and the horizontal coordinate label.
5. The method for acquiring electrical secondary technical data according to claim 4, characterized in that: The matching of the coordinates of the target text in the cable header information with the coordinates of each data grid includes: Reshape the point cloud of all the target texts to obtain the point cloud space coordinates corresponding to each target text; The point cloud space coordinates corresponding to each target text are matched with the coordinates of the data grid to obtain the data grid to which each target text belongs.
6. An electrical secondary technical data acquisition device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, each step of the method for acquiring electrical secondary technical data according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Information capturing method based on CAD electrical schematic diagram
CN116628849A
Method and device for extracting table in target document and computer equipment
CN116776846A