Electrical secondary terminal diagram batch identification method based on Autodesk AutoCAD

By adopting the dual optimization strategy of feature recognition and tolerance determination on the Autodesk AutoCAD platform, batch recognition of electrical secondary terminal diagrams is realized, solving the problem of low manual recognition efficiency and improving identification accuracy and efficiency.

CN119992584APending Publication Date: 2025-05-13NORTHWEST ENGINEERING CORPORATION LIMITED
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510110318.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

The existing manual electrical secondary terminal diagram identification operation efficiency is low and cannot meet the needs of electrical equipment wiring and problem-solving, especially when the drawing standards of different electrical equipment manufacturers are not unified.

Method used

The batch recognition method of electrical secondary terminal diagram based on Autodesk AutoCAD is adopted, and batch selection and recognition are realized through the dual optimization strategy of feature recognition and tolerance determination, and interfering elements are automatically eliminated, thus saving manual operation costs.

Benefits of technology

It realizes automated terminal diagram recognition, improves operation efficiency, and can accurately identify drawing errors and complex primitives, meeting the data coordination needs between different platforms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119992584A_ABST
    Figure CN119992584A_ABST
Patent Text Reader

Abstract

The invention discloses a batch identification method for electrical secondary terminal diagrams based on Autodesk AutoCAD. The batch identification method comprises the following steps: starting initialization and confirming identification characteristics and tolerance values; frame-selecting CAD basic element objects of a target area in the drawing to obtain an object set; calling a corresponding strategy mode to analyze all object sets, and displaying formatted data; and editing the displayed formatted data, and outputting a database file in a DB format. According to the invention, based on a dual optimization strategy of feature identification and tolerance determination, batch selection and batch identification can be realized, interference elements can be automatically eliminated, identification objects do not need to be accurately selected, and the manual operation cost is saved; in addition, drawing errors can be automatically judged, even if drawing errors such as uneven line joints and repeated and overlapped primitives exist in the table, correct judgment and recognition can still be carried out, the problem that only accurate tables can be recognized in the prior art is solved, and the recognition requirements that drawing sources are various and quality cannot be controlled in actual engineering projects are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of electrical secondary professional design and BIM application technology, and specifically relates to a batch recognition method for electrical secondary terminal drawings based on Autodesk AutoCAD. Background Art

[0002] The electrical secondary terminal diagram is one of the important design documents that guides construction units to complete the wiring of electrical equipment, analyze and eliminate on-site problems, and verify the functions of various systems. The terminal diagram is a construction drawing that reflects the wiring on the terminal block in the cabinet, and mainly focuses on the expression of information such as external cable connection and short wiring. In the process of electrical secondary professional design work, the drawing of terminal diagrams, information filling, wiring proofreading, and adjustment and modification are time-consuming and labor-intensive, and the workload is huge, which takes up a lot of valuable working time of designers.

[0003] Considering that there is no unified drawing standard among different electrical equipment manufacturers, in order to cope with the explosive growth trend of hydropower and pumped storage business, the efficiency of manual operation of terminal diagrams can no longer meet the development of related professions. In order to keep pace with the design development trend and more efficiently realize data collaboration between different platforms, the recognition and analysis operations of drawing data must be intelligent. Summary of the invention

[0004] The purpose of the present invention is to provide a method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD, which solves the problem of low operating efficiency of existing manual terminal diagram recognition.

[0005] The technical solution adopted by the present invention is: a method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD, comprising the following steps: Step 1. Open the CAD drawing containing the electrical secondary terminal diagram, start initialization and confirm the identification features and tolerance values; Step 2: Select the CAD basic element objects in the target area of ​​the drawing to obtain an object set; Step 3: Call the corresponding strategy mode to analyze all object collections and display formatted data; Step 4: Repeat steps 2 and 3 as needed; Step 5: Edit the displayed formatted data and output the database file in DB format.

