Two-dimensional graph exporting and labeling arrangement method and computer readable storage medium
By exporting formatted description text in 3D design software and using layout algorithms and style databases, the problems of redundant lines and overlapping annotations when exporting 2D plan drawings from 3D design software are solved, automated 2D graphic annotation layout is achieved, and the aesthetics and readability of the drawings are improved.
Patent Information
- Application Number
- CN202510746745.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-05
- Publication Date
- 2025-09-26
AI Technical Summary
Existing 3D design software has problems with redundant lines, overlapping annotations, and poor readability when exporting 2D floor plans, requiring engineers to make a lot of manual adjustments, hindering the development of engineering digitalization.
Export formatted description text in 3D design software, use 2D drawing software to parse drawings and add leader annotations to 2D graphics through layout algorithms to reduce the overlap between annotations and graphics. Use style databases to control graphic and text styles to achieve automated 2D graphic annotation layout.
It improves the aesthetics and readability of two-dimensional drawings, reduces the workload of manual adjustment, and improves the efficiency of drawing generation.
Smart Images

Figure CN120705933A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of drawing design, and in particular relates to a method for deriving and annotating two-dimensional graphics and a computer-readable storage medium. Background Art
[0002] While 3D design software such as Revit and Civil3D can create 3D models and transfer model information, they are clearly deficient in outputting 2D drawings. The main issue is that 3D design software typically creates drawings by projecting the 3D model in a certain direction. These projections can contain numerous redundant lines and lack the necessary linear fills and annotations, leading to a significant workload for subsequent manual processing. To meet current delivery requirements, engineers prefer to use 2D design software with mature drawing capabilities, rendering 3D design superficial. The application of BIM technology remains limited to the remodeling stage, hindering the development of digital engineering.
[0003] After the three-dimensional design software exports a two-dimensional plan, the plane coordinates of a large number of key points need to be marked. The current automatic annotation function generally does not take annotation avoidance into consideration, and the problem of overlapping annotations with graphics, and annotations with annotations frequently occurs, resulting in poor readability of the drawings. Engineers are required to manually adjust the annotation positions, which reduces the efficiency of drawing generation. Patent Publication No. CN119048640A provides a method for automatically arranging annotation symbols for two-dimensional drawings. With the component to be annotated as the center, an end point trajectory graphic is preset around it. According to the preset arrangement style and the number of lead starting points, the end point position of the annotation lead is determined to avoid annotation overlap. Patent Publication No. CN117454457A provides a drawing annotation arrangement method. According to the arrangement information input by the user, the annotation position is automatically adjusted so that the overlapping area or margin is lower than the set threshold. The above methods either require a preset end point trajectory or require the user to preset arrangement information, and lack optimization for structural plan drawings.
[0004] Currently, retaining structure design generally uses a two-dimensional approach, with engineers manually drawing structural plans and sections to express their design intent for slopes, retaining walls, or anti-slide piles. This process requires engineers to determine the type of retaining structure to be deployed based on terrain contours. If a slope is chosen, manual grading simulation is required to determine the contours of each level of slope, placing high demands on the design experience and proficiency of the personnel. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to overcome the shortcomings and defects mentioned in the above background technology and provide a method for exporting and annotating two-dimensional graphics and a computer-readable storage medium that can effectively convert three-dimensional designs into two-dimensional plane drawings, and has high efficiency, aesthetics, and readability in the two-dimensional plane drawings. To solve the above technical problems, the technical solutions proposed by the present invention are as follows:
[0006] A method for exporting and annotating two-dimensional graphics, comprising:
[0007] S1. After completing the three-dimensional structure design in the three-dimensional design software, export the description text of the drawing; the description text of the drawing is formatted description text;
[0008] S2. Use 2D drawing software to read and parse the description text of the drawing to obtain all graphics and annotations, and draw the 2D graphics;
[0009] S3. Use an arrangement algorithm to add lead annotations to the two-dimensional graphics, and overlap, compare, and adjust the lead annotations to be drawn with all existing graphics and drawn lead annotations, so that the overlapping range of all lead annotations and all existing graphics is minimized.
[0010] In one embodiment, a style database is provided. After parsing the description text of the drawing to obtain all graphics and annotations, the graphic and text styles are determined through the style database to draw a two-dimensional graphic.
[0011] In one embodiment, S3 includes:
[0012] S30, determining all graphics of the two-dimensional graphics as fixed restricted areas, determining all drawn lead annotations as variable restricted areas, and determining all to-be-drawn lead annotations as undetermined queues;
[0013] S31, extracting the lead annotation to be processed from the undetermined queue, setting the initial value of the lead length, the initial value of the lead angle, the length increment, and the angle increment;
[0014] S32. Perform a traversal search using preset length increments and angle increments on the current leader annotation. If the current leader annotation does not overlap with either the fixed restricted area or the variable restricted area, place the current leader annotation in the variable restricted area and continue processing the next leader annotation in the undetermined queue.
[0015] If the current leader annotation overlaps with the fixed forbidden area, the leader length is increased and the preset length increment and angle increment traversal search is performed again. If it still overlaps with the fixed forbidden area, the current leader annotation is placed in the unsolvable pool 1 and the next leader annotation is processed.
[0016] If the current leader annotation overlaps with either the fixed restricted area or the variable restricted area, the case with the least overlapping area and number of overlapping with the variable restricted area is selected as the preliminary result. Based on this preliminary result, the current leader annotation is added to the variable restricted area, and the drawn overlapping leader annotation is moved from the variable restricted area to the undetermined queue, and the next leader annotation in the undetermined queue is processed. If a leader annotation in the undetermined queue has returned to the undetermined queue more than a first preset number of times after traversal search, the leader length of the leader annotation is expanded and the preset length increment and angle increment traversal search is performed again. If the number of times it has returned to the undetermined queue after traversal search exceeds a second preset number, the leader annotation is placed in the unsolvable pool 2, and the next leader annotation is processed until the undetermined queue is cleared.
[0017] S33. After the undecided queue is cleared, the leader in the unsolvable pool 2 is marked and the step S32 is executed until the unsolvable pool 2 is cleared;
[0018] S34. Force layout of the lead annotations in the unsolvable pool 1.
[0019] In one embodiment, when the drawn overlapped lead line annotations are moved from the variable forbidden area to the undetermined queue, the number of times the lead line annotations are moved from the variable forbidden area to the undetermined queue is recorded.
[0020] In one embodiment, the first preset value is 3 times, and the second preset value is 6 times.
[0021] In one embodiment, the lead annotations in the unsolvable pool 1 are forcibly arranged according to the initial positions.
[0022] In one embodiment, the style database includes the layer, color, line type, line width of the graphics, and the font and height style data of the annotations.
[0023] In one embodiment, the three-dimensional structure design is a retaining three-dimensional structure design, and the design content includes: selecting a retaining structure type, setting size parameters, and setting a slope protection type.
[0024] In one embodiment, the range of the leader annotation is a rectangle centered on the annotation text, with a length 1.2 times the character height and a length 1.2 times the character width.
[0025] Based on the same inventive concept, a computer-readable storage medium is further provided, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor executes any one of the methods described above.
[0026] Compared with the prior art, the beneficial effects of the present invention are as follows: using the method for exporting and annotating and arranging two-dimensional graphics of the present application, the description text of the drawing is exported after the three-dimensional structure design is completed in the three-dimensional design software; and the description text of the drawing is a formatted description text, and the formatted description text can be read and parsed by the two-dimensional drawing software to obtain all graphics and annotations, and draw the two-dimensional graphics; using the arrangement algorithm to add lead annotations to the two-dimensional graphics, by comparing and adjusting the overlapping range of the lead annotations with all existing graphics and the drawn lead annotations, the overlapping range of all lead annotations with other two-dimensional graphics is minimized, which solves the problem of overlapping annotations affecting reading when drawing, reduces the workload of manual adjustment in the later stage, and improves the aesthetics and readability of the two-dimensional drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0028] Figure 1 A schematic flow chart of a method for exporting and annotating two-dimensional graphics according to one embodiment;
[0029] Figure 2 A schematic diagram of a flow chart of a lead line annotation arrangement algorithm according to one embodiment;
[0030] Figure 3 This is a typical lead line marking schematic diagram in one embodiment;
[0031] Figure 4 This is a schematic diagram of a slope cross section in one embodiment;
[0032] Figure 5 This is a schematic diagram of a slope plane in one embodiment;
[0033] Figure 6 Schematic cross-section of a retaining wall and anti-slide piles in one embodiment;
[0034] Figure 7 This is a schematic plan view of a retaining wall and anti-slide piles in one embodiment;
[0035] Figure 8 A schematic diagram of a fixed restricted area and a starting point of a lead line to be marked in one embodiment;
[0036] Figure 9 A schematic diagram of the initial position of the lead mark in one embodiment;
[0037] Figure 10A schematic diagram showing the overlap of the initial position of the lead mark and the fixed restricted area in one embodiment;
[0038] Figure 11 This is a diagram showing the effect of automatically avoiding overlap between a lead mark and a fixed restricted area in one embodiment;
[0039] Figure 12 Schematic diagram of optional positions of lead line mark 6 and its overlap with lead line mark 7 in one embodiment;
[0040] Figure 13 This is a schematic diagram of an embodiment in which lead lines 6 and 7 are adjusted together;
[0041] Figure 14 Schematic diagram of the initial positions of the lead lines 8 and 9 in one embodiment. DETAILED DESCRIPTION
[0042] To facilitate understanding of the present invention, the present invention will be described in more comprehensive and detailed form below in conjunction with the accompanying drawings and preferred embodiments. However, the protection scope of the present invention is not limited to the following specific embodiments.
[0043] Unless otherwise defined, all technical terms used hereinafter have the same meanings as those generally understood by those skilled in the art. The technical terms used herein are only for the purpose of describing specific embodiments and are not intended to limit the scope of protection of the present invention.
[0044] Unless otherwise specified, various raw materials, reagents, instruments and equipment used in the present invention can be purchased from the market or prepared by existing methods.
[0045] See also Figure 1-14 , a method for exporting and annotating two-dimensional graphics, comprising:
[0046] S1. After completing the three-dimensional structure design in the three-dimensional design software, the description text of the drawing is exported; the description text of the drawing is formatted description text.
[0047] Specifically, in one embodiment, the structural graphics can be retaining structure graphics. Specifically, its text is divided into two parts: a plan view and a cross-sectional view of the retaining structure. A retaining scheme includes a section of plan view text and several sections of cross-sectional view text, and one section of text describes one drawing. The plan view text contains the plan views of the slope, retaining wall, anti-slip pile, and road, the marked positions and text content, as well as the position and direction of the section; each section of the cross-sectional view text contains the cross-sectional views of the slope, retaining wall, anti-slip pile, road, and terrain, as well as the marked positions and text content, etc.; each section position in the plan view text corresponds to a section of cross-sectional view text.
[0048] Specifically, in one embodiment, the formatted description text can be a protective drawing description text in XML (Extensible Markup Language) format. In other embodiments, it can also be a formatted text of JSON type, as long as it can be read and parsed by two-dimensional drawing software.
[0049] S2. Use 2D drawing software to read and parse the description text of the drawing to obtain all graphics and annotations, and draw 2D graphics.
[0050] Preferably, a style database is provided. After parsing the descriptive text of the drawing to obtain all graphics and annotations, the graphic and text styles are determined through the style database to draw two-dimensional graphics. Specifically, in one embodiment, in the drawing software, each graphic or annotation is preset with a corresponding label according to its engineering meaning, and the style data such as the layer, color, line type, line width of the graphic, or the font and character height of the annotation are retrieved through the label in the style database. The style database is used to control the graphics and text styles of the two-dimensional drawing, and free control of the layer, color, line type, line width and font and character height of any graphic is achieved; the drawing style can be modified by modifying only the database without modifying the code; the drawing style specified by the enterprise standard can be configured, and the drawing result meets the enterprise standard; each enterprise is supported to customize its own drawing style.
[0051] S3. Use an arrangement algorithm to add lead annotations to the two-dimensional graphics, and overlap, compare, and adjust the lead annotations to be drawn with all existing graphics and drawn lead annotations, so that the overlapping range of all lead annotations and all existing graphics is minimized.
[0052] Specifically, combined Figure 2 As shown in the flowchart of the lead annotation arrangement algorithm, in one embodiment, S3 includes:
[0053] S30, determining all graphics of the two-dimensional graphics as fixed restricted areas, determining all drawn lead annotations as variable restricted areas, and determining all to-be-drawn lead annotations as undetermined queues;
[0054] S31, extracting the lead annotation to be processed from the undetermined queue, setting the initial value of the lead length, the initial value of the lead angle, the length increment, and the angle increment;
[0055] Specifically, in one embodiment, a lead annotation data is taken from the undetermined queue, the initial value of the lead length ρ0 is taken, the initial lead direction is the external normal direction of the annotation object figure, and the angle between the initial lead direction and the positive direction of the X-axis is the initial value of the lead angle θ0. Figure 3 It is a schematic diagram of lead annotation, which defines the lead length ρ, lead direction, angle θ between the lead direction and the positive direction of the X-axis, and is used to determine the range of overlap.
[0056] S32. Perform a traversal search using preset length increments and angle increments on the current leader annotation. If the current leader annotation does not overlap with either the fixed restricted area or the variable restricted area, place the current leader annotation in the variable restricted area and continue processing the next leader annotation in the undetermined queue.
[0057] Specifically, in one embodiment, a traversal value range is specified for ρ and θ, and the two parameters are traversed within the value range according to certain length increments and angle increments Δρ and Δθ until the lead mark does not overlap with the fixed restricted area and the variable restricted area.
[0058] If the current leader annotation overlaps with the fixed forbidden area, the leader length ρ is increased, and the preset length increment and angle increment traversal search is performed again. If it still overlaps with the fixed forbidden area, the current leader annotation is placed in the unsolvable pool 1 and the next leader annotation is processed.
[0059] If the current leader annotation overlaps with either the fixed restricted area or the variable restricted area, the case with the least overlapping area and number of overlapping with the variable restricted area is selected as the preliminary result. Based on this preliminary result, the current leader annotation is added to the variable restricted area, and the drawn overlapping leader annotation is moved from the variable restricted area to the undetermined queue, and the next leader annotation in the undetermined queue is processed. If a leader annotation in the undetermined queue has returned to the undetermined queue more than a first preset number of times after traversal search, the leader length ρ is increased and the preset length increment and angle increment traversal search is performed again. If the number of times it has returned to the undetermined queue after traversal search exceeds a second preset number, the leader annotation is placed in the unsolvable pool 2, and the next leader annotation is processed until the undetermined queue is cleared.
[0060] S33. After the undecided queue is cleared, the leader in the unsolvable pool 2 is marked and the step S32 is executed until the unsolvable pool 2 is cleared;
[0061] S34. Force layout of the lead annotations in the unsolvable pool 1.
[0062] Specifically, in one embodiment, when the drawn overlapped lead annotation migrates from the variable restricted area to the undetermined queue, the number of times the lead annotation migrates from the variable restricted area to the undetermined queue is recorded. Specifically, the first preset value is 3 times, and the second preset value is 6 times. The lead annotations in the unsolvable pool 1 are forcibly laid out according to the initial position. The range of the lead annotation is a rectangle centered on the annotated text, with a length of 1.2 times the character height and a length of 1.2 times the character width. Of course, the range of the lead annotation can also be changed accordingly according to actual needs.
[0063] Based on the same inventive concept, a computer-readable storage medium is also provided, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor is caused to execute the above method.
[0064] Example
[0065] Taking the partial protection scheme of a hydropower station relocation town planning design project as an example, the following steps are taken to produce the drawing:
[0066] Step 1: Complete the design of the retaining structure in 3D design software. Specifically, automatically or manually determine the retaining type for each elevation difference, including: slope, retaining wall, anti-slide pile, slope + retaining wall, slope + anti-slide pile. For slopes, set parameters such as slope rate, slope height, and platform width, and specify the slope protection type for each slope, such as vegetated cement soil ecological slope protection. For retaining wall locations, set the retaining wall type, including counterweight, inclined, and upright. Select the location for which to export the profile.
[0067] Step 2: Export the retaining drawing description text in XML (Extensible Markup Language) format from the 3D design software. The XML structure follows the node hierarchy of "drawing - block - line or annotation - point or text." First, define four basic nodes: point, text, line string, and elevation. Their attributes and subordinate nodes are shown in Table 1. Then, define the drawing root node and use a hierarchical indentation format to represent the expanded structure of all child nodes under the drawing root node, as shown in Table 2.
[0068] Table 1
[0069] XML basic nodes Attribute (meaning) Lower-level nodes point x (x coordinate value), y (y coordinate value) Word content (text content), textStyleId (text style), angle (text angle) Line String elementStyleId (line style number), closed (whether the line is closed) point elevation point, text
[0070] Table 2
[0071]
[0072]
[0073] The specific steps for exporting the retaining drawing XML in the 3D design software are as follows:
[0074] Step 1: Find all the retaining baselines and divide them into sections according to the retaining type, including slope group, retaining wall group, and anti-slide pile group;
[0075] Step2: Reference Figure 4 and 5 , traverse the slope group, determine the up, down, left and right directions of the slope relative to the retaining baseline; write the BP points of the same-level slopes of adjacent sections in sequence to form a BP line; write the PT points of the same-level slopes of adjacent sections in sequence to form a PT line, and extend the end point of the PT line to the upper-level BP point of the adjacent section on the outside; write the slope end points of the adjacent sections in sequence to form a slope end point line.
[0076] Step3: Reference Figure 6 and 7, traverse the retaining wall group, determine the up, down, left, and right directions of the retaining wall relative to the retaining baseline; write the top points of the retaining walls of adjacent sections in sequence to form the top line of the retaining wall; write the bottom points of the retaining walls of adjacent sections in sequence to form the bottom line of the retaining wall.
[0077] Step4: Reference Figure 6 and 7 , traverse the anti-sliding pile group, determine the up, down, left, and right directions of the anti-sliding pile relative to the retaining baseline; write the bottom points of the anti-sliding piles in adjacent sections in sequence to form the anti-sliding pile baseline.
[0078] Step 5: Find all road edges and write them into road tile nodes.
[0079] Step 6: Find all the cutting lines, number them and write them into the cutting symbol block node.
[0080] Step 7: Use the cutting line to cut the 3D model and obtain the corresponding cross-sectional view. The cross-sectional view number corresponds to the cutting line number one by one.
[0081] Step 3: Determine the graphic and text styles using the style database. As shown in Tables 3 and 4, graphics or annotations on structural plan views use element tags beginning with "JGPM-," while graphics or text on section views use element tags beginning with "JGPou-." A default graphic and text style is preset; graphics and text without a specific tag use the default style. Before drawing a graphic or annotation, the rendering software first queries the style database using the preset tags to determine the style used for the graphic or annotation.
[0082] Table 3
[0083] serial number Element Tags Layer Name Color number Line Type Line Width illustrate 297 JGPM-Slope Thick Solid Line JGPM-Slope 3 (green) 0 2 Slope PT line 298 JGPM-Slope Thin Solid Line JGPM-Slope 3 (green) 0 0 Slope indicator lines, etc. 299 JGPM-Retaining Wall Top Line JGPM-Retaining Wall 4 (blue) 3 3 Retaining wall top line 300 JGPM-Retaining Wall Bottom Line JGPM-Retaining Wall 4 (blue) 0 0 Retaining wall bottom line 301 JGPM-Anti-slide pile outline JGPM-Anti-slide pile 4 (blue) 0 0 Anti-slip piles and boundaries 302 JGPM-Anti-slip pile axis JGPM-Anti-slide pile 4 (blue) 3 0 Anti-slip pile centerline 303 JGPM-Section Cut Symbol JGPM-Section Cut Symbol 1 (red) 0 4 Cutting symbol 304 JGPM-Roadside JGPM-Road 0 (black) 0 0 Roadside 305 JGPou-Hatch JGPou-Hatch 6 (magenta) 0 0 Sectional drawing hatching 306 JGPou-Topographic Line JGPou-Topographic Line 0 (black) 0 0 Profile topographic line 307 JGPou-Road Section Line JGPou-Road Section Line 0 (black) 0 3 Profile road hatch
[0084] Table 4
[0085] serial number Element Tags Layer Name Font height Color number 80 JGPM-Slope Marking JGPM-Slope 3.5 4 (blue) 81 JGPM-Retaining Wall Numbering JGPM-Retaining Wall 3.5 6 (magenta) 82 JGPM-Retaining Wall Section Marking JGPM-Retaining Wall 3 4 (blue) 83 JGPM-Anti-slide pile number marking JGPM-Anti-slide pile 3.5 6 (magenta) 84 JGPM-Anti-slide pile number marking JGPM-Anti-slide pile 2.5 4 (blue) 85 JGPM-Sectional Symbol Annotation JGPM-Section Cut Symbol 3 1 (red) 86 JGPou-elevation JGPou-Level 2.5 2.5 0 (black) 87 JGPou-Annotation JGPou-Annotation 3.0 3 0 (black)
[0086] Step 4: The drawing software parses the retaining wall description text and draws the structural plan and section drawings. The specific steps are as follows:
[0087] Step 1: Parse the line data in the description text and use the style found in step 3 to draw the plane figure and the cross-section figure respectively.
[0088] Step 2: Use built-in logic to draw auxiliary graphics such as slope lines and anti-slip pile body contour lines.
[0089] Step 3: Parse the annotation data in the description text and use the style retrieved in Step 3 to draw annotations for different annotation types using different built-in logic. For example, on a plan view, the "Slope Grade and Protection Type Annotation" is placed on the side of the slope path line away from the starting point of the slope. The upward direction of the text is perpendicular to the slope baseline and the angle with the upward direction of the drawing is less than 90°. For example, on a section view, the "Elevation Symbol" is placed near the coordinate point specified in the description text. Draw an inverted triangle with its lower vertex at that coordinate point as the elevation symbol, and place the elevation text above the inverted triangle. The upward direction of the text is consistent with the upward direction of the drawing.
[0090] Step 5: Add leader annotations to the structural plan. Points that require leader annotations include: obvious turning points on the slope contour line, the starting and ending points of straight or circular segments on the bottom line of the retaining wall or the centerline of the anti-slip pile, and the midpoints of circular segments on the bottom line of the retaining wall or the centerline of the anti-slip pile. Obvious turning points on the slope contour line can be found using a two-dimensional rarefaction algorithm such as the raster method or the Douglas-Peucker algorithm; other points are found using specific mapping methods. The steps of the layout algorithm are as follows:
[0091] Step 1: Set the fixed restricted area and the starting point to be marked. The fixed restricted area includes: slope graphics, retaining wall graphics, anti-slip pile graphics, and annotations other than leader annotations. The locations where leader annotations need to be added are: obvious turning points on the slope contour line, the starting and ending points of the straight line or arc segment on the bottom line of the retaining wall or the center axis of the anti-slip pile, and the midpoint of the arc segment on the bottom line of the retaining wall or the center axis of the anti-slip pile. Figure 8 , the two slope blocks are used as fixed restricted areas, the slope turning position is the starting position of the leader line to be marked, and the leader line to be marked is marked as an undetermined queue.
[0092] Step 2: Take out the leader mark 1 from the undetermined queue, such as Figure 9 , taking the initial value of the lead length ρ0 = 4m. This initial value can also be other values, but based on experience, it is generally between 4 and 10m. The initial lead direction is the direction of the outer normal of the annotated object, that is, the initial angle is θ0 = 228°. Determine whether the initial position of the lead annotation does not overlap with the fixed restricted area and the variable restricted area. Therefore, preliminarily determine the position of the lead annotation and move it from the undetermined queue to the variable restricted area. Similarly, the initial positions of lead annotations 2 and 3 do not overlap, so they are moved into the variable restricted area.
[0093] Step 3: Take out the lead mark 4 from the undetermined queue, such as Figure 10, its initial position (ρ0,θ0) = (4,191°) overlaps with the fixed restricted area. Within the range of ρ∈[4,10] and θ∈[0°,360°), traversing by length increment Δρ = 1 and angle increment Δθ = 20°, we find that at (ρ,θ) = (4,251°), the leader annotation 4 does not overlap with either the fixed restricted area or the variable restricted area, and moves it into the variable restricted area. Finally, all the positions to be annotated on the two slopes are successfully arranged with leader annotations, as shown in the following example: Figure 11 As shown, these arranged leader annotations become new variable forbidden areas.
[0094] Step 4: Take the lead annotation 5 from the undetermined queue. All the results within its value range overlap with the fixed forbidden zone. Expand the range of ρ and traverse again. If the traversal results still overlap with the fixed forbidden zone, move the lead annotation 5 into the unsolvable pool 1.
[0095] Step 5: Take the lead mark 6 from the undetermined queue. All results within its value range overlap with the fixed forbidden area or the variable forbidden area, and there are results that only overlap with the variable forbidden area. Figure 12 All possible positions for lead annotation 6 within the range are listed. After excluding any overlaps with fixed restricted areas, there are 16 points that overlap with lead annotation 7. The point with the smallest overlap area is selected, and lead annotation 6 is moved into the variable restricted area, while lead annotation 7 is moved back to the undetermined queue. When lead annotation 7 is subsequently removed from the undetermined queue, a position that does not overlap with any restricted areas is found within the range, thus completing the labeling of lead annotations 6 and 7. Figure 13 .
[0096] Step 6: Take out the lead mark 8 from the undetermined queue and mark it successfully according to the initial position. Figure 14 , and moves it into the variable forbidden zone. Lead annotation 9 is removed from the undetermined queue. There is no solution, but it only overlaps with lead annotation 8. Therefore, 9 is moved into the variable forbidden zone and 8 is moved back to the undetermined queue. When lead annotation 8 is removed again, it also always overlaps with the fixed forbidden zone or lead annotation 9. Therefore, 8 is moved into the variable forbidden zone and 9 is moved back to the undetermined queue. After the sixth cycle, lead annotation 8 enters the unsolvable pool 2, and lead annotation 9 is marked according to the position determined in the fifth cycle. Finally, lead annotation 8 is moved from the unsolvable pool 2 to the variable forbidden zone and a new cycle begins, ignoring the variable forbidden zone. Lead annotation 8's initial position does not overlap with the fixed forbidden zone, so it is directly used as the final position.
[0097] according to Figure 2The algorithm flow shown clears the undetermined queue, unsolvable pool 1, and unsolvable pool 2, adds a variable restricted zone to all lead annotations, and completes the lead annotation layout. In other embodiments, if unsolvable pool 1 cannot be cleared, all annotations in unsolvable pool 1 are marked at the initial position (ρ0, θ0). The user can then check the drawing and manually adjust the small number of unsolvable annotations in unsolvable pool 1.
[0098] The above are only preferred embodiments of the present invention. It should be pointed out that the present invention is not limited to the above embodiments. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should also be regarded as the scope of protection of the present invention.
Claims
1. A method for deriving and annotating two-dimensional graphics, characterized in that: The steps include: S1. After completing the three-dimensional structure design in the three-dimensional design software, export the description text of the drawing; the description text of the drawing is formatted description text; S2. Use 2D drawing software to read and parse the description text of the drawing to obtain all graphics and annotations, and draw the 2D graphics; S3. Use an arrangement algorithm to add lead annotations to the two-dimensional graphics, and overlap, compare, and adjust the lead annotations to be drawn with all existing graphics and drawn lead annotations, so that the overlapping range of all lead annotations and all existing graphics is minimized.
2. The method for deriving and annotating two-dimensional graphics according to claim 1, characterized in that: A style database is provided. After parsing the description text of the drawing to obtain all graphics and annotations, the graphic and text styles are determined through the style database to draw two-dimensional graphics.
3. The method for deriving and annotating two-dimensional graphics according to claim 1, characterized in that: S3 includes: S30, determining all graphics of the two-dimensional graphics as fixed restricted areas, determining all drawn lead annotations as variable restricted areas, and determining all to-be-drawn lead annotations as undetermined queues; S31, extracting the lead annotation to be processed from the undetermined queue, setting the initial value of the lead length, the initial value of the lead angle, the length increment, and the angle increment; S32. Perform a traversal search using preset length increments and angle increments on the current leader annotation. If the current leader annotation does not overlap with either the fixed restricted area or the variable restricted area, place the current leader annotation in the variable restricted area and continue processing the next leader annotation in the undetermined queue. If the current leader annotation overlaps with the fixed forbidden area, the leader length is increased and the preset length increment and angle increment traversal search is performed again. If it still overlaps with the fixed forbidden area, the current leader annotation is placed in the unsolvable pool 1 and the next leader annotation is processed. If the current leader annotation overlaps with either the fixed restricted area or the variable restricted area, the case with the least overlapping area and number of overlapping with the variable restricted area is selected as the preliminary result. Based on this preliminary result, the current leader annotation is added to the variable restricted area, and the drawn overlapping leader annotation is moved from the variable restricted area to the undetermined queue, and the next leader annotation in the undetermined queue is processed. If a leader annotation in the undetermined queue has returned to the undetermined queue more than a first preset number of times after traversal search, the leader length of the leader annotation is expanded and the preset length increment and angle increment traversal search is performed again. If the number of times it has returned to the undetermined queue after traversal search exceeds a second preset number, the leader annotation is placed in the unsolvable pool 2, and the next leader annotation is processed until the undetermined queue is cleared. S33. After the undecided queue is cleared, the leader in the unsolvable pool 2 is marked and the step S32 is executed until the unsolvable pool 2 is cleared; S34. Force layout of the lead annotations in the unsolvable pool 1.
4. The method for deriving and annotating two-dimensional graphics according to claim 3, characterized in that: When the drawn overlapped leader annotations migrate from the variable forbidden area to the undetermined queue, the number of times the leader annotations migrate from the variable forbidden area to the undetermined queue is recorded.
5. The method for deriving and annotating two-dimensional graphics according to claim 3, characterized in that: The first preset value is 3 times, and the second preset value is 6 times.
6. The method for deriving and annotating two-dimensional graphics according to claim 3, characterized in that: The leader annotations in the unsolvable pool 1 are forcibly laid out according to the initial position.
7. The method for deriving and annotating two-dimensional graphics according to claim 2, characterized in that: The style database includes the layer, color, line type, line width of the graphics, and the font and height style data of the annotations.
8. The method for deriving and annotating two-dimensional graphics according to claim 2, characterized in that: The three-dimensional structure design is a retaining three-dimensional structure design, and the design content includes: selecting the retaining structure type, setting size parameters and setting the slope protection type.
9. The method for deriving and annotating two-dimensional graphics according to claim 2, characterized in that: The range of the leader annotation is a rectangle with the annotation text as the center, a length of 1.2 times the character height and 1.2 times the character width.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, which, when executed by a processor, enable the processor to perform the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Drawing annotation arrangement method and system and related equipment
CN117454457A
Method for automatically arranging two-dimensional diagram annotation symbols
CN119048640A
Cited By
BIM (Building Information Modeling)-based pressurized air supply system diagram automatic drawing and intelligent labeling method and system
CN121502896A