A hydraulic engineering CAD drawing review method and system based on ezdxf library
By developing a CAD drawing review method for water conservancy projects based on the ezdxf library, and utilizing clustering and automatic detection algorithms, this method addresses the problem that existing tools are ill-suited to the characteristics of water conservancy projects. It achieves efficient and accurate drawing review, meeting the complexity and regulatory requirements of water conservancy projects.
Patent Information
- Application Number
- CN202410997160.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-07-24
AI Technical Summary
Existing automated CAD drawing review tools are mainly focused on the construction field and are difficult to adapt to the characteristics of water conservancy projects. In particular, there is a lack of solutions for reviewing professional water conservancy engineering drawings using the ezdxf library, resulting in low review efficiency, low accuracy, and difficulty in meeting the complexity and standard requirements of water conservancy projects.
The method for reviewing CAD drawings of water conservancy projects based on the ezdxf library uses a clustering algorithm to split the drawings and combines it with an automatic detection algorithm to check dimension annotations, scales, and elevation annotations. It identifies hydraulic structures unique to water conservancy projects, generates detailed review reports, and provides visual markings and systematic error recording.
It improves the efficiency and accuracy of water conservancy project drawing review, can identify errors unique to water conservancy projects, meets water conservancy project design specifications, simplifies the review process for complex drawings, and provides detailed error analysis and correction suggestions.
Smart Images