[0006] The present invention is also characterized in that: Step 1 specifically includes the following steps: Step 1.1, create a configuration file named TerminalConfig; Step 1.2: Add the text "switchStates=x" to the file to indicate the serial number of the identification feature, where x is the state code; Step 1.3, set the display format of the data according to the identification features; Step 1.4. Set the tolerance values ​​for horizontal tolerance, vertical tolerance, combined tolerance and connection tolerance.

[0007] Step 2 specifically includes the following steps: Step 2.1, select the CAD basic element object in the target area of ​​the drawing; Step 2.2: Process all basic element objects in the selected area, exclude objects containing erroneous data, and save the object IDs as an array of AcDbObjectIdArray type; Step 2.3: Read the tolerance value set in step 1.4 and save it in double type.

[0008] Step 3 specifically includes the following steps: Step 3.1, according to the feature number identified in step 1.3, select the strategy mode for identification; Step 3.2, input the ID queue saved in step 2.2 and the four tolerance values ​​saved in step 2.3 into the terminal table analysis tool TableParser; Step 3.3: Call the strategy mode selected in step 3.1 to perform data analysis. The strategy mode is divided into three types; Step 3.4, traverse the ID queue, obtain the object type through the AcDbEntity::isA() interface, and save the line segments and polylines as oSetLines and oSetPolyLines collections respectively; Step 3.5, through the AcDbPolyline::getWidthsAt() interface, traverse and find the polylines with a line width greater than 1 in oSetPolyLines, save them as the oThickLines collection, and delete the objects found in oSetPolyLines accordingly; Step 3.6, split the remaining polylines in oSetPolyLines into line segments and add all of them to the oSetLines set; Step 3.7, traverse all objects again, find the circular objects, and add them all to the oPinSymbol collection as terminal symbols; Step 3.8, divide all line segments in oSetLines into horizontal lines and vertical lines, and save them into two sets oHorizontalLines and oVerticalLines respectively; Step 3.9, separate the general vertical lines and terminal symbol connecting lines from oVerticalLines, save the terminal symbol connecting lines as an oPinConSymbol set, delete the corresponding objects from oVerticalLines, and only keep the general vertical lines; if the coordinates of any point of the starting point or the end point of the vertical line are above or within any circle in the terminal symbol set oPinSymbol, then it is determined that the vertical line belongs to the terminal symbol connecting line; Step 3.10, overlap and merge the line segments in oHorizontalLines. If the distance between two line segments is less than the merging tolerance, they are considered to be logically identical line segments and merged into one line segment. Step 3.11, overlap and merge the line segments in oVerticalLines. If the distance between two line segments is less than the merging tolerance, they are considered to be logically identical line segments and merged into one line segment. Step 3.12, traverse all objects again, find the text objects, including AcDbText and AcDbMText, and add them all to the oTexts collection as text objects; Step 3.13, integrate oPinSymbol and oPinConSymbol to form a PinSymbol set, each PinSymbol object contains a line segment and two circles, and the two circles intersect with the start point and end point of a line segment respectively; Step 3.14, continue to integrate PinSymbol. If two PinSymbol objects both contain the same circle, it is determined that the PinSymbol objects can be connected. The two PinSymbol objects are combined into a new object. Only one of the same circle is retained. The oPinGroups object set is formed through a loop. Step 3.15, construct a rectangle through oHorizontalLines and oVerticalLines; Step 3.16, through the table composed of each rectangle and internal elements, determine whether the first row is a title row. If the rectangle has a title row, it is determined to be a logical rectangle, and the remaining rectangles are not retained. The logical rectangles that pass the judgment are added to the oLogicRectanglesAll collection; Step 3.17, construct a logical table based on the horizontal and vertical lines in the logical rectangle and range, compare the coordinates of the center point of the bounding box of the text object with the bounding box coordinates of the cell formed by the horizontal and vertical lines, determine the position of each text object relative to the table, and then construct a virtual table to add the text object information, the position of the terminal symbol and the short circuit information; Step 3.18: Group virtual tables by title, and merge virtual tables in the same group into one table; Step 3.19: Display the titles of the virtual table in sequence on the interface. When the user clicks on a title, the short-circuit information and other data of the corresponding virtual table are displayed on different interfaces.

