Electronic drawing frame and invalid primitive recognition and operation method and device
By identifying and deleting invalid graphics elements in electronic drawings in nuclear power unit systems, the problem of inaccurate data caused by invalid graphics elements outside the drawing frame and inconsistent drawing formats is solved, and high-quality drawing file conversion and operation is achieved.
Patent Information
- Application Number
- CN202510615889.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-14
- Publication Date
- 2025-09-19
AI Technical Summary
In nuclear power plant systems, the search and operation of electronic drawings often result in inaccurate data due to invalid elements outside the drawing frame and different drawing sizes, affecting the accuracy of element search and operation.
By recognizing the drawing frames of electronic drawings, using the K-Means algorithm and text file processing technology, invalid elements are identified and deleted, and the binary DWG format is converted into the text DXF format, and further converted into DWG, JPG or PDF formats to maintain the drawing quality.
It improves the generalization ability of drawing frame recognition, ensures the accuracy and quality of drawing operations, solves the problem of inaccurate data caused by inconsistent drawing formats, and provides high-quality drawing files.
Smart Images

Figure CN120673436A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of electronic drawing processing technology, and specifically relates to a method and device for identifying and operating electronic drawing frames and invalid graphic elements. Background Art
[0002] Nuclear power plant systems are extremely complex, with a single unit containing up to 100,000 pieces of equipment, encompassing nearly 300 systems (such as turbine lubrication and processing systems, chilled water systems, and steam generator blowdown systems). Typically, each unit has approximately 1,000 system flow charts, electrical primary diagrams, and other types of nuclear power production CAD electronic drawings. Each system flow chart can include dozens to hundreds of components, equipment, and pipelines.
[0003] Nuclear power production electronic drawings are typically manually redrawn into CAD electronic drawings by clerks assigned by nuclear power plant owners, who are assigned to manually redraw PDF drawings handed over by engineering companies or design institutes. These electronic drawings are typically stored in DWG and DXF electronic formats. Nuclear power companies typically have 4-6 or even 8 units. During power plant operation, maintenance, and equipment management, engineers need to search through a large number of electronic drawings. However, due to manual drawing habits, these redrawn drawings may contain invalid elements outside the drawing frame. When searching for elements based on electronic drawings, invalid elements outside the drawing frame will be found. Furthermore, due to the varying sizes of drawings, data inaccuracies may occur when using drawings manually or through information systems, searching for drawings, circling elements in drawings, converting drawings to images, and previewing drawings online. Summary of the Invention
[0004] In view of this, the present application proposes a method and device for identifying and operating electronic drawing frames and invalid graphic elements, which is used to solve the existing technical problem that when searching for graphic elements based on electronic drawings, invalid graphic elements outside the frame will be searched. At the same time, due to the different sizes of drawing formats, inaccurate data will be caused when manual or information system uses drawings, searches drawings, circles graphic elements in drawings, converts drawings into pictures, previews drawings online, and other operations.
[0005] In a first aspect, the present application provides a method for identifying and operating an electronic drawing frame and invalid graphic elements, the method comprising:
[0006] According to the need to identify the characters in the frame of the electronic drawing, set the characters in the left and right, upper and lower frames;
[0007] Convert binary DWG electronic drawings into text DXF electronic drawings;
[0008] Read the text content of the text DXF electronic drawing, identify the upper, lower, left, and right borders of the text DXF electronic drawing, and obtain the frame position;
[0009] Using the obtained drawing frame position, the drawing size is identified based on the distance between the left and right drawing frames, the font size of the characters in the drawing frames, and the empirical value of the distance between the drawing frames and the drawing margins;
[0010] Traverse all types of graphics in text DXF electronic drawings and identify invalid graphics;
[0011] According to the DXF file structure, delete invalid entities by editing the text file;
[0012] Convert DXF files to other formats without loss of quality, including DWG, JPG, and PDF.
[0013] In a specific implementation of the present application, the above-mentioned reading of the text content of the text DXF electronic drawing, identifying the upper, lower, left, and right borders of the frame of the text DXF electronic drawing, and obtaining the frame position includes:
[0014] Based on the text DXF file, search all entities by entity content according to the character enumeration list of the left and right frames;
[0015] Set the Y value of the searched primitive to 0, and use the K-Means algorithm or any clustering algorithm to calculate the cluster set of N groups of primitives;
[0016] From the N sets of graphic element sets, find two sets of graphic element sets that include all left and right frame character enumeration lists;
[0017] The group with the smaller X average value is set as the left frame of the map, and the group with the larger X average value is set as the right frame of the map;
[0018] Two sets of primitives are obtained by calculation;
[0019] The set with the smaller Y average value is set as the lower frame of the map; the set with the larger Y average value is set as the upper frame of the map.
[0020] In a specific implementation of the present application, the above-mentioned identification of the drawing size using the obtained drawing frame position based on the distance between the left and right frames, the font size of the characters in the frame, and the empirical value of the distance between the frame and the drawing margin includes:
[0021] The X coordinate of the left frame is marked as X1, the X coordinate of the right frame is marked as X2, and the font size of the characters in the right frame is marked as F;
[0022] Let X1-(X2-X1)*0.5% be the left edge of the drawing, and record it as L, where X2-X1 is the distance between the left and right frames, and 0.5% is the empirical value of the page margin between the left frame and the left edge of the drawing;
[0023] Query the font size comparison table to obtain the size corresponding to F, recorded as Xp1;
[0024] Record X2+Xp1+(X2-X1)*0.5% as the right edge of the drawing, denoted as R. 0.5% is the empirical value of the page margin between the right drawing frame and the right edge of the drawing. This empirical value can be set to different page margin empirical values according to the characteristics of different types of drawings.
[0025] Calculate the upper and lower boundaries of the drawing.
[0026] In a specific implementation of the present application, the above-mentioned conversion of binary DWG electronic drawings into text DXF electronic drawings includes: using CAD software or AcmeCADConverter to batch convert binary DWG electronic drawings into text DXF electronic drawings.
[0027] In a specific implementation method of the present application, the above-mentioned conversion of DXF files into other format files without distortion, other format files include DWG files, JPG files and PDF files, including: using CAD software or using AcmeCADConverter according to different resolution requirements based on the drawing size to convert DXF files into DWF files, JPG files or PDF files according to the drawing size.
[0028] In a specific implementation of the present application, the DXF file structure includes single-line text, multi-line text, lines, and circles.
[0029] The second aspect of the present application provides a device for identifying and operating electronic drawing frames and invalid graphic elements. The device for identifying and operating electronic drawing frames and invalid graphic elements includes a drawing frame identification module, a drawing size identification module, an invalid graphic element identification module and an invalid graphic element deletion module.
[0030] The drawing frame recognition module is used to identify the characters in the left and right, upper and lower frames of the electronic drawing as needed, convert the binary DWG electronic drawing into a text DXF electronic drawing, read the text content of the text DXF electronic drawing, identify the upper, lower, left and right borders of the frame of the text DXF electronic drawing, and obtain the frame position.
[0031] The drawing sheet size recognition module is used to use the enumeration list in the left and right drawing frames to correspond to the spacing of the X-axis of the elements and add or subtract the empirical deviation of ±0.5% as the width of the drawing sheet. Similarly, the height of the drawing sheet is calculated.
[0032] The invalid element recognition module is used to identify elements in multiple layers that exceed the boundaries of the map, including hidden elements.
[0033] The invalid element deletion module is used to delete the identified invalid elements in DXF files using text file processing technology to obtain high-quality drawings.
[0034] The file format conversion module is used to convert DXF files into other formats, including DWG, JPG, and PDF.
[0035] The beneficial effects of the technical solution of the present application are: by converting binary DWF format drawing files into text DXF format drawing files, any type of add, delete, modify, and read operations can be performed on the drawings without the need to use the official CAD interface (such as ObjectARX) or third-party professional CAD interfaces or components to operate electronic drawings; the drawing frame can be identified for any frame with enumerable characters, thereby improving the generalization ability of drawing frame recognition; the drawing size can be identified based on the upper / lower and left / right frames of the drawing through empirical values and the font size of the characters in the frame; invalid graphics elements that exceed the frame can be freely and flexibly searched and deleted to obtain high-quality drawing files; based on the drawing size, it can be converted into PDF or JPG files with corresponding accuracy requirements as needed to solve the problem of drawing distortion after the conversion software converts according to the default accuracy; the drawing frames, drawing sheet (sheet) sizes, and invalid graphics elements outside the sheet of various non-standard electronic drawings can be automatically identified, and the sheet size metadata can be recorded and invalid graphics elements deleted. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A flowchart of a method for identifying and operating electronic drawing frames and invalid graphic elements provided in one embodiment of the present application.
[0037] Figure 2 A schematic diagram of a flow chart for identifying upper, lower, left, and right borders of an electronic drawing frame in a method for identifying and operating an electronic drawing frame and invalid graphic elements provided in one embodiment of the present application.
[0038] Figure 3 A schematic diagram of a flow chart for identifying frame size in a method for identifying and operating electronic drawing frames and invalid graphic elements provided in one embodiment of the present application.
[0039] Figure 4 These are four example border diagrams of a frame provided in accordance with an embodiment of the present application.
[0040] Figure 5 This is an example diagram of invalid graphic elements provided in one embodiment of the present application. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0042] At least one embodiment of the present application provides a method for identifying and operating electronic drawing frames and invalid graphic elements, referring to Figure 1 The method for identifying and operating electronic drawing frames and invalid graphic elements includes the following steps.
[0043] S100: recognizing characters in the drawing frame of the electronic drawing as needed and setting characters in the left and right, and upper and lower frames.
[0044] For example, you can predefine character enumeration lists for the left and right, and top and bottom frames of a drawing.
[0045] like Figure 4 As shown, the characters in the left and right frames of the drawing are usually 1, 2, 3, ..., and the characters in the upper and lower frames are A, B, C, .... Of course, it can also be any other enumerable character list.
[0046] S200: Convert binary DWG electronic drawings into text DXF electronic drawings.
[0047] Specifically, it can be to convert electronic drawings in DWG format into text-based graphic exchange format DXF files.
[0048] For example, you can use CAD software or third-party software (such as AcmeCAD Converter) to batch convert binary DWG electronic drawings into text-based DXF electronic drawings.
[0049] DXF files are a CAD data file format developed by AutoCAD for exchanging CAD data between various software programs. AutoCAD has defined and opened up the DXF file structure, and its contents can be viewed and edited using a text editor. The present application embodiments utilize text processing to perform arbitrary operations on drawing files, such as adding, deleting, modifying, and querying primitives.
[0050] S300: Read the text content of the text DXF electronic drawing, identify the upper, lower, left, and right borders of the drawing frame of the text DXF electronic drawing, and obtain the drawing frame position.
[0051] For example, we search for and exploit the vertical alignment of the corresponding elements in the enumerated lists in the left and right frames, set the Y values of the two groups of elements to 0, and use the K-Means algorithm to cluster the two groups of elements. The group with the smaller X-mean value is set as the left frame of the map sheet, and the group with the larger X-mean value is set as the right frame of the map sheet. Similarly, we exploit the horizontal alignment of the corresponding elements in the enumerated lists in the upper and lower frames to calculate the upper and lower frames of the map sheet.
[0052] It should be noted that the text stream processing algorithm can be used to operate text DXF electronic drawings, including reading and modifying drawings, to achieve highly generalized drawing frame recognition.
[0053] S400: Identify the drawing size using the obtained frame position, based on the distance between the left and right frames, the font size of the characters in the frame, and the empirical values of the frame's distance from the drawing margin.
[0054] For example, based on the identified frame, use algorithms and empirical values to identify the size of the drawing.
[0055] S500: Traverse all types of graphic elements in the text DXF electronic drawing and identify invalid graphic elements.
[0056] Specifically, for the identified drawing size, identify the invalid graphic elements that exceed the frame in the drawing. For example, traverse all types of graphic elements in the text DXF electronic drawing, and the graphic elements with X coordinate < L, or X coordinate > R, or Y coordinate < D, or Y coordinate > U are invalid graphic elements. The final identification result: as Figure 5 shown, the graphic elements with X coordinate > R are invalid graphic elements.
[0057] S600: Delete the invalid graphic elements by editing the text file according to the DXF file structure. [[ID=十七]]
[0058] For example, for the identified invalid graphic elements, delete them to obtain a high-quality drawing, so that the drawing can be placed in the center of the preview and operation area during drawing preview.
[0059] The DXF file structure includes single-line text TEXT, multi-line text MTEXT, line LINE, circle CIRCLE, etc.
[0060] S700: Convert the DXF file to other format files without distortion. Other format files include DWG files, JPG files, and PDF files.
[0061] For example, use CAD software or third-party software (such as AcmeCADConverter) according to the drawing size and different resolution requirements to convert the DXF file to a DWF file according to the drawing size, or files in different formats such as PDF and JPG with different precisions, for different terminals and users to use in different ways, and solve the problem of drawing distortion after conversion software converts according to the default precision. Modify the CAD electronic drawing directly by using the text file editing method, without the need for a third-party interface or tool.
[0062] The DXF file can also be called an electronic drawing in the cleaned DXF format. The DWF file is also a type of DWF electronic drawing.
[0063] According to the technical solution provided in the embodiment of the present application, by converting binary DWF format drawing files into text DXF format drawing files, any type of add, delete, modify, and read operations can be performed on the drawings without the need to use the official CAD interface (such as ObjectARX) or third-party professional CAD interfaces or components to operate electronic drawings; the drawing frame can be identified for any frame with enumerable characters, thereby improving the generalization capability of drawing frame recognition; the drawing size can be identified based on the upper / lower and left / right frames of the drawing through empirical values and the font size of the characters in the frame; invalid graphics elements that exceed the frame can be freely and flexibly searched and deleted to obtain high-quality drawing files; based on the drawing size, it can be converted into PDF or JPG files with corresponding accuracy requirements as needed to solve the problem of drawing distortion after the conversion software converts according to the default accuracy; the drawing frames, drawing sheet (sheet) sizes, and invalid graphics elements outside the sheet of various non-standard electronic drawings can be automatically identified, and the sheet size metadata can be recorded and invalid graphics elements deleted.
[0064] In at least one embodiment of the present application, reference Figure 2 S310 to S360 are a specific implementation of the above S300.
[0065] S310: Based on the text DXF file, all entities are searched according to entity content according to the character enumeration lists of the left and right frames.
[0066] For example, read all "single-line text" type entities in the DXF file, and select all "text" entities in the character enumeration list of the previously configured left and right frames, which is a collection including left and right frame entities and other entities, recorded as SLR.
[0067] S320: Setting the Y value of the searched primitive to 0, and using the K-Means algorithm or any clustering algorithm to calculate and obtain a cluster set of N groups of primitives.
[0068] For example, the Y coordinates of all elements in the set SLR are set to 0. Then, the set SLR is clustered and grouped according to the coordinates of the elements using the K-Means algorithm or any clustering algorithm, and N sets such as SLR1, SLR2, ..., SLRN can be obtained.
[0069] S330: Find two sets of graphic element sets that include all left and right frame character enumeration lists from the N sets of graphic element sets.
[0070] For example, from the N sets of SLR1, SLR2, ..., SLRN, find two sets of primitives that include all left and right frame character enumeration lists.
[0071] S340: The group with the smaller X average value is set as the left frame of the map sheet, and the group with the larger X average value is set as the right frame of the map sheet.
[0072] For example, according to the characteristics of the CAD drawing coordinate system, a group of sets with a small X average value is set as the left frame of the drawing; and a group of sets with a large X average value is set as the right frame of the drawing.
[0073] S350: Calculate and obtain two groups of primitive sets.
[0074] Specifically, the two groups of primitive sets may be obtained by calculating using steps similar to S310 - S330 .
[0075] S360: Set a group of sets with a small Y average value as the lower frame of the map sheet; set a group of sets with a large Y average value as the upper frame of the map sheet.
[0076] In at least one embodiment of the present application, reference Figure 3 , S410 to S450 are a specific implementation of the above S400.
[0077] S410: Mark the X coordinate of the left frame as X1, mark the X coordinate of the right frame as X2, and mark the font size of the characters in the right frame as F.
[0078] S420: Record X1-(X2-X1)*0.5% as the left edge of the drawing, which is recorded as L. X2-X1 is the distance between the left and right drawing frames, and 0.5% is the empirical value of the page margin between the left drawing frame and the left edge of the drawing.
[0079] It should be noted that the page margin experience values can be set differently according to the characteristics of different types of drawings.
[0080] S430: Look up the font size comparison table to obtain the size corresponding to F, which is recorded as Xp1.
[0081] For example, a size 5 font corresponds to a size of 3.7 mm.
[0082] For example, the font size comparison table is shown in Table 1 below.
[0083] Table 1 Font size comparison table.
[0084]
[0085]
[0086] S440: Record X2+Xp1+(X2-X1)*0.5% as the right edge of the drawing, denoted as R. 0.5% is the empirical value of the page margin between the right drawing frame and the right edge of the drawing. This empirical value can be set to different page margin empirical values according to the characteristics of different types of drawings.
[0087] It should be noted that, since the position of the character in the frame is calculated from the left, the right coordinate of the character is obtained by increasing the size Xp1 corresponding to the font size.
[0088] S450: Calculate the upper and lower boundaries of the drawing.
[0089] It should be noted that the method of calculating the upper and lower boundaries of the drawing is similar to steps S410 to S440.
[0090] For example, the upper and lower boundaries of the drawing can be denoted as U and D. Therefore, the coordinates of the four vertices of the upper left, upper right, lower right, and lower left of the drawing are: (L, U), (R, U), (R, D), (L, D), and the left-right distance of the drawing is (RL) mm, and the top-bottom distance is (UD) mm.
[0091] At least one embodiment of the present application provides a device for identifying and operating electronic drawing frames and invalid graphic elements, which includes a drawing frame identification module, a drawing size identification module, an invalid graphic element identification module and an invalid graphic element deletion module.
[0092] The drawing frame recognition module is used to identify the characters in the left and right, upper and lower frames of the electronic drawing as needed, convert the binary DWG electronic drawing into a text DXF electronic drawing, read the text content of the text DXF electronic drawing, identify the upper, lower, left and right borders of the frame of the text DXF electronic drawing, and obtain the frame position.
[0093] The drawing sheet size recognition module is used to use the enumerated list in the left and right drawing frames to correspond to the spacing of the element X axis and plus or minus the empirical deviation of ±0.5% as the width of the drawing sheet. Similarly, the height of the drawing sheet is calculated.
[0094] The invalid element recognition module is used to identify elements in multiple layers that exceed the boundaries of the map, including hidden elements.
[0095] The invalid element deletion module is used to delete the identified invalid elements in DXF files using text file processing technology to obtain high-quality drawings.
[0096] The file format conversion module is used to convert DXF files into other formats, including DWG, JPG, and PDF.
[0097] It should be noted that the combination of the various technical features in the embodiments of the present application is not limited to the combination described in the embodiments of the present application or the combination described in the specific embodiments. All technical features described in the present application can be freely combined or combined in any way unless there is a contradiction between them.
[0098] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for identifying and operating electronic drawing frames and invalid graphic elements, characterized in that: include: According to the need to identify the characters in the frame of the electronic drawing, set the characters in the left and right, upper and lower frames; Convert binary DWG electronic drawings into text DXF electronic drawings; Read the text content of the text DXF electronic drawing, identify the upper, lower, left, and right borders of the text DXF electronic drawing, and obtain the frame position; Using the obtained drawing frame position, the drawing size is identified based on the distance between the left and right drawing frames, the font size of the characters in the drawing frames, and the empirical value of the distance between the drawing frames and the drawing margins; Traverse all types of graphics in text DXF electronic drawings and identify invalid graphics; According to the DXF file structure, delete invalid entities by editing the text file; Convert DXF files to other formats without loss of quality, including DWG, JPG, and PDF.
2. A method for identifying and operating electronic drawing frames and invalid graphic elements according to claim 1, characterized in that: Read the text content of a DXF electronic drawing, identify the upper, lower, left, and right borders of the drawing frame, and obtain the frame position, including: Based on the text DXF file, search all entities by entity content according to the character enumeration list of the left and right frames; Set the Y value of the searched primitive to 0, and use the K-Means algorithm or any clustering algorithm to calculate the cluster set of N groups of primitives; From the N sets of graphic element sets, find two sets of graphic element sets that include all left and right frame character enumeration lists; The group with the smaller X average value is set as the left frame of the map, and the group with the larger X average value is set as the right frame of the map; Two sets of primitives are obtained by calculation; The set with the smaller Y average value is set as the lower frame of the map; the set with the larger Y average value is set as the upper frame of the map.
3. The method for identifying and operating electronic drawing frames and invalid graphic elements according to claim 1, characterized in that: Using the obtained frame position, the drawing size is identified based on the distance between the left and right frames, the font size of the characters in the frame, and the empirical value of the distance between the frame and the drawing margin, including: The X coordinate of the left frame is marked as X1, the X coordinate of the right frame is marked as X2, and the font size of the characters in the right frame is marked as F; Let X1-(X2-X1)*0.5% be the left edge of the drawing, and record it as L, where X2-X1 is the distance between the left and right frames, and 0.5% is the empirical value of the page margin between the left frame and the left edge of the drawing; Query the font size comparison table to obtain the size corresponding to F, recorded as Xp1; Record X2+Xp1+(X2-X1)*0.5% as the right edge of the drawing, denoted as R, where 0.5% is the empirical value of the page margin from the right edge of the drawing. This empirical value can be set to different page margin empirical values according to the characteristics of different types of drawings; Calculate the upper and lower boundaries of the drawing.
4. The method for identifying and operating electronic drawing frames and invalid graphic elements according to claim 1, characterized in that: Convert binary DWG electronic drawings into text-based DXF electronic drawings, including: Use CAD software or AcmeCADConverter to batch convert binary DWG electronic drawings into text-based DXF electronic drawings.
5. The method for identifying and operating electronic drawing frames and invalid graphic elements according to claim 1, characterized in that: Convert DXF files to other formats without loss of quality, including DWG, JPG and PDF files, including: Use CAD software or use AcmeCADConverter to convert DXF files into DWF files, JPG files or PDF files according to the drawing size and different resolution requirements.
6. A method for identifying and operating electronic drawing frames and invalid graphic elements according to any one of claims 1 to 5, characterized in that: The DXF file structure includes single-line text, multi-line text, lines, and circles.
7. A device for identifying and operating electronic drawing frames and invalid graphic elements, characterized in that: It includes drawing frame recognition module, drawing size recognition module, invalid graphic element recognition module and invalid graphic element deletion module. The drawing frame recognition module is used to identify the characters in the left and right, upper and lower frames of the electronic drawing as needed, convert the binary DWG electronic drawing into a text DXF electronic drawing, read the text content of the text DXF electronic drawing, identify the upper, lower, left and right borders of the frame of the text DXF electronic drawing, and obtain the frame position; The drawing sheet size recognition module is used to use the enumerated lists in the left and right drawing frames to correspond to the spacing of the X-axis of the elements and add or subtract the empirical deviation of ±0.5% as the width of the drawing sheet. Similarly, the height of the drawing sheet is calculated; Invalid element recognition module, used to identify elements in multiple layers that exceed the map boundary, including hidden elements; The invalid element deletion module is used to delete the identified invalid elements in DXF files using text file processing technology to obtain high-quality drawings; The file format conversion module is used to convert DXF files into other formats, including DWG, JPG, and PDF.
Citation Information
Patent Citations
CAD file auxiliary processing method and system for air conditioner industry
CN115146327A
Drawing primitive processing method and device
CN115171145A