Electrician secondary technical application data acquisition method and device
Through software library extraction and target keyword recognition technology, the low efficiency and high error rate in the acquisition of CAD drawing data of secondary technical CAD is solved, and the rapid and accurate data extraction and document generation are achieved, which is suitable for complex graphic information processing .
Patent Information
- Application Number
- CN202411452138.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-10-17
AI Technical Summary
When obtaining data in the CAD drawings of secondary technical electricians, the problem of manual extraction of information is low efficiency and high error rate, and the method based on convolutional neural network fits the effect when the training set and the drawing are large. It is not possible to identify complex graphics and texts, especially text overlap.
The software library extracts the cable card information, cable number information and graphic information in the CAD drawings, uses the target keyword to identify the cable card and drawing names, extracts the data grid coordinates in the table graphics, and matches the coordinates of the target text and data grids by matching the coordinates of the target text and data grids , obtain the secondary cable header document based on the rank and queue relationship.
It realizes rapid and accurate acquisition of CAD drawing data for electrician secondary technical construction, reduces the need for manual processing, improves the accuracy and efficiency of information extraction, and can handle complex graphic and text information, including text overlap.
Smart Images

Figure CN119296112A_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 electrician secondary technical data. Background Art
[0002] In the power industry, petrochemical industry, and production workshops, it is necessary to transform the equipment based on the CAD drawings of the secondary electrical engineering project. Among them, multiple secondary cables need to be laid when the secondary equipment is transformed. Each secondary cable is usually composed of several or several groups of wires twisted together, and each group of wires is insulated from each other; the entire cable is wrapped with a layer of copper foil shielding layer, and there is a highly insulating covering layer outside the shielding layer. A cable is laid between ground A and ground B, and several wires are wrapped inside. Therefore, it is necessary to print out cable tags and tie them to both ends of the same secondary cable to distinguish different secondary cables. Specific cable numbers need to be printed to distinguish the inner wrapped wires in the same cable.
[0003] At present, there are three main ways to obtain secondary cable number and cable label documents from the CAD drawings of secondary electrical engineering projects. The first is to manually enter the cable number and cable label information on 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, which can be used to manually select and capture a part of the CAD drawing and convert it into an Excel spreadsheet document, and then perform secondary manual processing in the Excel spreadsheet document according to a specific format. However, this solution has the disadvantages of limited capture range, inability to capture in batches, and insufficient capture accuracy.
[0005] The third solution is to read and convert CAD drawings based on convolutional neural networks. This method uses convolutional neural networks to segment the graphics first, and then uses 2D convolution kernels to perform weight calculations on the pixels of the drawings, and then fits an Excel table. However, this method requires a large number of training sets to train, and the model cannot be updated after it is formed. The accuracy of the generated Excel table is determined by the similarity between the drawings fed in and the training set. When the difference between the drawings and the drawings in the training set is too large, the fitting effect decreases linearly. Secondly, when the graphics and text are complex, especially when the text in the graphics overlap on the same layer, the convolution 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 electrician secondary technical data, which can quickly and accurately acquire data in electrician secondary technical CAD drawings.
[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is: A method for acquiring electrician secondary technical data, comprising: Extract cable label information, cable number information and graphic information from CAD drawings through the software library; Identify the target cable sign and the target drawing name corresponding to the target keyword in the cable sign information by using the target keyword; Obtaining 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 grid in the table graphic; Matching the coordinates of the target text in the cable header information with the coordinates of each of the data cells to obtain the data cell to which each of the target text belongs; 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.
[0008] In order to solve the above technical problems, another technical solution adopted by the present invention is: An electrician 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 in the above-mentioned electrician secondary technical data acquisition method is implemented.
[0009] The beneficial effects of the present invention are as follows: by extracting information from CAD drawings through a software library, the problems of low efficiency and high error rate in manual information extraction can be solved; after extracting relevant information, the target cable sign and the target drawing name are identified based on the target keyword and a 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 header in the target text is extracted through the row and column relationship and column attributes of the target text to obtain a secondary cable header 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
[0010] Figure 1 A flowchart of a method for acquiring electrician secondary technical data in an embodiment of the present invention; Figure 2 is the schematic diagram of the drawing to be extracted; Figure 3 Schematic diagram of text point cloud information extracted by the electrician secondary technical data acquisition method in an embodiment of the present invention; Figure 4 It is a schematic diagram of graphic information extracted by the method for acquiring data based on electrical secondary technology in an embodiment of the present invention; 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; Figure 6 A schematic diagram of extracting table graphics in a method for acquiring electrician secondary technical data in an embodiment of the present invention; 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; Figure 8 A schematic diagram of straight line mapping in a method for acquiring electrical secondary technical data in an embodiment of the present invention; Fig. 9 A schematic diagram of generating a data grid in a method for acquiring electrician secondary technical data in an embodiment of the present invention; Fig.10 A 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; Fig.11 A schematic diagram of obtaining column attributes in a method for obtaining electrician secondary technical data in an embodiment of the present invention; Fig.12 It is a schematic diagram of obtaining row relationship in a method for obtaining electrician secondary technical data in an embodiment of the present invention; Fig.13 A schematic diagram of a secondary cable header document in a method for acquiring electrician secondary technical data in an embodiment of the present invention; Fig.14 It is a structural schematic diagram of an electrical secondary technology data acquisition device in an embodiment of the present invention. DETAILED DESCRIPTION
[0011] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.
[0012] Please refer to Figure 1 , a method for acquiring electrician secondary technical data, comprising: Extract cable label information, cable number information and graphic information from CAD drawings through the software library; Identify the target cable sign and the target drawing name corresponding to the target keyword in the cable sign information by using the target keyword; Obtaining 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 grid in the table graphic; Matching the coordinates of the target text in the cable header information with the coordinates of each of the data cells to obtain the data cell to which each of the target text belongs; 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.
[0013] 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 the target drawing name are identified based on the target keywords 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 header in the target text is extracted through the row and column relationship and column attributes of the target text to obtain a secondary cable header 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.
[0014] Further, the extracting of cable sign information in 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 the target cable model text and the target cable model point cloud coordinates through the target keyword; The text adjacent to the target cable model text is acquired according to the point cloud coordinates of the target cable model to obtain the target cable number and the target cable direction.
[0015] 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.
[0016] Further, 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.
[0017] It can be seen from the above description that 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.
[0018] Further, extracting the table graphics in the graphic information includes: 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; The table graph is obtained according to all the retained target graphs.
[0019] It can be seen from the above description that 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.
[0020] Further, the graphic information includes the coordinates of the starting point of the graphic; The step of determining whether the traversed target graph 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.
[0021] 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 straight lines in the graphic information by combining the changes in the x-axis coordinates and the y-axis coordinates.
[0022] Further, the determining the coordinates of each data grid in the table graph includes: Projecting all the straight lines in the table graph onto the y-axis, and obtaining the starting point coordinates and the end point coordinates of each target line segment to obtain a ordinate interval; obtaining a ordinate interval set according to the ordinate intervals of all the target line segments; Projecting all the 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 according to the horizontal coordinate intervals of all the target line segments; The coordinates of each data grid are obtained according to the vertical coordinate interval set and the horizontal coordinate interval set.
[0023] 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 the horizontal coordinate interval respectively, the coordinates of each data grid can be accurately obtained based on the vertical coordinate interval and the horizontal coordinate interval.
[0024] Further, obtaining the coordinates of each data grid according to the ordinate interval set and the abscissa interval set includes: Performing 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; labeling the vertical coordinates of each vertical coordinate interval in turn according to the coordinate size of the vertical coordinate interval; Performing intersection judgment 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 ordinate label and the abscissa label.
[0025] It can be seen from the above description that the integration of redundant intervals is achieved by performing interval integration on the ordinate interval set and the abscissa interval set respectively.
[0026] Furthermore, matching the coordinates of the target text in the cable header information with the coordinates of each of the data cells 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 of the target texts are matched with the coordinates of the data grid to obtain the data grid to which each of the target texts belongs.
[0027] 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 the matching between the target text and the data grid.
[0028] Furthermore, the acquiring of the row-column relationship and column attributes of each target text includes: Identify 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 coordinate of the keyword to obtain a target paragraph with the column attribute; 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 line of the target text, and sort it according to the column attribute order to obtain target line number header information; A secondary cable header document is obtained based on all the target line header information.
[0029] 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 the target paragraphs in the same row and sorting them according to the order of column attributes to obtain an accurate secondary cable header document.
[0030] 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.
[0031] The electrician secondary technical data acquisition method and device provided by the present invention can be applied to the acquisition of secondary cable numbers and cable brand documents in CAD drawings of electrician secondary technical transformation projects in the power industry, petrochemical industry, and production workshops. The following is an explanation through specific implementation methods: Embodiment 1 Please refer to Figure 1 , a method for acquiring electrician secondary technical data, comprising: S1. Extract cable sign information, cable number information and graphic information from CAD drawings through software libraries; for example, programs developed based on the Python kernel, existing open source programs can batch read mainstream CAD drawing formats such as dwg and dxf to 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.
[0032] S2, identifying the target cable sign and the target drawing name corresponding to the target keyword in the cable sign information by using the target keyword, specifically comprising the following steps: 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 5The 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 split, becomes "ZR-KVVP2 / 22-1", "4X2.5", and continue to use "split" 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; S22. 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 the target cable direction; in an optional implementation, 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., taking the target cable model point cloud coordinates as a subtrahend) to obtain the target cable number and the target cable direction; 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 (such as Figure 5 2 in the figure) and the cable routing (e.g. 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 with 2.
[0033] S3. Get the cable sign document according to the target cable sign and the target drawing name, specifically: Please refer to Figure 7 , classify the drawing names to get the number of rows of the drawing cabinet, and convert 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 label 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.
[0034] S4, extracting a table graphic from the graphic information, and determining the coordinates of each data cell in the table graphic; S41, traverse each graphic in the identified graphic information, determine whether the traversed target graphic is a straight line type, if so, retain the target graphic, and finally obtain a table graphic based on all the retained target graphics; Wherein, judging whether the traversed target graphic is a straight line type includes: judging whether the target graphic is a straight line type according to the coordinates of the starting point of the target graphic; in an optional implementation, it is implemented in the following manner: S411. Project all the straight lines in the table figure onto the y-axis, and obtain the starting point coordinates and the end point coordinates of each target line segment to obtain the ordinate interval; obtain a ordinate interval set according to 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].
[0035] 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 a horizontal coordinate interval set according to the horizontal coordinate intervals of all target line segments; based on the same method in step S411, a horizontal coordinate interval set can be obtained, including N horizontal coordinate interval ranges [x11,x12], [x21,x22], .... [xn1,xn2].
[0036] S413. Obtain the coordinates of each data grid according to the ordinate interval set and the abscissa interval set: S4131. Perform 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 turn according to the coordinate size of the ordinate interval; perform 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 turn according to the coordinate size of the abscissa interval; that is, perform 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); Fig. 9As 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.
[0037] 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 the 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.
[0038] S4132, obtaining the coordinates of each data grid according to the ordinate label and the abscissa label; Fig. 9 As shown, data grid 11 , data grid 12 , data grid 21 , and data grid 22 are formed.
[0039] S5. Match the coordinates of the target text in the cable header information with the coordinates of each data grid to obtain the data grid to which each target text belongs. Specifically: S51, reshape the point cloud of all target texts to obtain the point cloud space coordinates corresponding to each target text; 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; Fig.10 , is the matching relationship between the target text and the data grid.
[0040] S6. Obtain the row-column relationship and column attributes of each target text, and obtain the secondary cable header document according to the row-column relationship and column attributes of the target text. Specifically: S61, identifying all keywords related to the cable number in the target text; for example, locating the point cloud in each terminal table by the keyword "SCP", "SCP" represents the name of the panel cabinet, recording the located point cloud text information, using the "split" command, separating the text information with the "—" character, retaining the text information after the "—", which is the terminal brand name; and obtaining the keywords "cable number", "loop number", and "terminal number" in the first terminal table; S62, taking the keyword as a column attribute and obtaining the horizontal coordinate of the keyword; that is, taking the keywords "cable number", "loop number", and "terminal number" as column attributes, locating their horizontal coordinates in the terminal table, recorded as X 电缆编号列名 , X回路号列名 , X 端子号列名 .
[0041] 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 点云 With X 电缆编号列名 Matching is performed with an allowable error within 5, that is, , 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 X 回路号列名 , X 端子号列名 All point clouds are recorded as circuit number point clouds and terminal number point clouds; S64, calculate the vertical coordinate difference of all target sections to obtain the row relationship between all target sections; that is, read the vertical coordinates of the cable number point cloud, the loop number point cloud, and the terminal number point cloud, recorded as Y 电缆编号 , Y 回路号 , Y 端子号 , compare the ordinates of the loop number point cloud, the terminal number point cloud and the cable number point cloud, with an allowable error 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; S65, read the target paragraph of the same line in the target text, and sort it according to the column attribute order to obtain the target line header information; read the text information in the point cloud of the same line, and record it as the header information according to the format of "loop number / cable number / terminal ranking+terminal name"; S66, obtaining a secondary cable header document according to all target line header information; Please refer to Fig.11 as well as Fig.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 keep the text information after "-": "XACO1", "XACO1" is the terminal brand name; Fig.11 As shown in the figure, all point clouds whose absolute value of the vertical coordinate difference with the point cloud text "cable number", "loop number" and "terminal number" is 5 are found in the point cloud and are considered to be point clouds in the same column; Fig.12 As shown, the same point cloud text is judged, and the text judged to be in the same line is saved as Excel line by line according to the format of "loop number / cable number / terminal ranking + terminal number", such as Fig.13 As shown, the final secondary cable header document is obtained.
[0042] Embodiment 2 Please refer to Fig.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 an electrical secondary technical data acquisition method as described in Example 1 is implemented.
[0043] 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 correct cable number 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 can be calculated to obtain the cable name and cable direction information, and then edit and save it as a cable brand document; 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, 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, 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 attribution of the text point cloud according to the spatial coordinates, and restoring and sorting according to the keyword positioning and character ranging algorithm, it can achieve 100% restoration of the drawing information, and then obtain a standard document.
[0044] At the same time, the method of the present invention is different from other methods of grabbing terminal tables from drawings one by one and converting them into Excel. The solution of the present invention does not need to use specific software to open CAD drawings, and then perform grabbing operations in the software; instead, it directly obtains all graphics and text space coordinate information of different layers in DXF drawings, and saves the required documents to the specified path according to a specific format. The method of using software to grab and the convolutional neural network to restore CAD drawings to Excel actually use the method of image recognition, which is not competent 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; and 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.
[0045] 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 specification 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 label information, cable number information and graphic information from CAD drawings through the software library; Identify the target cable sign and the target drawing name corresponding to the target keyword in the cable sign information by using the target keyword; Obtaining 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 grid in the table graphic; Matching the coordinates of the target text in the cable header information with the coordinates of each of the data cells to obtain the data cell to which each of the target text belongs; 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.
2. The method for acquiring electrical secondary technical data according to claim 1, characterized in that: The extraction of cable sign information in the CAD drawing by 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 the target cable model text and the target cable model point cloud coordinates through the target keyword; The text adjacent to the target cable model text is acquired according to the point cloud coordinates of the target cable model to obtain the target cable number and the target cable direction.
3. The method for acquiring electrical secondary technical data according to claim 2, 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 comprises: 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.
4. The method for acquiring electrical secondary technical data according to claim 1, characterized in that: The extracting of the table graphics in 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; The table graph is obtained according to all the retained target graphs.
5. The method for acquiring electrical secondary technical data according to claim 4, characterized in that: The graphic information includes the coordinates of the starting point of the graphic; The step of determining whether the traversed target graph 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.
6. The method for acquiring electrical secondary technical data according to claim 4, characterized in that: Determining the coordinates of each data grid in the table graph includes: Projecting all the straight lines in the table graph onto the y-axis, and obtaining the starting point coordinates and the end point coordinates of each target line segment to obtain a ordinate interval; obtaining a ordinate interval set according to the ordinate intervals of all the target line segments; Projecting all the 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 according to the horizontal coordinate intervals of all the target line segments; The coordinates of each data grid are obtained according to the vertical coordinate interval set and the horizontal coordinate interval set.
7. The method for acquiring electrical secondary technical data according to claim 6, characterized in that: The step of obtaining the coordinates of each data grid according to the ordinate interval set and the abscissa interval set includes: Performing 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; labeling the vertical coordinates of each vertical coordinate interval in turn according to the coordinate size of the vertical coordinate interval; Performing intersection judgment 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 ordinate label and the abscissa label.
8. The method for acquiring electrical secondary technical data according to claim 7, characterized in that: The step of matching the coordinates of the target text in the cable header information with the coordinates of each of the data cells comprises: 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 of the target texts are matched with the coordinates of the data grid to obtain the data grid to which each of the target texts belongs.
9. The method for acquiring electrical secondary technical data according to claim 1, characterized in that: The step of obtaining the row-column relationship and column attributes of each target text includes: Identify 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 coordinate of the keyword to obtain a target paragraph with the column attribute; 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 line of the target text, and sort it according to the column attribute order to obtain target line number header information; A secondary cable header document is obtained based on all the target line header information.
10. 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 as described in any one of claims 1 to 9 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
Cad drawing retrieving device and computer-readable recording medium recorded with cad drawing retrieving program
JP2000011006A
System for extracting text from CAD files
US5895473A