[0009] In step 3.8, the horizontal line and the vertical line are judged as follows: if the absolute value of the difference between the Y coordinate of the starting point and the Y coordinate of the end point of the line segment is less than the horizontal tolerance, it is judged as a horizontal line; if the absolute value of the difference between the X coordinate of the starting point and the X coordinate of the end point of the line segment is less than the vertical tolerance, it is judged as a vertical line.

[0010] The way to construct a rectangle using oHorizontalLines and oVerticalLines in step 3.15 is as follows: the two endpoints of the horizontal line are recorded as the left endpoint and the right endpoint respectively, and the two endpoints of the vertical line are recorded as the upper endpoint and the lower endpoint respectively according to the direction of the coordinate axis. Each rectangle is composed of two horizontal lines and two vertical lines connected end to end; first, take out a horizontal line from oHorizontalLines, recorded as h1, then find out the vertical line whose upper endpoint is connected to the left endpoint of h1 from oVerticaLines, recorded as v1, and then find out another vertical line whose upper endpoint is connected to the right endpoint of h1, recorded as v2, and finally Then find a horizontal line from oHorizontalLines, whose left endpoint connects the lower endpoint of v1 and the right endpoint connects the lower endpoint of v2, recorded as h2; if the four lines h1, h2, v1, and v2 can be found, a rectangle can be constructed; if the distance between the two endpoints is equal to 0, it is called a connection; the connection tolerance is considered during construction, and if the endpoint distance is greater than 0 but less than the connection tolerance, it is still determined to be a connection; after all vertical and horizontal lines that can be constructed into rectangles are constructed into rectangles, a temporary object set is set according to the range of the rectangle, and all remaining elements are added to the corresponding temporary object set according to the coordinate belonging range, and this step is repeated to construct all possible rectangles.

[0011] The formatted data edited and displayed in step 5 is specifically as follows: edit the short circuit information, each line of data uses a number as the identifier of the short circuit information, if the short circuit information of two lines is the same, it means the same group of short circuits; if it is 0, it means there is no short circuit, and after editing the short circuit information, it is updated to the interface display in text mode.

[0012] In step 5, the data of all virtual tables are exported to a DB format file. The DB file contains 3 tables and outputs a DB format database file.

[0013] The beneficial effects of the present invention are as follows: the electrical secondary terminal diagram batch recognition method based on Autodesk AutoCAD of the present invention can realize batch selection and batch recognition based on the dual optimization strategy of "feature recognition + tolerance judgment", and can automatically exclude interfering elements, without the need to accurately select recognition objects, thus saving manual operation costs; it can also realize automatic judgment of drawing errors, even if there are drawing errors such as uneven line junctions and repeated overlapping of graphic elements in the table, it can still be correctly judged and recognized, overcoming the problem that the prior art can only recognize precise tables, and meeting the recognition needs of actual engineering projects with a variety of drawing sources and uncontrollable quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 It is a flow chart of a method for batch identifying electrical secondary terminal diagrams based on Autodesk AutoCAD of the present invention; Figure 2 It is a schematic diagram of electrical secondary terminal diagram style 1 supported by the electrical secondary terminal diagram batch recognition method based on Autodesk AutoCAD of the present invention; Figure 3 It is a schematic diagram of electrical secondary terminal diagram style 2 supported by the electrical secondary terminal diagram batch recognition method based on Autodesk AutoCAD of the present invention; Figure 4 It is a schematic diagram of electrical secondary terminal diagram style 3 type supported for recognition by the electrical secondary terminal diagram batch recognition method based on Autodesk AutoCAD of the present invention; Figure 5 It is a program interface diagram of a method for batch identifying electrical secondary terminal diagrams based on Autodesk AutoCAD of the present invention; Figure 6 It is a format diagram of the first table in the DB file output by the electrical secondary terminal diagram batch recognition method program based on Autodesk AutoCAD of the present invention; Figure 7 It is a format diagram of the second table in the DB file output by the electrical secondary terminal diagram batch recognition method program based on Autodesk AutoCAD of the present invention; Figure 8 The present invention is a schematic diagram of the format of the third table in the DB file output by the electrical secondary terminal diagram batch recognition method program based on Autodesk AutoCAD. DETAILED DESCRIPTION