Figure CN118965507B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water conservancy engineering design and construction technology, specifically to a method and system for reviewing CAD drawings of water conservancy projects based on the ezdxf library. Background Technology
[0002] In the field of water conservancy engineering, CAD drawings serve as crucial documents for engineering design and construction, and their accuracy directly impacts project quality and safety. For a long time, the review of CAD drawings for water conservancy projects has relied primarily on inspection by professionals. This process is not only time-consuming and labor-intensive, but also prone to oversights and errors due to human factors. Firstly, manual review is slow and cannot meet the needs of large-scale or urgent projects. Secondly, manual review is easily influenced by individual experience and state of mind, leading to inconsistent review quality. Furthermore, traditional methods struggle to systematically record and track problems discovered during the review process, hindering subsequent analysis and improvement. Finally, with the increasing complexity of water conservancy projects, manual review is becoming increasingly inadequate to address subtle errors and complex issues in the drawings.
[0003] With the development of computer-aided design technology, especially the advancements in graphics processing and artificial intelligence, automated CAD drawing review methods have gradually become possible. Automated review can not only significantly improve review efficiency but also reduce human error through algorithms, ensuring the accuracy and consistency of drawing review. However, existing automated review tools are mostly concentrated in the construction field. Hydraulic engineering and architectural engineering have significant professional differences in design and construction. Hydraulic engineering drawings may contain specific structures and components, such as dams, wave walls, corridors, and reservoirs, which are rarely seen in the construction field and are handled differently. The walls, beams, columns, and other structures in architectural engineering are mostly regular geometric shapes, and the overall frame structure is simpler. However, the scale and complexity of hydraulic engineering may far exceed that of general architectural engineering. The number of dimensional standards and elevations on hydraulic engineering drawings far exceeds that of general architectural engineering drawings, requiring a much greater amount of content to be checked. At the same time, the specifications and standards followed by hydraulic engineering are different from those in the construction field. The design and construction of hydraulic engineering must follow a series of specifications and standards specifically formulated for hydraulic structures and hydrological environments. Existing automated review tools lack specialized review systems tailored to the characteristics of water conservancy projects, particularly lacking solutions for reviewing specialized water conservancy engineering drawings using the ezdxf library. Developing an automated CAD drawing review system and method specifically for water conservancy projects using the ezdxf library is of significant practical importance for improving design quality, shortening project cycles, and reducing costs. Summary of the Invention
[0004] Purpose of the invention: The purpose of this invention is to provide a method and system for reviewing CAD drawings of water conservancy projects based on the ezdxf library, so as to realize the automated review of water conservancy project drawings, improve review efficiency, and enhance review accuracy.
[0005] Technical Solution: To achieve the above-mentioned objectives, the present invention proposes a method for reviewing CAD drawings of water conservancy projects based on the ezdxf library, comprising the following steps:
[0006] Open and read DXF format hydraulic engineering CAD drawing files. After preprocessing the drawing files, filter out the areas representing the drawing frames by identifying polyline entities in the drawings, calculate the coordinate range of each drawing frame, use a clustering algorithm to cluster the primitive points in the drawing frames, and split the DXF drawing into independent small drawings based on the clustering results.
[0007] An automatic detection algorithm is used to perform error checks on the entire set of drawings, including general error checks and technical error checks. The general error checks include dimension annotation checks, scale checks, and elevation annotation checks. The dimension annotation check extracts dimension information from the drawings and compares it with actual measured values to identify and record inconsistencies. The scale check checks whether the scale annotations and descriptions in the drawings are consistent and identifies and records inconsistent scales and incorrect scale descriptions. The elevation annotation check verifies the elevation annotations in the drawings and identifies and records errors. The technical error check examines specific hydraulic structures in the drawings, outputs the dimensions of those structures, identifies and records technical parameters that do not conform to hydraulic engineering design specifications, and visually marks the errors identified during the checks.
[0008] The review results are displayed to the user through a graphical interface, which provides error summary and detailed information query functions, and generates a detailed review report containing an error list, impact analysis and recommended corrective measures.
[0009] Preferably, clustering primitive points within the frame using a clustering algorithm specifically includes:
[0010] The DBSCAN clustering algorithm is used to perform cluster analysis on the primitive points within the graph frame, and the primitive points are encrypted to increase the density. Based on the clustering results, a unique identifier is generated for each small graph, and the graph name points are extracted.
[0011] Preferably, the specific method for checking the dimension markings includes:
[0012] The start of the dimensioning check is clearly marked by logging, and all drawings are traversed, with each drawing undergoing a separate dimensioning check. The check process is as follows:
[0013] Extract key attributes for each annotation entity, including user-inputted annotation text, actual measured values calculated based on DXF file attributes, and the starting position of the annotation; verify the validity of the actual measured values and compare them with the user-inputted annotation text to ensure consistency; if the actual measured values do not match the manually annotated values, automatically record the problem and output relevant detailed information to the console, including the displayed size of the annotation, the actual measured size, and possible causes of the problem, while adding a visual rectangular marker to the problematic annotation on the drawing object; record the location information of the problematic annotation, including its absolute position in the drawing and its relative position relative to the drawing sheet and its thumbnails;
[0014] After completing the annotation check of a single drawing, record the end time of the check and calculate the total time taken for the entire check process to evaluate the check efficiency.
[0015] Preferably, the specific method for checking the scale includes:
[0016] First, perform a scale consistency check: Group the design entities by drawing name to ensure each drawing is processed independently; then extract unit information from the description of each drawing; next, group the sub-drawings within the drawing and extract the scale information of the labeled entities from the sub-drawings; find the most common scale in each sub-drawing through deduplication and statistical analysis, i.e., the mode of the scale, and use this as the primary scale; check whether the scale of all labeled entities in the sub-drawings is consistent with the primary scale. If there is any inconsistency, add a mark to the drawing object and record the primary scale in the drawing name attribute; finally, record the check results and efficiency, and return the updated entity containing the scale information of each drawing and each sub-drawing.
[0017] Next, perform a scale description check: First, filter out all drawing title entities, then iterate through these entities to determine the corresponding drawing and sub-drawing names; then search for possible scale information in the text below the drawing title entity. If found, extract and use the most recent relevant text as the scale reference; if not found, record the missing scale information in the log; compare the extracted scale information with the main scale obtained in the scale consistency check to check if the scale description is correct, and print the marked scale description and main scale if there is a discrepancy.
[0018] Finally, use visualization techniques to highlight inconsistent scales and incorrect scale descriptions on the drawings, and record error details, including type, location, and possible cause.
[0019] Preferably, the specific method for checking the elevation markings includes:
[0020] First, create an empty DataFrame data structure to store each elevation text and its coordinates. Then, filter the elevation texts from the drawing entities and iterate through them to determine the center point coordinates. Next, filter the relevant elements within a specified range based on these coordinates, and select the elements that meet the criteria as elevation points.
[0021] Then, all the acquired elevations are sorted to determine the baseline elevation, and the values are converted according to the scale and units of the drawing. After that, the difference between each elevation and the baseline is calculated and compared with the difference in the text annotation to identify any inconsistencies. If the elevation difference is found to be inconsistent with the annotation, the problematic elevations are marked visually on the drawing and detailed inconsistency information is recorded for easy review by the user.
[0022] Finally, a DataFrame containing all the inspection results is returned. If a suitable primitive is not found as an elevation point or scale information is missing during the process, the corresponding log information is recorded.
[0023] Preferably, the step of selecting eligible graphic elements as elevation points includes: for block-inserted and non-block-inserted graphic elements, different strategies are adopted to determine the elevation points. Specifically, for block-inserted graphic elements, the attributes of the block-inserted type are checked to determine whether they contain elevation information, and the insertion point of the block is directly used as the elevation point. For non-block-inserted graphic elements, for non-block-inserted graphic elements, straight line segments with lengths within a specific range are found, and the straight line segment closest to the elevation text is selected as the elevation point.
[0024] Preferably, the technical error checking specifically includes:
[0025] Obtain the coordinates of all non-text points, including the coordinates of elevation insertion points and the coordinates of main entities; then obtain the benchmark elevation values and scale from the entity information for comparison and judgment of drawing dimensions; identify the dam profile outline based on the line type and geometric features of the drawings to filter out the main graphic elements; compare the coordinates of points to determine the positions of the breakwater top, dam top, and dam bottom slope bend points, and then identify the dam bottom, breakwater, dam top, and slope bend points; combine the elevation insertion points, restrict the y-coordinate to determine the location of the gallery and calculate the height difference between gallery layers and the upstream wall distance; filter out records containing the text "drainage hole" and extract the diameter and spacing of the drainage holes; check whether the setting of the breakwater, slope bend points, drainage holes, and gallery in the hydraulic engineering drawings meets the requirements of the hydraulic engineering design specifications, and record the corresponding information.
[0026] This invention proposes a CAD drawing review system for water conservancy projects based on the ezdxf library, comprising:
[0027] The file information processing module is used to process the file information of CAD drawings, including: opening and reading DXF format hydraulic engineering CAD drawing files, preprocessing the drawing files, filtering out the areas representing the drawing frames by identifying polyline entities in the drawings, calculating the coordinate range of each drawing frame, using a clustering algorithm to cluster the graphic elements within the drawing frames, and splitting the DXF drawing into independent small drawings based on the clustering results.
[0028] The error checking module uses an automatic detection algorithm to perform error checks on the entire set of drawings, including general error checks and technical error checks. The general error checks include dimension annotation checks, scale checks, and elevation annotation checks. The dimension annotation check extracts dimension information from the drawings and compares it with actual measured values to identify and record inconsistencies. The scale check checks whether the scale annotations and descriptions in the drawings are consistent and identifies and records inconsistent scales and incorrect scale descriptions. The elevation annotation check verifies the elevation annotations in the drawings and identifies and records errors. The technical error check examines specific hydraulic structures in the drawings, outputs the dimensions of those structures, identifies and records technical parameters that do not conform to hydraulic engineering design specifications, and visually marks the errors identified during the checks.
[0029] The results output and display module is used to display the review results to the user through a graphical interface. The graphical interface provides error summary and detailed information query functions, and generates a detailed review report containing an error list, impact analysis and recommended corrective measures.
[0030] The present invention also provides a computer device, comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, wherein when the programs are executed by the processors, they implement the steps of the water conservancy engineering CAD drawing review method based on the ezdxf library as described above.
[0031] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the water conservancy engineering CAD drawing review method based on the ezdxf library as described above.
[0032] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages:
[0033] 1. The scale and complexity of water conservancy projects may far exceed those of general construction projects. The number of dimensions, standards, and elevations on water conservancy project drawings far exceeds that of general construction drawings, requiring a much greater amount of content to be checked. To address the tedious nature of reviewing water conservancy project drawings, this invention, by converting entities in the drawings into data recognizable by the ezdxf library, constructs an automatic detection algorithm based on the ezdxf library to perform error checks on the entire set of drawings. Specifically, for the three tedious review items—dimension annotations, scale annotations, and elevations—this invention's general error checking function can efficiently and quickly complete these tedious review tasks, improving the efficiency of drawing review.
[0034] 2. This invention is specifically designed for the characteristics of water conservancy engineering drawings. It can identify specific hydraulic structures in water conservancy projects that are not commonly seen in the construction field, such as wave walls, corridors, drainage holes, and slope surfaces. It outputs the dimensions of these hydraulic structures and compares and reviews these technical errors according to the relevant clauses of the specifications required by water conservancy projects.
[0035] 3. This invention, through a customized algorithm, can perform more accurate compliance checks based on the unique design specifications and construction standards of water conservancy projects, solving the problem that existing automated tools are difficult to adapt to specific industry standards. Furthermore, this invention has strong applicability; its general error checking is applicable to virtually any drawing with a frame and title label. This versatility allows the general error review method of this invention to be widely applied to the review of engineering drawings in different fields.
[0036] 4. This invention makes problems easier to discover and track through systematic error recording and visual marking. Attached Figure Description
[0037] Figure 1 This is a flowchart of the method of the present invention.
[0038] Figure 2 This is a flowchart for dimensioning inspection.
[0039] Figure 3 This is a flowchart for scale inspection.
[0040] Figure 4 This is a flowchart for checking elevation markings.
[0041] Figure 5 This is a record of the results of the dimension annotation inspection.
[0042] Figure 6 This is a record of the results of the scale marking inspection.
[0043] Figure 7 This is a record of the elevation marking inspection results.
[0044] Figure 8It is a record of the results of technical error checks.
[0045] Figure 9 This is an example of incorrect annotations after the drawings have been reviewed. Detailed Implementation
[0046] The technical solution of the present invention will be further described below with reference to the accompanying drawings.
[0047] Existing automated review tools are mostly concentrated in the construction field, lacking specialized review systems for water conservancy projects, particularly solutions for reviewing professional water conservancy engineering drawings using the ezdxf library. As a powerful Python development tool, the ezdxf library offers unique advantages for automated CAD drawing review. It is open-source and free, easily integrated into various Python projects, and supports cross-platform operation, providing convenience for developers on different operating systems. The rich functionality of the ezdxf library, including creating, editing, and reading DXF files, as well as complex operations on layers, blocks, and geometric attributes, greatly simplifies the development process and improves efficiency. Furthermore, the detailed documentation and active community support of the ezdxf library provide a quick way to get started and help solve problems for both beginners and experienced developers. Regular updates ensure the library's modernity and security, making it an indispensable part of education, prototyping, and commercial software development.
[0048] The CAD drawing review system for water conservancy projects, developed using the ezdxf library, can automatically perform checks on dimensions, scales, and elevations, as well as technical errors, improving the efficiency and accuracy of the review process. It supports batch processing of multiple drawings, simplifies data-driven review methods, and allows integration with modern design tools, providing a comprehensive review solution. These advantages of the ezdxf library make it an ideal choice for developing an automated CAD drawing review system specifically for water conservancy projects, contributing to the automation and intelligentization of the water conservancy engineering industry.
[0049] In view of this, the present invention provides a method for reviewing CAD drawings of water conservancy projects based on the ezdxf library, referring to... Figure 1 The method includes the following steps:
[0050] Step 1: Drawing preprocessing: Open and read the DXF format CAD drawing file, perform a cleanup operation to delete hidden or unnecessary elements such as non-printable layers or block definitions in the drawing, and convert the remaining entities such as lines and circles into data structures that are easy to process, such as DataFrame.
[0051] Step 2, Drawing Frame Recognition and Extraction: In this step, the system will identify polyline entities in the drawing, filter out the rectangular areas that constitute the drawing frame, and calculate the coordinate range of each drawing frame to prepare for subsequent drawing splitting and analysis.
[0052] Step 3: Small-scale clustering analysis: The DBSCAN clustering algorithm is used to cluster the graphic elements within the drawing frame. The density of these elements is increased by encrypting them, improving the accuracy of the clustering analysis. A unique identifier is generated for each small-scale drawing, and the drawing name is extracted. The purpose of clustering is to logically group the graphic elements in the drawing according to their spatial distribution and attributes, thereby providing a structured view for subsequent drawing breakdown and detailed review.
[0053] Step 4, Drawing Splitting and Output: Based on the clustering results, using the identified drawing frame information, the DXF drawing is split into independent small drawings, and the image of each small drawing is drawn using a graphics library and saved as a PNG or other image format file.
[0054] In addition to the main drawing, a single drawing frame for a water conservancy project often contains a number of detailed drawings and small sectional views. These smaller drawings are often enlarged versions of the main drawing, with inconsistent scales and repetitive content, making them impossible to review together. Only after the smaller drawings are separated can the drawings be reviewed.
[0055] Step 5: Dimensioning Check: The system automatically iterates through the dimensions in each drawing, extracts the dimension text and the actual measured values calculated from the DXF attributes, and compares the two to identify inconsistencies. All errors found during the check will be automatically marked and highlighted on the drawing using visual methods such as adding a rectangle. Error details, including type, location, and possible cause, will also be recorded.
[0056] Figure 2 This is a flowchart for dimensioning checks. The specific steps are as follows:
[0057] Step 5.1: Start dimensioning check: Initiate the review process and log information to indicate the start of the dimensioning check.
[0058] Step 5.2: Traverse the drawings: The system automatically traverses each drawing file to prepare for the review of the dimension annotations.
[0059] Step 5.3: Print drawing information: Print the name and relevant information of the current drawing in the console or log file so that the user knows which drawing is currently being checked.
[0060] Step 5.4: Traverse the drawing annotations: Traverse each annotation entity in the drawing and check the dimension annotations one by one.
[0061] Step 5.5: Extract annotation attributes: Extract key attributes from each annotation entity, including manually annotated text and actual measured values calculated based on DXF file attributes.
[0062] Step 5.6: Compare with manual dimensions: Compare the extracted manual annotation text with the actual measured value to check if they are the same.
[0063] Step 5.7 Record relevant information: If the manually marked value is different from the actual measured value, the system will automatically record this difference, including the displayed size of the mark, the actual size, the drawing name, the mark location, and other information.
[0064] Step 5.8, Visual Marking: To facilitate user review, the system will use visual means, such as adding rectangles (using the add_rectangle custom function), to mark inconsistent annotations in the corresponding locations on the drawing.
[0065] Step 6: Scale Check: The scale check consists of a scale consistency check and a scale description check. First, a scale consistency check is performed: The scale check process begins by grouping design entities by drawing name to ensure each drawing is processed independently. Next, unit information is extracted from the description of each drawing. Then, the sub-drawings within the drawing are grouped, and the scale information of the labeled entities is extracted from each sub-drawing. Through deduplication and statistical analysis, the most common scale in each sub-drawing is identified, i.e., the mode, which is used as the primary scale. It is checked whether the scale of all labeled entities in the sub-drawings is consistent with the primary scale. If inconsistencies exist, the system adds a mark to the drawing object and records the primary scale in the drawing name attribute. Finally, the system records the check results and efficiency, and returns the updated entity containing the scale information for each sub-drawing of each drawing. After the scale consistency check is completed, a scale description text check is performed. This checks the scale descriptions in the drawings to ensure the number of scale descriptions matches the number of drawing names. The scale descriptions are compared with the primary scale from the scale consistency check to verify their accuracy. Finally, use visualization techniques such as adding rectangles to highlight inconsistent and incorrect scales on the drawing, and record error details, including type, location, and possible cause.
[0066] The software meticulously records the location information of problematic annotations, including their absolute position within the drawing and their relative position to the drawing and its smaller sections. After completing the annotation check of a single drawing, the program records the end time of the check and calculates the total time taken for the entire process to assess efficiency. This automated dimensioning check not only improves the speed and accuracy of reviewing CAD drawings for hydraulic engineering projects but also provides strong support for design review and correction through detailed recording and visual marking, ensuring the efficiency of the design process and the accuracy of drawing errata corrections.
[0067] Figure 3 This is a flowchart for scale inspection. Scale inspection consists of two parts: checking the consistency of the marked scale and checking the scale description. The specific steps are as follows:
[0068] Consistency check of the labeled scale:
[0069] Step 6.a.1: Obtaining Drawing Units: Extract unit information from the description section of the drawing, which will be used for subsequent scale verification.
[0070] Step 6.a.2, Traverse the drawing: The system automatically traverses each drawing name entity in the drawing, and each drawing name represents an independent design part.
[0071] Step 6.a.3: Extract the scale information of all annotations from the drawing elements.
[0072] Step 6.a.4: By deduplication and statistics, take the mode of the scale of the labeled entities extracted from the small map as the main scale.
[0073] Step 6.a.5, Consistency Check: Compare the scale of all the labeled entities extracted from the small map with the main scale to ensure the consistency of all scales.
[0074] Step 6.a.6: Record the scale: If the scale is consistent, record the scale information; if it is inconsistent, record it as an error message.
[0075] Then check the scale description:
[0076] Step 6.b.1: Traverse drawing names: The system filters all drawing name entities in the drawing, then traverses these entities to determine the corresponding drawing and sub-drawing names, and determines the scope of the scale description to be checked.
[0077] Step 6.b.12: Obtain the scale description below the map title: For each map title entity, the system searches the text below it to obtain the scale description.
[0078] Step 6.b.13, Scale Information Processing: If a scale description is found, the system will verify its validity and extract the scale information; the most recent relevant text will be used as the scale reference; if not found, log information will be recorded as missing scale information.
[0079] Step 6.b.14, Comparison and Recording: Compare the extracted scale information with the main scale obtained from the scale consistency check to verify the accuracy of the scale description. The system will record the consistency between the scale description and the main scale, and print out the marked scale description and the actual scale when inconsistencies are found, for subsequent review and correction.
[0080] Step 6.b.15, Visual Marking: To facilitate user review, the system will use visual means to mark inconsistent scales in the drawing's scale check and scale description by adding rectangles (using the add_rectangle custom function).
[0081] Step 7: Elevation Marking Accuracy Check: Verify the accuracy of elevation markings on the drawings by comparing the text-marked heights with the actual measured heights on the drawings to ensure consistency. All errors found during the check will be automatically marked and highlighted on the drawings using visual methods such as adding rectangles. Error details will also be recorded, including type, location, and possible cause.
[0082] Figure 4 This is a flowchart for elevation labeling checks. The process first creates an empty DataFrame to store each elevation text and its coordinates, and then performs the following steps:
[0083] Step 7.1: Filter elevation text: Filter all text entities marked as elevations from the drawing. These usually represent important height information in the drawing.
[0084] Step 7.2: Obtain center point coordinates: For each selected elevation text, obtain its center point coordinates on the drawing. These coordinates will be used as reference points for subsequent operations.
[0085] Step 7.3: Filter relevant graphic elements: Based on the center point coordinates of the elevation text, filter out specific elevation annotation graphic elements in the water conservancy engineering drawings within a certain range.
[0086] Step 7.4, Determine the elevation point: The program provides two methods for handling elements: block insertion and non-block insertion. Block insertion processing: Check the attributes of elements of the block insertion type to determine whether they contain elevation information, and directly use the block's insertion point as the elevation point; Non-block insertion processing: For elements of the non-block insertion type, find a line segment with a length within a specific range, and select the line segment closest to the elevation text as the elevation point.
[0087] Step 7.5, Elevation Sorting and Determining the Baseline Elevation: Sort all determined elevation points according to their height, and take the lowest elevation as the baseline elevation. Calculate the actual elevation difference by combining the y-coordinate difference between the elevations with the scale.
[0088] Step 7.6: Calculate the elevation difference: For each non-reference elevation, calculate the difference between it and the reference elevation.
[0089] Step 7.7: Calculate the difference in text annotations: Calculate the height difference of the annotations extracted from the elevation text.
[0090] Step 7.8: Compare the difference: Check whether the calculated elevation difference is the same as the difference in the text label.
[0091] Step 7.9: Store error information: If the elevation difference does not match the text label, record this error information, including the position of the elevation text, the actual measured value, and the labeled value.
[0092] Step 7.10, Visual Marking: If an elevation difference is found to be inconsistent with the annotation, the inconsistent elevation is visually marked on the drawing, and detailed information on the inconsistency is recorded to facilitate user identification and review.
[0093] Finally, a DataFrame containing all the inspection results is returned. If a suitable primitive is not found as an elevation point or scale information is missing during the process, corresponding log information will also be recorded. This process not only improves the efficiency and accuracy of elevation labeling checks, but also enhances the readability and reviewability of the results through visualization and logging.
[0094] The three error checks described in steps 5 through 7 apply to the entire set of hydraulic drawings. During the check, the annotation checks are performed together, while the scale and elevation checks are performed on each sub-map. All three error checks will thoroughly examine the entire set of drawings. Furthermore, this method is applicable to virtually any type of drawing.
[0095] The review of water conservancy project drawings involves more than just these three items, so this system cannot completely replace manual review. However, due to the complexity and scale of water conservancy projects, the number of dimensions and elevations that need to be reviewed is enormous, making manual review extremely tedious. This invention can help manual reviewers reduce the need to check only these three tedious review items—dimensions, scale markings, and elevations—thereby improving review efficiency.
[0096] Furthermore, the present invention also provides for checking technical errors in water conservancy projects, such as the height of the wave wall, the width of the dam crest, the elevation of the downstream slope bend, the slope of the upstream and downstream slope bends, the height difference between the layers of the corridor, the distance between the upstream wall of the corridor and the upstream dam surface, and the diameter and spacing of the drainage holes.
[0097] Step 8: Technical Error Check: Identify and check for technical errors such as the height of the breakwater wall, the width of the dam crest, the elevation of the downstream bend point, the slope of the upstream and downstream bends, the elevation difference between gallery levels, the distance between the upstream wall of the gallery and the upstream dam face, and the diameter and spacing of the drainage holes. The specific steps are as follows:
[0098] Step 8.1: Filter specific drawings: Filter the drawings whose names contain "typical cross-section of dam section" from the entity information.
[0099] Step 8.2: Obtain point coordinates: Obtain the coordinates of all non-text type points, including the coordinates of the "elevation insertion point" and the coordinates of the main entity.
[0100] Step 8.3: Obtain the benchmark elevation value and scale from the entity information, which will be used to compare and judge the dimensions on the drawings.
[0101] Step 8.4: Determine the dam bottom, wave wall, dam top, and slope break points: First, identify the dam body profile outline based on the line type and geometric features of the drawings to select the main graphic elements, and compare the coordinates of the points to determine the locations of the wave wall top, dam top, and dam bottom slope break points.
[0102] Step 8.5: Determine the elevation difference between corridor floors and the distance from the upstream wall: Combine the "elevation insertion point" to determine the location of the corridor by restricting the y-coordinate and calculate the elevation difference between corridor floors and the distance from the upstream wall.
[0103] Step 8.6: Filter out records containing the text "drain hole" and extract the diameter and spacing of the drain holes.
[0104] Step 8.7 Output the calculation results: Print out the following information: wave wall height, dam crest width, downstream bend elevation, upstream and downstream bend slope, gallery inter-layer elevation difference, distance between the upstream gallery wall and the upstream dam face, and drainage hole diameter and spacing.
[0105] Step 8.8, Standard Check: Based on the calculation results and standard requirements, determine whether it conforms to the standard and print the corresponding information.
[0106] Step 9, Results Output and Display: Display the review results to the user through a graphical interface, including error reports and drawing images, and provide a user interface that allows users to view, navigate, and understand the review results.
[0107] The graphical user interface displays the review results and provides error summaries and detailed information query functions, generating a detailed review report that includes an error list, impact analysis, and recommended corrective measures.
[0108] Example of inspection results via Figures 5-9 As shown, where Figure 5 It is a record of the dimensioning inspection results, recording the specific coordinates of any potential problems with the dimensioning on each drawing. Figure 6 It is a record of the scale marking inspection results, which records the scale used in each drawing and provides a basis for judging the consistency of the scale. Figure 7 This is a record of the elevation marking inspection results, recording the difference between the calculated elevation and the text. If the difference is not 0, the elevation is considered to be incorrect. Figure 8 It is a record of the results of technical error inspection, which records the dimensions of a specific hydraulic structure and compares them with the relevant provisions of the water conservancy code. If they do not conform to the provisions of the code, the dimensions of the hydraulic structure are considered to be incorrect. Figure 9 This is an example of incorrect annotations after drawing review. Problematic dimensions, scales, and elevation markings are shown below. Figure 9 As shown in (a), (b), and (c), visual markings are made on the drawings. This invention makes problems easier to discover and track through systematic error recording and visual marking.
[0109] Based on the same technical concept as the method embodiments, the present invention also provides a hydraulic engineering CAD drawing review system based on the ezdxf library, including a file information processing module, an error checking module, and a result output and display module:
[0110] The file information processing module is used to process the file information of CAD drawings, including: opening and reading DXF format hydraulic engineering CAD drawing files, preprocessing the drawing files, filtering out the areas representing drawing frames by identifying polyline entities in the drawings, calculating the coordinate range of each drawing frame, using a clustering algorithm to cluster the primitive points in the drawing frames, and splitting the DXF drawing into independent small drawings based on the clustering results.
[0111] The error checking module is used to perform error checks on the entire set of drawings using an automatic detection algorithm. This includes general error checks and technical error checks. The general error checks include dimensioning checks, scale checks, and elevation checks. The dimensioning check extracts dimensioning information from the drawings and compares it with actual measured values to identify and record inconsistencies. The scale check checks whether the scale markings and descriptions in the drawings are consistent and identifies and records inconsistent scales and incorrect scale descriptions. The elevation check verifies the elevation markings in the drawings and identifies and records errors. The technical error check examines specific hydraulic structures in the drawings, outputs the dimensions of those structures, identifies and records technical parameters that do not conform to hydraulic engineering design specifications, and visually marks the errors identified during the checks.
[0112] The results output and display module is used to display the review results to the user through a graphical interface. The graphical interface provides error summary and detailed information query functions, and generates a detailed review report containing an error list, impact analysis and recommended corrective measures.
[0113] It should be understood that the water conservancy engineering CAD drawing review system based on the ezdxf library in the embodiments of the present invention can realize all the technical solutions in the above method embodiments. The functions of each functional module can be specifically implemented according to the methods in the above method embodiments. The specific implementation process can be referred to the relevant descriptions in the above embodiments, which will not be repeated here.
[0114] The present invention also provides a computer device, comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, wherein when the programs are executed by the processors, they implement the steps of the water conservancy engineering CAD drawing review method based on the ezdxf library as described above.
[0115] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the water conservancy engineering CAD drawing review method based on the ezdxf library as described above.
[0116] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus (systems), computer devices, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0117] This invention is described with reference to a flowchart of a method according to embodiments of the invention. It should be understood that each step in the flowchart and combinations thereof can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the process. Figure 1 A device for a function specified in one or more processes.
[0118] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 The function specified in one or more processes.
[0119] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 Steps of a specified function in one or more processes.
Claims
1. A hydraulic engineering CAD drawing review method based on ezdxf library, characterized in that, The method comprises the following steps: opening and reading a hydraulic engineering CAD drawing file in DXF format, pre-processing the drawing file, screening out a region representing a frame by identifying polyline entities in the drawing file, calculating the coordinate range of each frame, clustering the drawing element points in the frame using a clustering algorithm, and splitting the DXF drawing into independent small drawings according to the clustering results; performing error checking on the entire set of drawings using an automatic detection algorithm, including general error checking and technical error checking, the general error checking including dimension marking checking, scale checking, and elevation marking checking, the dimension marking checking identifying and recording errors of inconsistent dimensions by extracting dimension marking information in the drawing and comparing with actual measured values, the scale checking identifying and recording inconsistent scales and incorrect scale descriptions by checking whether the scale markings in the drawing are consistent and whether the scale descriptions are correct, and the elevation marking checking identifying and recording error information by checking the elevation markings in the drawing; the technical error checking identifying and recording technical parameters that do not meet the design specifications of hydraulic engineering by reviewing specific hydraulic structures in the drawing and outputting the dimensions of the specific hydraulic structures; and visually marking the errors identified in the checking; displaying the review results to the user through a graphical interface, the graphical interface providing error summary and detailed information query functions, and generating a detailed review report containing an error list, impact analysis, and recommended correction measures; the dimension marking checking method specifically includes: clearly indicating the start of dimension marking checking through log recording, and iterating through all drawings to perform separate marking checking on each drawing, the checking process being as follows: extracting the key attributes of each marking entity, including user input marking text, actual measured values calculated according to DXF file attributes, and marking start position; verifying the validity of the actual measured values and comparing them with the user input marking text to ensure consistency between them; if the actual measured values do not match the manual marking, automatically recording the problem and outputting relevant detailed information to the console, including the displayed size of the marking, the actual measured size, and possible problem causes, while adding a visual rectangular mark to the problem marking on the drawing object; recording the position information of the problem marking, including its absolute position in the drawing and relative position relative to the drawing and small drawing; after completing the marking checking of a single drawing, recording the end time of the checking, and calculating the time consumption of the entire checking process to evaluate the checking efficiency; the scale checking method specifically includes: First, check the scale consistency: First, group the design entities by drawing name to ensure that each drawing is processed independently. Then extract the unit information from the description of each drawing, and then group the small drawings in the drawing and extract the scale information of the labeled entities from the small drawings. Find the most common scale in each small drawing, i.e. the mode of the scale, and use it as the main scale. Check if the scale of all labeled entities in the small drawing is consistent with the main scale. If there is inconsistency, add a marker to the drawing object and record the main scale in the drawing name attribute. Finally, record the check results and efficiency, and return the updated entity containing the scale information of each small drawing in each drawing; Then, check the scale description: First, filter all drawing name entities, then iterate through these entities to determine the corresponding drawing and small drawing name. Then search for possible scale information in the text below the drawing name entity. If found, extract and use the nearest related text as the scale reference. If not found, record the log information of the missing scale. Compare the extracted scale information with the main scale obtained in the scale consistency check to check if the scale description is correct, and print the labeled scale description and the main scale when they are inconsistent; Finally, use visual means to highlight the inconsistent scale and incorrect scale description on the drawing, and record the error details, including type, location and possible causes; The elevation label checking method specifically includes: First, create an empty DataFrame data structure to store each elevation text and its coordinates, then filter the elevation text from the drawing entities and iterate through them to determine the center point coordinates; Then, filter the relevant primitives within the specified range according to these coordinates, and filter the primitives that meet the conditions as elevation points; Then, sort all the obtained elevations to determine the reference elevation, and convert the numerical values according to the scale and unit of the drawing; After that, calculate the difference between each elevation and the reference, and compare it with the difference of the text label to identify any inconsistencies; If the elevation difference is found to be inconsistent with the label, add visual markers to these problem elevations on the drawing and record detailed inconsistency information for user review; Finally, return a DataFrame data structure containing all the check results, and if the process encounters a situation where no suitable primitive is found as an elevation point or the scale information is missing, record the corresponding log information; The technical error checking specifically includes: All non-text type point coordinates are obtained, including the point coordinates of the elevation insertion point and the point coordinates of the main entity; the reference elevation value and the scale are obtained from the entity information, which are used for comparing and judging the size of the drawing, identifying the dam profile contour according to the drawing line type and geometric characteristics, and screening out the main graph element; the positions of the wave protection wall top, dam top, dam bottom and break point are determined by comparing the coordinates of the points, and then the dam bottom, wave protection wall, dam top and break point are identified; the position of the gallery is determined by combining the elevation insertion point and limiting the y coordinate, and the gallery interlayer height difference and upstream wall distance are calculated; the records containing the "drainage hole" text are screened out, and the diameter and interval of the drainage hole are extracted; according to the provisions of the water conservancy engineering design specification, it is checked whether the settings of the wave protection wall, break point, drainage hole and gallery in the water conservancy engineering drawing meet the specification requirements, and the corresponding information is recorded.
2. The method of claim 1, wherein, The clustering of the graph element points in the graph frame by using the clustering algorithm specifically includes: The DBSCAN clustering algorithm is used for clustering analysis of the graph element points in the graph frame, and the graph element points are encrypted to increase the density; according to the clustering result, a unique identifier is generated for each small graph, and the graph name point is extracted.
3. The method of claim 1, wherein, The screened graph elements meeting the conditions as the elevation points include: different strategies are adopted to determine the elevation points for block insertion and non-block insertion graph elements, wherein the block insertion processing: checking the block insertion type graph element attribute to determine whether it contains elevation information, and directly using the insertion point of the block as the elevation point; the non-block insertion processing: for the non-block insertion type graph element, a straight line segment with a length within a certain range is found, and the straight line segment closest to the elevation text is selected as the elevation point.
4. A system for implementing the method for reviewing hydraulic engineering CAD drawings based on ezdxf library according to any one of claims 1-3, characterized in that, It includes a file information processing module, an error checking module and a result output and display module: The file information processing module is used for file information processing of the CAD drawing, including: opening and reading the DXF format water conservancy CAD drawing file, pre-processing the drawing file, screening out the area representing the graph frame through identifying the polyline entity in the drawing, calculating the coordinate range of each graph frame, clustering the graph element points in the graph frame by using the clustering algorithm, and splitting the DXF drawing into independent small graphs according to the clustering result; The error checking module is used for error checking of the whole set of drawings by using an automatic detection algorithm, including general error checking and technical error checking, the general error checking includes size marking checking, scale checking and elevation marking checking, the size marking checking identifies and records the errors of inconsistent sizes by extracting the size marking information in the drawing and comparing with the actual measured values; the scale checking identifies and records the inconsistent scales and incorrect scale descriptions by checking whether the scale markings in the drawing are consistent and the scale descriptions are correct; the elevation marking checking identifies and records the error information by checking the elevation markings in the drawing; the technical error checking identifies and records the technical parameters that do not meet the water conservancy engineering design specification by reviewing the specific hydraulic structures in the drawing and outputting the sizes of the specific hydraulic structures; and the errors identified in the checking are visually marked; The result output and display module is configured to display the review result to the user through a graphical interface, the graphical interface providing error summary and detailed information query functions, and generating a detailed review report including an error list, impact analysis, and recommended correction measures.
5. A computer device, comprising: The computer program is configured to be executed by the one or more processors, and when the computer program is executed by the one or more processors, the steps of the ezdxf library-based hydraulic engineering CAD drawing review method according to any one of claims 1-3 are implemented. The computer program is configured to be executed by the one or more processors, and when the computer program is executed by the one or more processors, the steps of the ezdxf library-based hydraulic engineering CAD drawing review method according to any one of claims 1-3 are implemented. 6. A computer-readable storage medium having stored thereon a computer program, characterized in that,
Citation Information
Patent Citations
A drawing verification system based on big data
CN109086735A
Drawing rule matching method and system based on artificial intelligence algorithm, and terminal
CN117078185A