Method for automatically arranging two-dimensional diagram annotation symbols
Through the method of automatically arranging two-dimensional icon annotation symbols, the problems of low efficiency and poor aesthetics of two-dimensional icon annotation symbols in the existing technology are solved, efficient and automated annotation symbol generation is realized, and the two-dimensional image is improved Readability and aesthetics.
Patent Information
- Application Number
- CN202410877070.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-11-29
AI Technical Summary
Existing computer-aided design software cannot realize the automatic arrangement of two-dimensional icon symbols, resulting in confusion of lead crosses, reducing the aesthetics and readability of the two-dimensional image, and requires manual adjustment, which is time-consuming and labor-intensive, resulting in inefficiency.
Provide a two-dimensional icon symbol automatic arrangement method. By obtaining the information of the view and the label object, reading the size and coordinate data, determining the lead end coordinates based on the manually preset label symbol arrangement style and the number of lead starting points, and constructing Line segments are connected to the starting point and end point according to rules, and labeled symbols are generated to reduce human intervention and improve generation efficiency.
The automatic arrangement of two-dimensional icon annotations is realized, which reduces human intervention, improves the aesthetics and readability of two-dimensional images, and improves work efficiency.
Smart Images

Figure CN119048640A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent manufacturing technology, and in particular to a method for automatically arranging two-dimensional diagram annotation symbols. Background Art
[0002] In the field of manufacturing and engineering technology, 2D drawings are still widely used due to their unique practicality, cost-effectiveness and broad user base. 2D drawings have obvious advantages over 3D model descriptions in expressing details such as dimensions, tolerances and technical requirements. In addition, processing inspection (such as three-dimensional coordinate inspection, CNC machine tool online inspection, etc.) reports and part assembly drawings are also often described in the form of 2D drawings.
[0003] The defects of the prior art are:
[0004] 1. Since the existing computer-aided design software cannot automatically arrange annotation symbols, the leads are crossed and chaotic, which reduces the beauty and readability of the two-dimensional drawing.
[0005] 2. The existing computer-aided design software requires manual adjustment of the layout and annotation symbols, which is time-consuming and labor-intensive, resulting in low work efficiency. Summary of the invention
[0006] In view of the above problems, the present invention provides a method for automatically arranging symbols for two-dimensional diagram annotations, which aims to reduce human intervention, improve the efficiency of generating two-dimensional diagram annotations, and enhance the aesthetics and readability of two-dimensional diagrams.
[0007] To solve the above problems, the technical solution provided by the present invention is:
[0008] The method for automatically arranging two-dimensional diagram annotation symbols includes the following steps:
[0009] S100. Obtaining a view to be annotated and an annotated object in the view;
[0010] S200. Read the size information of the view; the size information specifically includes length and width; read the center coordinates of the center position of the annotated object; read the starting point coordinates of the annotated lead line starting point of the annotated object; record the number of the annotated lead line starting points;
[0011] S300. Determine the end point coordinates of all the end point arrangement positions of the annotation lead lines according to the manually preset annotation symbol arrangement style and the number of the starting points of the annotation lead lines;
[0012] S400. Connect each of the annotation leader start point and the annotation leader end point one by one to construct a line segment, and then determine that each annotation leader end point has only one annotation leader start point connected to it according to a manually preset annotation leader determination rule;
[0013] S500. Generate a labeling symbol on the view according to the connection result between the starting point of each labeling lead line and the end point of each labeling lead line.
[0014] Preferably, S300 specifically includes the following steps:
[0015] S310. Obtain the starting point coordinate set of the annotation leader starting point, the starting point coordinate set is expressed as follows:
[0016]
[0017] Where: P Start is used to represent the starting point coordinate set; n is used to represent the number of the annotation leader starting points; Each specific coordinate of the starting point coordinates used to characterize the starting point of the annotation leader line;
[0018] S320. Generate a labeling leader end point trajectory graphic including the labeling object according to the labeling symbol arrangement style and the size information of the view;
[0019] S330. Draw multiple rays from the center coordinates as the starting point to the end point trajectory of the marked leader line; the angle between two adjacent rays is expressed as follows:
[0020]
[0021] Wherein: ∠ is used to represent the angle between two adjacent rays;
[0022] S340. Obtain the first intersection point of the annotation leader endpoint trajectory graph and all the rays, the set of the first intersection points is the endpoint coordinate set of the annotation leader endpoint; the endpoint coordinate set is expressed as follows:
[0023] P end = {P1,P2,…,P n}
[0024] Where: P end The endpoint coordinate set used to characterize the endpoint of the annotation leader; P1, P2, ..., P n Each specific coordinate of the endpoint coordinate is used to characterize the endpoint of the annotation leader.
[0025] Preferably, S400 specifically includes the following steps:
[0026] S410. Connect each point in the end point coordinate set with each point in all the start point coordinate sets in pairs, and then construct a first line segment set containing n×n line segments; the first line segment set is expressed as follows:
[0027] L={L1,L2,...,L n×n}
[0028] Wherein: L is used to represent the first line segment set; L1, L2, ..., L n×n used to characterize each of the line segments in the first line segment set;
[0029] S420. Calculate the lengths of all the line segments in the first line segment set;
[0030] S430. Set a loop variable and initialize the value of the loop variable to 0; construct a second line segment set, which is expressed as follows:
[0031] L'=L
[0032] Wherein: L' is used to characterize the second line segment set;
[0033] S440. Determine whether the loop variable satisfies the loop determination condition, and then perform the following operations according to the determination result:
[0034] If the judgment result is that the loop variable satisfies the loop judgment condition, executing S450;
[0035] If the judgment result is that the loop variable does not satisfy the loop determination condition, execute S4100;
[0036] The cycle determination condition is expressed as follows:
[0037] i<n
[0038] Wherein: i is used to characterize the loop variable;
[0039] S450. Obtain the number of second intersections between each line segment in the second line segment set and other line segments in the second line segment set;
[0040] S460. Finding a matching line segment with the least number of second intersection points and the shortest length from the second line segment set;
[0041] S470. Finding a third line segment set consisting of the line segments whose endpoints are the same as the matching line segment from the second line segment set;
[0042] S480. Delete the third line segment set from the second line segment set, and then set the result after deletion as the second line segment set, which is specifically expressed as follows:
[0043] L′=L′-L″
[0044] Wherein: L″ is used to characterize the third line segment set;
[0045] S490. The loop variable is incremented by 1, and then S440 is executed;
[0046] S4100. The line segments that are not deleted in the second line segment set are the lines between the start point of the annotation leader line and the end point of the annotation leader line, and then the calculation ends.
[0047] Preferably, the annotation leader end point trajectory graphic corresponding to the annotation symbol arrangement style is a circle.
[0048] Preferably, the annotation leader end point trajectory graphic corresponding to the annotation symbol arrangement style is an ellipse.
[0049] Preferably, the annotation leader end point trajectory graphic corresponding to the annotation symbol arrangement style is a square.
[0050] Compared with the prior art, the present invention has the following advantages:
[0051] 1. The present invention is seamlessly integrated into computer-aided design software, generates coordinate points of annotation objects through the geometric feature association technology of two-dimensional drawings, and generates two-dimensional drawings according to the automatic arrangement rules of annotation symbols, thereby reducing human intervention and improving the efficiency of generating two-dimensional diagram annotations.
[0052] 2. The present invention solves the problem that existing computer-aided design software cannot realize automatic arrangement of annotation symbols and leads are crossed and chaotic, thereby improving the aesthetics and readability of two-dimensional drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1a A schematic diagram of a circular marking arrangement style of a specific embodiment of the present invention;
[0054] Figure 1b It is a schematic diagram of an elliptical label arrangement style of a specific embodiment of the present invention;
[0055] Figure 1c A schematic diagram of a square marking arrangement style of a specific embodiment of the present invention;
[0056] Figure 2 It is a schematic diagram of the overall process of a specific embodiment of the present invention;
[0057] Figure 3 It is a schematic diagram of a split circle view of a specific embodiment of the present invention;
[0058] Figure 4 It is a schematic diagram of a process for determining a connection line between a start point of a labeling lead line and an end point of a labeling lead line according to a specific embodiment of the present invention;
[0059] Figure 5It is a schematic diagram of the annotation results of the two-dimensional graph of the electrode according to a specific embodiment of the present invention.
[0060] Among them: 1. Mark the starting point of the lead line, 2. Mark the end point of the lead line, 3. Mark the symbol, 4. Mark the trajectory graphic of the end point of the lead line. DETAILED DESCRIPTION
[0061] The present invention is further explained below in conjunction with specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention. After reading the present invention, various equivalent forms of modifications to the present invention by those skilled in the art all fall within the scope defined by the claims attached to this application.
[0062] like Figure 1a , Figure 2 and Figure 5 The two-dimensional diagram of the electrode shown in the figure, and the method for automatically arranging the two-dimensional diagram annotation symbols include the following steps:
[0063] S100. Obtain the view to be annotated and the annotated object in the view.
[0064] S200. Read the dimension information of the view; the dimension information specifically includes the length and width; read the center coordinates of the center position of the annotation object; determine the annotation leader starting point 1; read the starting point coordinates of the annotation leader starting point 1 of the annotation object; record the number of annotation leader starting points 1.
[0065] S300. Determine the end point coordinates of the arrangement positions of all the annotation lead line end points 2 according to the manually preset annotation symbol arrangement style and the number of the annotation lead line start points 1.
[0066] S400. Connect each annotation leader starting point 1 and annotation leader end point 2 one by one to construct line segments, and then determine that each annotation leader end point 2 has only one annotation leader starting point 1 connected to it according to a manually preset annotation leader determination rule.
[0067] S500. Generate a labeling symbol 3 on the view according to the connection result of each labeling lead line starting point 1 and each labeling lead line end point 2.
[0068] It should be noted that S300 is used to mark the information of the end point 2 of the lead line.
[0069] It should be further explained that S300 specifically includes the following steps:
[0070] S310. Obtain the starting point coordinate set of the annotation leader starting point 1, the starting point coordinate set is expressed according to formula (1):
[0071]
[0072] Where: P StartIt is used to represent the starting point coordinate set; n is used to represent the number of starting points 1 of the annotation leader; Used to represent each specific coordinate of the starting point coordinate of the labeled leader starting point 1.
[0073] S320. Generate a labeling leader end point trajectory graphic 4 including the labeling object according to the labeling symbol arrangement style and the dimension information of the view.
[0074] S330. Figure 3 As shown, multiple rays are drawn from the center coordinates to the end point of the marked lead line trajectory figure 4; the angle between two adjacent rays is expressed by formula (2):
[0075]
[0076] Among them: ∠ is used to represent the angle between two adjacent rays.
[0077] S340. Obtain the first intersection of the labeled lead end point trajectory figure 4 and all rays. The set of first intersection points is the end point coordinate set of the labeled lead end point 2. The end point coordinate set is expressed by formula (3):
[0078] P end = {P1,P2,...,P n} (3)
[0079] Where: P end The endpoint coordinate set used to represent the endpoint 2 of the annotation leader; P1, P2, ..., P n Used to characterize each specific coordinate of the endpoint coordinate of the labeled leader endpoint 2.
[0080] like Figure 3 As shown, in this specific embodiment, four labeled objects are used as rays.
[0081] It should be noted that S400 is used to determine a unique connection line between each annotation leader start point 1 and each annotation leader end point 2 .
[0082] like Figure 4 As shown, it needs to be further explained that S400 specifically includes the following steps:
[0083] S410. Connect each point in the end point coordinate set with each point in all the start point coordinate sets in pairs, and then construct a first line segment set containing n×n line segments; the first line segment set is expressed as follows:
[0084] L={L1,L2,..,L n×n} (4)
[0085] Where: L is used to represent the first line segment set; L1, L2, ..., Ln×n Used to characterize each line segment in the first line segment set.
[0086] S420. Calculate the lengths of all line segments in the first line segment set.
[0087] S430. Set a loop variable and initialize the value of the loop variable to 0; construct a second line segment set, the second line segment set is expressed according to formula (5):
[0088] L'=L (5)
[0089] Wherein: L' is used to represent the second line segment set.
[0090] S440. Determine whether the loop variable meets the loop determination condition, and then perform the following operations based on the determination result:
[0091] If the judgment result is that the loop variable satisfies the loop judgment condition, S450 is executed.
[0092] If the judgment result is that the loop variable does not satisfy the loop determination condition, execute S4100.
[0093] The loop determination condition is expressed as follows:
[0094] i<n (6)
[0095] Among them: i is used to represent the loop variable.
[0096] S450. Obtain the number of second intersections between each line segment in the second line segment set and other line segments in the second line segment set.
[0097] S460. Find the matching line segment with the least number of second intersection points and the smallest length from the second line segment set; the matching line segment is L check To characterize.
[0098] S470. Find a third line segment set from the second line segment set, which consists of line segments whose endpoints are the same as the matching line segment.
[0099] S480. Delete the third line segment set from the second line segment set, and then set the result after deletion as the second line segment set, specifically expressed as formula (7):
[0100] L′=L′-L″ (7)
[0101] Wherein: L″ is used to represent the third line segment set.
[0102] S490. The loop variable is incremented by 1, and then S440 is executed.
[0103] S4100. The line segments that are not deleted in the second line segment set are the lines between the annotation leader start point 1 and the annotation leader end point 2, and then the calculation ends.
[0104] like Figure 1a As shown, it should be noted that the annotation leader end point track figure 4 corresponding to the annotation symbol arrangement style is a circle.
[0105] like Figure 1b As shown, it should be noted that the annotation leader end point track figure 4 corresponding to the annotation symbol arrangement style is an ellipse.
[0106] like Figure 1c As shown, it should be noted that the annotation leader end point track figure 4 corresponding to the annotation symbol arrangement style is a square.
[0107] In the above detailed description, various features are grouped together in a single embodiment to simplify the disclosure. This method of disclosure should not be interpreted as reflecting an intention that the embodiments of the claimed subject matter require more features than are clearly stated in each claim. On the contrary, as reflected in the appended claims, the invention is in a state of having less than all the features of the disclosed individual embodiments. Therefore, the appended claims are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate preferred embodiment of the invention.
[0108] The disclosed embodiments are described above to enable any person skilled in the art to implement or use the present invention. Various modifications of these embodiments are obvious to those skilled in the art, and the general principles defined herein may also be applied to other embodiments without departing from the spirit and scope of the present disclosure. Therefore, the present disclosure is not limited to the embodiments given herein, but is consistent with the broadest scope of the principles and novel features disclosed in this application.
[0109] The above description includes examples of one or more embodiments. Of course, it is not possible to describe all possible combinations of components or methods for the purpose of describing the above embodiments, but it should be recognized by those skilled in the art that the various embodiments may be further combined and arranged. Therefore, the embodiments described herein are intended to cover all such changes, modifications and variations that fall within the scope of protection of the appended claims. In addition, with respect to the term "comprising" used in the specification or claims, the word is covered in a manner similar to the term "including", just as "including," is explained as a transitional word in the claims. In addition, any term "or" used in the specification of the claims is intended to mean "non-exclusive or".
[0110] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for automatically arranging two-dimensional diagram annotation symbols, characterized in that: The following steps are involved: S100. Obtaining a view to be annotated and an annotated object in the view; S200. Read the size information of the view; the size information specifically includes the length and width; read the center coordinates of the center position of the annotation object; read the starting point coordinates of the annotation lead line starting point (1) of the annotation object; record the number of the annotation lead line starting points (1); S300. Determine the end point coordinates of the arrangement positions of all the end points of the annotation lines (2) according to the manually preset arrangement style of the annotation symbols and the number of the starting points of the annotation lines (1); S400. Connect each of the annotation leader start point (1) and the annotation leader end point (2) one by one to construct line segments, and then determine, according to a manually preset annotation leader determination rule, that each of the annotation leader end points (2) has and only has one annotation leader start point (1) connected to it; S500. Generate a labeling symbol (3) on the view according to the connection result of each of the labeling lead line start points (1) and the labeling lead line end points (2).
2. The method for automatically arranging two-dimensional image annotation symbols according to claim 1, characterized in that: S300 specifically includes the following steps: S310. Obtain the starting point coordinate set of the annotation leader starting point (1), the starting point coordinate set is expressed as follows: Where: P Start is used to represent the starting point coordinate set; n is used to represent the number of the annotation leader starting points (1); Each specific coordinate of the starting point coordinates used to characterize the starting point of the annotation leader line (1); S320. Generate a labeling leader end point trajectory graphic (4) including the labeling object according to the labeling symbol arrangement style and the size information of the view; S330. Draw a plurality of rays from the center coordinate as the starting point to the end point trajectory graph (4) of the annotated leader line; the angle between two adjacent rays is expressed as follows: Wherein: ∠ is used to represent the angle between two adjacent rays; S340. Obtain the first intersection point of the annotation leader endpoint trajectory graph (4) and all the rays, the set of the first intersection points being the endpoint coordinate set of the annotation leader endpoint (2); the endpoint coordinate set is expressed as follows: P end ={P1,P2,...,P n } Where: P end The endpoint coordinate set used to characterize the endpoint of the annotation leader (2); P1, P2, ..., P n Each specific coordinate of the endpoint coordinates used to characterize the endpoint (2) of the annotation leader line.
3. The method for automatically arranging two-dimensional image annotation symbols according to claim 2, characterized in that: S400 specifically includes the following steps: S410. Connect each point in the end point coordinate set with each point in all the start point coordinate sets in pairs, and then construct a first line segment set containing n×n line segments; the first line segment set is expressed as follows: L={L1,L2,...,L n×n } Wherein: L is used to represent the first line segment set; L1, L2, ..., L n×n used to characterize each of the line segments in the first line segment set; S420. Calculate the lengths of all the line segments in the first line segment set; S430. Set a loop variable and initialize the value of the loop variable to 0; construct a second line segment set, where the second line segment set is expressed as follows: L'=L Wherein: L' is used to characterize the second line segment set; S440. Determine whether the loop variable satisfies the loop determination condition, and then perform the following operations according to the determination result: If the judgment result is that the loop variable satisfies the loop judgment condition, executing S450; If the judgment result is that the loop variable does not satisfy the loop determination condition, execute S4100; The cycle determination condition is expressed as follows: i<n Wherein: i is used to characterize the loop variable; S450. Obtain the number of second intersections between each line segment in the second line segment set and other line segments in the second line segment set; S460. Finding a matching line segment with the least number of second intersection points and the shortest length from the second line segment set; S470. Finding a third line segment set consisting of the line segments whose endpoints are the same as the matching line segment from the second line segment set; S480. Delete the third line segment set from the second line segment set, and then set the result after deletion as the second line segment set, which is specifically expressed as follows: L′=L′-L″ Wherein: L″ is used to characterize the third line segment set; S490. The loop variable is incremented by 1, and then S440 is executed; S4100. The line segments that are not deleted in the second line segment set are the lines between the start point (1) of the annotation leader line and the end point (2) of the annotation leader line, and then the calculation ends.
4. The method for automatically arranging two-dimensional image annotation symbols according to claim 3, characterized in that: The annotation leader end point trajectory graphic (4) corresponding to the annotation symbol arrangement style is a circle.
5. The method for automatically arranging two-dimensional image annotation symbols according to claim 3, characterized in that: The annotation leader end point trajectory graphic (4) corresponding to the annotation symbol arrangement style is an ellipse.
6. The method for automatically arranging two-dimensional image annotation symbols according to claim 3, characterized in that: The annotation leader end point trajectory graphic (4) corresponding to the annotation symbol arrangement style is a square.
Citation Information
Cited By
Generation method of distribution box label and related device thereof
CN120470730A
Two-dimensional graph exporting and labeling arrangement method and computer readable storage medium
CN120705933A