[0015] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.

[0016] Example 1 The present invention provides a method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD, comprising the following steps: Step 1. Open the CAD drawing containing the electrical secondary terminal diagram, start initialization, and confirm the identification features and tolerance values; Step 2: Manually select a certain range of CAD basic element objects in the drawing to obtain an object set; Step 3: Call the corresponding strategy mode, analyze all object collections, and display formatted data; Step 4. Repeat steps 2 and 3. You can add analysis data as many times as needed. Continue to select the area to be identified. After each identification, the successfully identified content will be added to the interface. Step 5: Manually edit the display data, output all display data, and save it as a database file in DB format.

[0017] Example 2 The present invention provides a method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD. Based on Embodiment 1, step 1 preferably comprises the following steps: Step 1.1, create a text file named TerminalConfig. If the file already exists, read the data directly; Step 1.2, add a line of text "switchStates=0" to the text file to indicate the serial number of the identification feature; Step 1.3: Different recognition features can identify different data formats. The program interface will reset the table format of the displayed data on the interface according to the currently selected recognition feature. Step 1.4: The program sets the four tolerance values ​​of horizontal tolerance, vertical tolerance, combined tolerance, and connection tolerance to 2.5 by default. Users can set the tolerance values ​​by themselves. If there is no need to reset them, skip this step.

[0018] Example 3 The present invention provides a method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD. Based on Embodiment 1, step 2 preferably comprises the following steps: Step 2.1, manually select any range of CAD basic element objects, without selecting only a specific electrical secondary terminal diagram; Step 2.2: Process all basic element objects within the selected range, exclude objects containing erroneous data, and save the object IDs as an array of AcDbObjectIdArray type; Step 2.3: Read the horizontal tolerance, vertical tolerance, merge tolerance, and connection tolerance, and save them in double type.

