The first layer rain arranging horizontal plane pipeline planning method is adopted by using AStar path planning algorithm
By optimizing pipeline path planning using the improved A* algorithm, straight drainage horizontal pipelines are generated, solving the problem of excessive pipeline bends in existing technologies and enabling convenient construction applications.
Patent Information
- Application Number
- CN202211447727.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-18
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2042-11-18
AI Technical Summary
Existing technologies for planning drainage pipelines on the first floor have too many turns in the automatically generated pipeline paths, making them difficult to apply to actual drainage pipeline layout and lacking convenience.
An improved A* algorithm is used for pipeline route planning. By introducing a heuristic function f=g+h and defining different consumption j in different regions, the route is optimized to reduce turns. Combined with CAD drawing operations, a relatively straight pipeline route is generated, and obstacles and regional interference are automatically avoided.
The generated pipeline path is relatively straight, reducing bends and facilitating actual construction layout. It automatically identifies graphic element information, reducing manual measurement and improving operational convenience and adaptability.
Smart Images

Figure CN115686024B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of architectural design technology, specifically relating to a method for planning the first-floor drainage horizontal pipeline using the AStar path planning algorithm. Background Technology
[0002] In traditional architectural design, designing the ground floor drainage system requires designers to manually draw up design plans. This process is tedious, monotonous, and lacks technical sophistication, making it a very time-consuming task for designers. Computer-generated tools can generate the ground floor drainage system's lines, allowing designers to easily create the desired effect while meeting relevant constraints and adhering to the architectural design. The most complex aspect lies in planning the pipe routes. Traditional route planning algorithms include graph search algorithms such as the visual graph algorithm, Dijkstra's algorithm, A* algorithm, and B* algorithm. However, in practical applications, automatically generated pipe routes often have too many turns, making them unsuitable for actual drainage pipe layouts.
[0003] To address the shortcomings of existing technologies, people have conducted long-term explorations and proposed various solutions. For example, Chinese patent literature discloses an AStar path [202210975141.X], which includes: reading the drawing information of the original Revit design drawings of the building; constructing a rasterized 3D model on a Python service platform based on the drawing information; reading the start and end points of multiple pipes; and obtaining the pipe layout path by performing pipe routing through the A* algorithm and optimizing the pipe routing through the GA algorithm based on the start and end points of the multiple pipes.
[0004] The above solution has solved the problem of automatic generation of drainage pipes to a certain extent, but it still has many shortcomings, such as the large number of bends in the automatically generated pipes, which makes them inconvenient to lay out in practice. Summary of the Invention
[0005] The purpose of this invention is to address the above-mentioned problems by providing a method for planning the first-floor drainage horizontal plane pipeline using the AStar path planning algorithm, which is reasonably designed, convenient for pipeline path design, and applicable to actual construction.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: This method for planning the first-floor stormwater drainage pipeline using the AStar path planning algorithm includes the following steps:
[0007] S1: Draw the main drainage and / or sewage pipes on the drainage plane and select the exterior wall;
[0008] S2: Define the map and read map elements;
[0009] S3: Automatically generate pipeline routes using the improved A* algorithm;
[0010] S4: Generate sleeve annotations on the drawing.
[0011] The improved A* algorithm is used for automatic path finding to generate relatively straight pipeline routes. During the path finding process, the primitives are fully considered, obstacles are effectively avoided and interference with some areas is reduced. The generated pipeline paths can be directly used for construction planning.
[0012] In the above-mentioned method for planning the first-level stormwater drainage horizontal pipeline using the AStar path planning algorithm, step S1 includes the following steps:
[0013] S11: Draw the room outline and the outline of the area outside the room;
[0014] S12: Draw the stormwater main and sewage main for the outer area;
[0015] S13: Identify the sanitary ware and other risers that need to be connected. Determine the start and end points of the pipeline route and limit the pipeline layout area to ensure that the pipeline route does not exceed the designated area.
[0016] In the above-described method for planning the first-level stormwater drainage horizontal pipeline using the AStar path planning algorithm, the graphic elements in step S2 are divided into obstacles, endpoint connection lines, and points that need to be connected. After the graphic elements are read, the map layout can be completed and further adjustments can be made.
[0017] In the above-described method for planning the first-level stormwater drainage horizontal pipeline using the AStar path planning algorithm, step S2 includes the following steps:
[0018] S21: Construct an axis-aligned rectangular bounding box using all primitives, then apply tolerance to the buffer using the axis-aligned rectangular bounding box, and finally obtain the rectangular box, which is the map to be determined.
[0019] S22: A virtual chessboard with a given step size, using the bottom left corner of the map as the origin. The map generated using all the primitives is then gridded to facilitate subsequent placement of pieces.
[0020] In the above-mentioned method for planning the first-level stormwater drainage pipeline using the AStar path planning algorithm, step S3 records the chessboard interval where each landing point is located, and the pipeline path automatically avoids passing through the interval where the landing point is located.
[0021] In the above-described method for planning the first-level stormwater drainage horizontal pipeline using the AStar path planning algorithm, step S3 includes the following steps:
[0022] S31: Introduce the A* algorithm. The A* algorithm uses the heuristic function f = g + h, where g is the cost from the current point to the starting point, h is the cost from the current point to the ending point, and f is the total cost of the path. The shortest path is found by keeping f as the minimum.
[0023] S32: When the current point's direction of travel is different from the previous point, increase the cost j on the cost g, while still minimizing f to find the shortest path. This optimizes the existing A* algorithm by introducing cost j to minimize pipeline path turns and generate relatively straight pipeline paths between points, adapting to actual drainage pipeline construction.
[0024] In the above-described method for planning the first-level stormwater drainage horizontal pipeline using the AStar path planning algorithm, step S31 uses the direction of the terminal line as the x-direction for generating the chessboard, and the distance from the current point to the terminal line as the consumption h. The chessboard generated based on the terminal line matches the actual outdoor pipeline, optimizing the connection path between points and lines.
[0025] In the above-described method for planning the first-level stormwater drainage horizontal pipeline using the AStar path planning algorithm, step S32 assigns different consumption values (j) to different areas, and assigns an infinite consumption value (j) to areas that cannot be traversed. By assigning different consumption values (j) to different areas, both areas where pipelines cannot be laid and areas of interference with other areas can be reduced.
[0026] In the above-described method for planning the first-floor drainage pipeline using the AStar path planning algorithm, step S4 involves setting the annotation type, annotation planning, and annotation avoidance. The generated pipeline path is automatically annotated for easy reference during subsequent construction.
[0027] In the above-described method for planning the first-floor stormwater drainage pipeline using the AStar path planning algorithm, steps S1 to S4 involve drawing operations in CAD. Pipeline planning can be completed using existing CAD software, offering good adaptability and ease of operation.
[0028] Compared with existing technologies, the advantages of this invention are: the improved A* algorithm effectively reduces the bends in the pipeline path, ensuring that the pipeline extends in a straight direction as much as possible, which facilitates subsequent actual construction and layout; it automatically identifies relevant graphic element information that conforms to the rules, eliminating the need to manually measure the distance to each wall, column and room during the pipeline path design process; and it allows for flexible adjustment of the spacing between pipes to avoid intersections between pipelines. Attached Figure Description
[0029] Figure 1 This is a flowchart of the method of the present invention;
[0030] Figure 2 This is a schematic diagram of data preparation according to the present invention;
[0031] Figure 3 This is a schematic diagram of the generation result of the present invention; Detailed Implementation
[0032] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0033] like Figure 1-3 As shown, this paper describes a method for planning the first-floor storm drain horizontal plane pipeline using the AStar path planning algorithm. The drawing operations in CAD include the following steps:
[0034] S1: Draw the main drainage and / or sewage pipes on the drainage plane and select the exterior wall;
[0035] S2: Determine the map and read the graphic elements; steps S1 and S2 are the data preparation process, i.e., preparing the relevant data for immediate use. Draw the room and area outlines on the CAD UI interface, then draw the main rainwater and sewage pipes for the outer area, implementing combined or separate rainwater and sewage systems as needed. Simultaneously, the data for connecting sanitary ware and other risers also needs to be prepared in advance.
[0036] S3: Automatically generate pipeline routes using the improved A* algorithm and wait for the results. In the traditional A* algorithm, the map is represented as a grid, and all movements are confined to points on the grid. However, in the process of drawing drainage pipelines, the entire map is an infinite grid and a vector map; movements cannot be limited to points on the grid. Therefore, the A* algorithm is introduced and improved upon.
[0037] S4: Generate sleeve annotations on the drawing.
[0038] In detail, the graphic elements in step S2 are divided into obstacles, endpoint connection lines, and points that need to be connected. Since the CAD drawing itself is a theoretically infinite control, it is necessary to first determine the map and obtain all the graphic elements that need to be focused on. Obstacles include walls, columns, beams, and impassable openings, etc.; endpoint connection lines include outdoor sewage mains and outdoor rainwater mains, etc.; points that need to be connected include various risers and sanitary ware, etc.
[0039] Further, step S2 includes the following steps:
[0040] S21: Construct an axis-aligned rectangular bounding box using all primitives, then apply tolerance to the buffer using the axis-aligned rectangular bounding box, and finally obtain the rectangular box, which is the map to be determined.
[0041] S22: A virtual chessboard with the bottom left corner of the map as the origin, and a given step size for calculating equal step sizes.
[0042] Furthermore, step S3 records the chessboard interval where each landing point is located, and the pipeline path automatically avoids passing through the interval where the landing point is located. This is because most points are unlikely to land "exactly" at the intersection of the grid lines on the chessboard. Therefore, each time a point is landed, it is necessary to record the interval of the horizontal chessboard line that the point belongs to, i.e., between which chessboard line it falls on, and similarly, the interval of the vertical chessboard line. Then, when running the A* algorithm, special processing is performed whenever the path enters this interval to prevent the path from directly "crossing" the point. During pipeline generation, a bathroom pipeline needs to be connected in parallel, with the pipeline distance not less than 300 and a multiple of 50. Pipelines should have minimal or no intersections, and the distance from the wall should not be less than 150. The shortest path is found with minimal bends. These are the basic requirements for pipeline path layout.
[0043] In addition, step S3 includes the following steps:
[0044] S31: Introducing the A* algorithm. The A* algorithm uses the heuristic function f = g + h, where g is the cost from the current point to the starting point, h is the cost from the current point to the ending point, and f is the total cost of the path. It finds the shortest path by minimizing f; however, the A* algorithm only provides a reasonable result. Normally, designers designing drainage paths should aim for straight lines, minimizing turns. The path provided by a standard A* algorithm is distorted, requiring further optimization.
[0045] S32: Each time a turn occurs, i.e., when the current point's direction of travel differs from the previous point, the cost j is increased from the cost g, while still minimizing f to find the shortest path. This optimization ensures that the cost of traveling in a straight line is less than the cost of turning, thus reducing the number of turns.
[0046] As can be seen, after optimizing the turning path, some areas are designated as "dead zones" that are absolutely impassable (such as the previously identified walls and pillars), while other areas are to be avoided as much as possible (avoiding intersections with other lines and maintaining a certain distance from them). Similar to reducing turns, different costs are applied to different areas to increase the overall path cost and achieve the aforementioned effect. In step S32, different costs j are assigned to different areas, with infinite costs j applied to impassable areas. This prevents the path from entering completely impassable areas and also avoids areas that would increase costs due to the increased costs of entering other areas.
[0047] The above describes a basic point-to-point connection method, ensuring all pipelines are connected horizontally and vertically in the given direction. However, in practice, the destination object needs to be an outdoor pipeline, requiring optimization to a point-to-line connection method. Considering the basic algorithm used is the A* algorithm, which determines whether the destination has been reached by the consumption value h; when h is 0, it indicates the path has reached the desired destination. Originally, h was calculated by directly measuring the distance from the current point to the destination, resulting in the consumption value (in this algorithm, h must be less than or equal to the actual value).
[0048] By further optimizing the algorithm, the entire endpoint is added to the chessboard. Similarly, adding the endpoint allows us to calculate which horizontal and vertical chessboard line the current line falls within. To prevent inaccurate results and excessive bends, the direction of the endpoint is used as the x-direction for chessboard generation when generating the map. That is, when constructing the axis-aligned bounding box, an axis-aligned bounding box with the endpoint direction as its x-direction is created. Step S31 rewrites the algorithm for the h value, converting it to the distance from the current point to the endpoint, using this distance as the cost of the h value.
[0049] Clearly, step S4 involves setting the annotation type, annotation planning, and annotation avoidance. Specific annotation types include pipe diameter and sleeve annotation. When planning annotations, a placement priority needs to be set; higher priority annotations are placed first, lower priority annotations are placed later, and later annotations should avoid earlier ones as much as possible. Each annotation should occupy as little space as possible. In annotation avoidance, the annotation leader line does not need to avoid obstacles; annotations should avoid each other and obstacles. During the annotation process, the sleeve direction should be parallel to the pipeline direction, and sleeves with the same annotation information that are close together can be merged.
[0050] Meanwhile, other path planning algorithms can be used for path generation. A simple breadth-first search can be combined with a genetic algorithm to iteratively find the optimal path plan. When using breadth-first search, the entire area must first be mapped, gridded, and obstacles removed. Then, the breadth-first search is performed, which can generate multiple results. After generating multiple results, the generated results are used as evaluation factors in the evaluation function of the genetic algorithm (number of turns, path length, whether there is intersection between paths, etc.). Then, the results with the highest scores are used as the genetic factors of the genetic algorithm. At the same time, the mutation method and the number of generations of inheritance are designed, and finally, the result map with the best score is obtained.
[0051] The principle of this embodiment is to integrate and improve the A* algorithm into CAD, use different weighting methods for different areas, reduce turns in the automatic path finding process, and automatically weigh the avoidance of obstacles or the passage through specific areas during the path finding process, so as to finally obtain a relatively straight drainage pipeline path plan.
[0052] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.
[0053] Although this document makes frequent use of terms such as chessboard and map, the possibility of using other terms is not excluded. These terms are used merely for the convenience of describing and explaining the essence of this invention; interpreting them as any additional limitation would contradict the spirit of this invention.
Claims
1. A method for planning the first-floor stormwater drainage horizontal plane pipeline using the AStar path planning algorithm, characterized in that... Includes the following steps: S1: Draw the main drainage and / or sewage pipes on the drainage plane and select the exterior wall; S2: Define the map and read map elements; S3: Automatically generate pipeline routes using the improved A* algorithm; S31: Introduce the A* algorithm. The A* algorithm uses the heuristic function f=g+h, where g is the cost from the current point to the starting point, h is the cost from the current point to the ending point, and f is the total cost of the path. The shortest path is found by keeping f as the minimum. In step S31, the direction of the end line is used as the x-direction of the chessboard generation, and the distance from the current point to the end line is used as the cost h. S32: When the current point's direction of travel is different from the previous point, increase the cost j on the cost g, while still keeping f to a minimum to find the shortest path; in step S32, different costs j are assigned to different regions, and infinite costs j are given to regions that cannot be passed. S4: Generate sleeve annotations on the drawing.
2. The method for planning the first-floor stormwater drainage horizontal plane pipeline using the AStar path planning algorithm according to claim 1, characterized in that, Step S1 includes the following steps: S11: Draw the room outline and the outline of the area outside the room; S12: Draw the stormwater main and sewage main for the outer area; S13: Determine the sanitary ware and other risers that need to be connected.
3. The method for planning the first-floor stormwater drainage horizontal plane pipeline using the AStar path planning algorithm according to claim 1, characterized in that, The graphic elements in step S2 are divided into obstacles, endpoint connection lines, and points that need to be connected.
4. The method for planning the first-floor stormwater drainage horizontal plane pipeline using the AStar path planning algorithm according to claim 3, characterized in that, Step S2 includes the following steps: S21: Construct an axis-aligned rectangular bounding box using all primitives, then apply tolerance to the buffer using the axis-aligned rectangular bounding box, and finally obtain the rectangular box, which is the map to be determined. S22: A virtual chessboard with the bottom left corner of the map as the origin, and a given step size for calculating equal step sizes.
5. The method for planning the first-floor stormwater drainage horizontal plane pipeline using the AStar path planning algorithm according to claim 1, characterized in that, Step S3 records the chessboard interval where each landing point is located, and the pipeline path automatically avoids the interval where the landing point is located.
6. The method for planning the first-floor stormwater drainage horizontal plane pipeline using the AStar path planning algorithm according to claim 1, characterized in that, In step S4, the annotation type, annotation planning, and annotation avoidance are set.
7. The method for planning the first-floor stormwater drainage horizontal plane pipeline using the AStar path planning algorithm according to claim 1, characterized in that, Steps S1 to S4 are performed in CAD drawing operations.
Citation Information
Patent Citations
Building pipeline design method and device
CN114547742A
Multi-pipeline arrangement method and related equipment
CN115310245A