[0019] Example 4 The present invention provides a method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD. Based on Example 1, step 3 preferably comprises the following steps: Step 3.1, according to the identification feature number in step 1.3, select the strategy mode for identification; Step 3.2, input the ID queue saved in step 2.2 and the four tolerance values ​​saved in step 2.3 into the terminal table analysis tool TableParser; Step 3.3: Call the identification strategy selected in step 3.1 to perform data analysis. The strategy mode is divided into three types; Step 3.4, traverse the ID queue, obtain the object type through the AcDbEntity::isA() interface, and save the line segments and polylines as oSetLines and oSetPolyLines collections respectively; Step 3.5, through the AcDbPolyline::getWidthsAt() interface, traverse and find the polylines with a line width greater than 1 in oSetPolyLines, save them as the oThickLines collection, and delete the objects found in oSetPolyLines accordingly; Step 3.6, split the remaining polylines in oSetPolyLines into line segments and add all of them to the oSetLines set; Step 3.7, traverse all objects again, find the circular objects, and add them all to the oPinSymbol collection as terminal symbols; Step 3.8, divide all line segments in oSetLines into horizontal lines and vertical lines, and save them in two sets, oHorizontalLines and oVerticalLines. Make the following judgment for each line: if the absolute value of the difference between the Y coordinate of the starting point and the Y coordinate of the end point of the line segment is less than the horizontal tolerance, it is judged as a horizontal line; if the absolute value of the difference between the X coordinate of the starting point and the X coordinate of the end point of the line segment is less than the vertical tolerance, it is judged as a vertical line; Step 3.9, separate the general vertical lines and terminal symbol connecting lines from oVerticalLines, save the terminal symbol connecting lines as oPinConSymbol set, and delete the corresponding objects from oVerticalLines, leaving only the general vertical lines. If the coordinates of any point of the starting point or end point of the vertical line are above or within any circle in the terminal symbol set oPinSymbol, then the vertical line is determined to belong to the terminal symbol connecting line; Step 3.10, overlap and merge the line segments in oHorizontalLines. If the distance between two line segments is less than the merging tolerance, they are considered to be logically identical line segments and merged into one line segment. Step 3.11, overlap and merge the line segments in oVerticalLines. If the distance between two line segments is less than the merging tolerance, they are considered to be logically identical line segments and merged into one line segment. Step 3.12, traverse all objects again, find the text objects, including AcDbText and AcDbMText, and add them all to the oTexts collection as text objects; Step 3.13, integrate oPinSymbol and oPinConSymbol to form a PinSymbol set. Each PinSymbol object contains a line segment and two circles. The circles intersect with the starting point and end point of the line segment respectively. Step 3.14, continue to integrate PinSymbol. If two PinSymbol objects contain the same circle, it is determined that the PinSymbol objects can be connected. The two objects are combined into a new object, and only one of the same circle is retained. Through the cycle combination into an oPinGroups object set, each object in the oPinGroups set can have multiple circles and multiple terminal symbol connection lines, and each object no longer contains the same circle; Step 3.15. Construct a rectangle using oHorizontalLines and oVerticalLines. The two endpoints of the horizontal line are called the left endpoint and the right endpoint respectively, and the two endpoints of the vertical line are called the upper endpoint and the lower endpoint respectively according to the coordinate axis direction. Each rectangle is composed of two horizontal lines and two vertical lines connected end to end. First, take a horizontal line from oHorizontalLines, denoted as h1, then find a vertical line from oVerticaLines whose upper endpoint is connected to the left endpoint of h1, denoted as v1, then find another vertical line whose upper endpoint is connected to the right endpoint of h1, denoted as v2, and finally find a horizontal line from oHorizontalLines whose left endpoint is connected to the lower endpoint of v1 and whose right endpoint is connected to the lower endpoint of v2, denoted as h2. If four lines h1, h2, v1, and v2 that meet the conditions can be found, then this group of lines can construct a rectangle. If the distance between the two endpoints is equal to 0, it is called a connection. The connection tolerance is considered during construction. If the distance between the endpoints is greater than 0 but less than the connection tolerance, it is still determined to be a connection. After all vertical lines and horizontal lines that can be constructed into rectangles are constructed into rectangles, a temporary object set is set according to the range of the rectangle, and all other elements are added to the corresponding temporary object set according to the coordinate range. This step is repeated to construct all possible rectangles. Step 3.16, through the table formed by each rectangle and the internal elements, determine whether the first row is a title row. If the rectangle has a title row, it is determined to be a logical rectangle, and the other rectangles that do not meet the conditions are not retained. The logical rectangles that pass the judgment are added to the oLogicRectanglesAll collection; Step 3.17, construct a logical table based on the logical rectangle and the horizontal and vertical lines within the range, compare the coordinates of the center point of the bounding box of the text object with the bounding box coordinates of the cell formed by the horizontal and vertical lines, determine the position of each text object relative to the table, and then construct a virtual table, add the text object information, the position of the terminal symbol and the connection information (called short circuit information) into it; Step 3.18: Group virtual tables by title, and merge virtual tables in the same group into one table; Step 3.19: Display the titles of the virtual table in sequence on the interface. When the user clicks on a title, the short-circuit information and other data of the corresponding virtual table are displayed on different interfaces respectively.

[0020] Example 5 The present invention provides a method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD. Based on Embodiment 1, step 5 preferably comprises the following steps: Step 5.1, manually edit the identified data, or add or delete data; Step 5.2, manually edit the short circuit information. Each line of data uses a number as the identifier of the short circuit information. If the short circuit information of two lines is the same, it means the same group of short circuits. If it is 0, it means there is no short circuit. After editing the short circuit information, it will be updated to the interface display in text mode in time. Step 5.3: Manually export the data of all virtual tables into a DB format file. The DB file contains 3 tables. The specific table format may have detailed differences depending on the selected recognition features.

[0021] Example 6 The present invention provides a method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD, such as Figure 1 As shown, the specific implementation steps are as follows: S1: In order to improve the operation efficiency and make the program remember the last selected identification feature type, it is necessary to create a configuration file in advance to record the last identification feature selection status of the program. The file name is TerminalConfig, and the content is "switchStates=x", where x is the status code. There are three preset identification features, and the status codes are 0, 1, and 2. When the status code is 0, the corresponding feature type is as follows: Figure 2 As shown, when the status code is 1, the corresponding feature type is Figure 3As shown, when the status code is 2, the corresponding feature type is Figure 4 The present invention is extensible and adopts a computer program design strategy mode, and it is easy to add new identification feature types to it to support the identification of drawings of more manufacturers.

[0022] S2: Taking the identification feature type code 0 as an example, if the last recorded feature type code is not 0, the user manually selects the identification feature as "Type 1", and then can use the CAD selection function to select multiple elements on the drawing at one time, and organize the selected multiple elements into a set for processing through the Autodesk development interface.

[0023] S3: According to the input of the recognition feature type code 0, the program determines to call the type 1 recognition strategy, and then inputs the horizontal tolerance, vertical tolerance, merge tolerance, and connection tolerance as parameters into the type 1 recognition strategy for saving.

[0024] S4: Type 1 recognition strategy will traverse the ID queue of the element set through the CAD development interface, find out all line segments and polylines, determine the vertical lines and horizontal lines to form sets through tolerance values, and through the judgment of the circle, select the circle and the vertical lines connected to the circle again to form a terminal symbol set, and then regroup and allocate the terminal symbols according to the connection status to form a continuous terminal symbol set.

[0025] S5: Select the line segments that can form the table border within the tolerance range through permutations and combinations to form a rectangle, repeat this step to combine all possible rectangles, and then delete all objects whose coordinates are not within any rectangle from the element set.

[0026] S6: According to the coordinate positions of the remaining elements, the remaining elements in the set are allocated to all rectangles in S3 to form a set queue, and the intersection and relative position analysis of the elements of each set are performed in turn to construct a virtual table and establish a virtual table data structure.

[0027] S7: Analyze the coordinates of the continuous terminal symbols and assign the continuous terminal symbols to the virtual table data structure according to their range. In order to solve the problem that a single table is drawn into multiple adjacent tables due to length problems, the data of tables with the same title should be connected to form a new complete table. At this point, the construction of the virtual table is completed, and the data of the hand-drawn table has been formatted according to the type 1 feature.

[0028] S8: After the virtual table is constructed, Figure 5As shown, the title of the table that has been recognized is displayed in the program. If the table is not correctly recognized, the title of the table that failed to be recognized will not be displayed here. The user clicks the table title, and the program displays the corresponding table data in the interface table and the short circuit information box. The interface table may have different numbers of columns and different titles according to different feature selections. Taking type 1 as an example, there are 5 column titles. The first column is "Short Circuit", and the short circuit status of the current row is identified by numbers. Rows with short circuit relationships are identified with the same number. Figure 2 As shown in the figure, the two lines with terminal numbers 1 and 2 are connected by terminal symbols, and it is determined that the two lines 1 and 2 have a short-circuit relationship, so in Figure 5 In the short-circuit column, the two rows with terminal numbers 1 and 2 have the same short-circuit value "1". In the short-circuit information box, (1, 2) is used to indicate that the terminals in the brackets have a short-circuit relationship; the second column is "In-panel device 1", corresponding to Figure 2 The data in the column titled "Instruments in the Panel"; the third column is "Terminal Number", corresponding to Figure 2 The data in the column titled "Terminal Number"; the fourth column is "Circuit Number", corresponding to Figure 2 The data in the column titled "Circuit Number"; the fifth column is "Content Description", corresponding to Figure 2 The data in the column titled "Description" in the .

[0029] S9: After the user modifies the data through the interface operation, the data is output to a database file in DB format. There are three database tables in the file. The file is opened through the DB Browser (SQLite) tool. The first table is as follows Figure 6 As shown in the figure, the table name and short circuit information in the output data are recorded; the second table is as follows Figure 7 As shown in the figure, the main contents of the output data are recorded. Since the type 1 feature only has a single column of instruments on the screen, the InstrumentNumber2 column is NULL; the third table is as follows Figure 8 As shown in the figure, the number of rows in the LogicalEquipment and OperateType tables is recorded. This DB file can be directly applied to other steps of professional work.

Claims

1. A batch recognition method for electrical secondary terminal diagrams based on Autodesk AutoCAD, characterized in that: The following steps are involved: Step 1. Open the CAD drawing containing the electrical secondary terminal diagram, start initialization and confirm the identification features and tolerance values; Step 2: Select the CAD basic element objects in the target area of ​​the drawing to obtain an object set; Step 3: Call the corresponding strategy mode to analyze all object collections and display formatted data; Step 4: Repeat steps 2 and 3 as needed; Step 5: Edit the displayed formatted data and output the database file in DB format.

2. The method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD as claimed in claim 1, characterized in that: The step 1 specifically comprises the following steps: Step 1.1, create a configuration file named TerminalConfig; Step 1.2, add the text "switchStates=x" to the file to indicate the serial number of the identification feature, where x is the state code; Step 1.3, set the display format of the data according to the identification features; Step 1.

4. Set the tolerance values ​​for horizontal tolerance, vertical tolerance, combined tolerance and connection tolerance.

3. The method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD as claimed in claim 2, characterized in that: The step 2 specifically includes the following steps: Step 2.1, select the CAD basic element object in the target area of ​​the drawing; Step 2.2: Process all basic element objects in the selected area, exclude objects containing erroneous data, and save the object IDs as an array of AcDbObjectIdArray type; Step 2.3: Read the tolerance value set in step 1.4 and save it in double type.

4. The method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD as claimed in claim 3, characterized in that: The step 3 specifically comprises the following steps: Step 3.1, according to the feature number identified in step 1.3, select the strategy mode for identification; Step 3.2, input the ID queue saved in step 2.2 and the four tolerance values ​​saved in step 2.3 into the terminal table analysis tool TableParser; Step 3.3: Call the strategy mode selected in step 3.1 to perform data analysis. The strategy mode is divided into three types; Step 3.4, traverse the ID queue, obtain the object type through the AcDbEntity::isA() interface, and save the line segments and polylines as oSetLines and oSetPolyLines collections respectively; Step 3.5, through the AcDbPolyline::getWidthsAt() interface, traverse and find the polylines with a line width greater than 1 in oSetPolyLines, save them as the oThickLines collection, and delete the objects found in oSetPolyLines accordingly; Step 3.6, split the remaining polylines in oSetPolyLines into line segments and add all of them to the oSetLines set; Step 3.7, traverse all objects again, find the circular objects, and add them all to the oPinSymbol collection as terminal symbols; Step 3.8, divide all line segments in oSetLines into horizontal lines and vertical lines, and save them into two sets oHorizontalLines and oVerticalLines respectively; Step 3.9, separate the general vertical lines and terminal symbol connecting lines from oVerticalLines, save the terminal symbol connecting lines as an oPinConSymbol set, delete the corresponding objects from oVerticalLines, and only keep the general vertical lines; if the coordinates of any point of the starting point or the end point of the vertical line are above or within any circle in the terminal symbol set oPinSymbol, then it is determined that the vertical line belongs to the terminal symbol connecting line; Step 3.10, overlap and merge the line segments in oHorizontalLines. If the distance between two line segments is less than the merging tolerance, they are considered to be logically identical line segments and merged into one line segment. Step 3.11, overlap and merge the line segments in oVerticalLines. If the distance between two line segments is less than the merging tolerance, they are considered to be logically identical line segments and merged into one line segment. Step 3.12, traverse all objects again, find the text objects, including AcDbText and AcDbMText, and add them all to the oTexts collection as text objects; Step 3.13, integrate oPinSymbol and oPinConSymbol to form a PinSymbol set, each PinSymbol object contains a line segment and two circles, and the two circles intersect with the start point and end point of a line segment respectively; Step 3.14, continue to integrate PinSymbol. If two PinSymbol objects both contain the same circle, it is determined that the PinSymbol objects can be connected. The two PinSymbol objects are combined into a new object. Only one of the same circle is retained. The oPinGroups object set is formed through a loop. Step 3.15, construct a rectangle through oHorizontalLines and oVerticalLines; Step 3.16, through the table composed of each rectangle and internal elements, determine whether the first row is a title row. If the rectangle has a title row, it is determined to be a logical rectangle, and the remaining rectangles are not retained. The logical rectangles that pass the judgment are added to the oLogicRectanglesAll collection; Step 3.17, construct a logical table based on the horizontal and vertical lines in the logical rectangle and range, compare the coordinates of the center point of the bounding box of the text object with the bounding box coordinates of the cell formed by the horizontal and vertical lines, determine the position of each text object relative to the table, and then construct a virtual table to add the text object information, the position of the terminal symbol and the short circuit information; Step 3.18: Group virtual tables by title, and merge virtual tables in the same group into one table; Step 3.19: Display the titles of the virtual table in sequence on the interface. When the user clicks on a title, the short-circuit information and other data of the corresponding virtual table are displayed on different interfaces.

5. The method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD as claimed in claim 4, characterized in that: The method for determining horizontal lines and vertical lines in step 3.8 is as follows: if the absolute value of the difference between the Y coordinate of the starting point and the Y coordinate of the end point of the line segment is less than the horizontal tolerance, it is determined to be a horizontal line; if the absolute value of the difference between the X coordinate of the starting point and the X coordinate of the end point of the line segment is less than the vertical tolerance, it is determined to be a vertical line.

6. The method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD as claimed in claim 4, characterized in that: The method of constructing a rectangle by using oHorizontalLines and oVerticalLines in step 3.15 is as follows: the two endpoints of the horizontal line are respectively recorded as the left endpoint and the right endpoint, and the two endpoints of the vertical line are respectively recorded as the upper endpoint and the lower endpoint according to the direction of the coordinate axis. Each rectangle is composed of two horizontal lines and two vertical lines connected end to end; first, a horizontal line is taken out from oHorizontalLines, recorded as h1, and then a vertical line whose upper endpoint is connected to the left endpoint of h1 is found from oVerticaLines, recorded as v1, and then another vertical line whose upper endpoint is connected to the right endpoint of h1 is found, recorded as v2, Finally, find a horizontal line from oHorizontalLines, whose left endpoint connects the lower endpoint of v1 and the right endpoint connects the lower endpoint of v2, recorded as h2; if the four lines h1, h2, v1, and v2 can be found, a rectangle can be constructed; if the distance between the two endpoints is equal to 0, it is called a connection; the connection tolerance is considered during construction, and if the endpoint distance is greater than 0 but less than the connection tolerance, it is still determined to be a connection; after all vertical and horizontal lines that can be constructed into rectangles are constructed into rectangles, a temporary object set is set according to the range of the rectangle, and all remaining elements are added to the corresponding temporary object set according to the coordinate belonging range, and this step is repeated to construct all possible rectangles.

7. The method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD as claimed in claim 4, characterized in that: The formatted data edited and displayed in step 5 is specifically as follows: edit the short circuit information, each line of data uses a number as the identifier of the short circuit information, if the short circuit information of two lines is the same, it indicates the same group of short circuits; if it is 0, it indicates no short circuit, and after editing the short circuit information, it is updated to the interface display in text mode.

8. The method for batch recognition of electrical secondary terminal diagrams based on Autodesk AutoCAD as claimed in claim 7, characterized in that: In step 5, the data of all virtual tables are exported into a file in DB format, the DB file contains 3 tables, and a database file in DB format is output.