Drawing component automatic labeling method, device and equipment and storage medium

By dynamically partitioning the leader point set of CAD drawings into multiple subsets using the K-Means algorithm, an optimized annotation point set is generated, which solves the problems of leader line intersection and text overlap in CAD drawings, and improves the aesthetics and readability of the drawings.

CN115249363BActive Publication Date: 2025-11-28PINLAN (HANGZHOU) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210875745.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-22
Publication Date
2025-11-28
Estimated Expiration
2042-07-22

AI Technical Summary

Technical Problem

In complex CAD drawings, annotation information may cause problems such as intersecting leader lines, overlapping text, and misaligned layout, making the drawings unreadable. Furthermore, traditional boundary arrangement methods may result in excessively long leader lines, affecting aesthetics.

Method used

The K-Means algorithm is used to dynamically divide the point set into multiple subsets, and boundary and candidate point sets are generated based on the subsets. The KM algorithm is used to optimize the labeled point set to generate beautiful and easy-to-read labels.

Benefits of technology

It effectively solves the problems of leader line intersection, text overlap and misalignment in CAD drawings, improves the aesthetics and readability of drawings, and avoids excessively long leader lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115249363B_ABST
    Figure CN115249363B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of architectural design construction, and discloses a drawing component automatic marking method, device, equipment and storage medium, the method comprises the following steps: dynamically dividing an initial set of guide points into multiple subsets by using K-Means; generating boundaries corresponding to the multiple subsets based on the multiple subsets; generating candidate points on the boundaries corresponding to the multiple subsets to obtain a candidate point set; generating a marking point set based on the candidate point set; and marking the components by using a K-M algorithm based on the marking point set and the multiple subsets. The method improves the readability and aesthetic appearance of CAD drawings.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of architectural design construction, and particularly relates to a drawing component automatic marking method, device and equipment and a storage medium. BACKGROUND

[0002] CAD construction drawing is a drawing made by AutoCAD software to represent the overall layout of a project, the external shape of a building, internal arrangement, structural construction, internal and external decoration, material method, equipment and construction, etc. In the electrical construction drawing of a building, the plan is usually a macro description of the geographical position and main structure of the building, and the wall, door, window, beam and column are faded, while the electrical circuit is highlighted. Other pipelines, such as water heating and gas lines, do not appear on the electrical construction drawing.

[0003] Marking component information on a CAD drawing is an important operation in the CAD drawing process. By marking multiple positions of the component object of the CAD drawing, the readability and interpretability of the CAD drawing are improved. In CAD drawing, designers often need to draw design drawings through various CAD commands. In the common CAD drawing design process, designers need to set the drawing style of layers, marking styles, text styles, line types, colors, units, etc. according to the corresponding specifications, industry standards, drawing standards and enterprise technical standards. Designers draw drawings by combining their own ideas, designs and parameters such as point, straight line, circle and curve commands. In this way, the process of drawing by designers is very tedious, the workload is large, the time for drawing is long, and the drawing is controlled by humans, so errors are likely to occur in the drawing process.

[0004] Currently, there are many drawing generation software, but in complex CAD drawings, there may be a lot of marking information, and various markings may have problems such as crossed lead lines, overlapping text, disordered arrangement, etc., which makes the drawings unreadable. Therefore, how to reasonably arrange the marking position has become a problem that needs to be solved in the CAD drawing generation process.

[0005] The boundary arrangement method is a kind of external labeling method that has been studied sufficiently, and the core idea is to arrange the terminal point of the text lead outside the boundary of a convex polygon (in many cases, a rectangle) containing the labeling object. This text layout is not only neat and beautiful, but also can avoid the intersection problem of the lead and the text. In addition, in the case of s-shaped lead-guided text, the mutual intersection problem of the leads can be assimilated into the intersection problem of the leads and the shortest total bus length (Tufte's minimum ink criterion) problem by exchanging the terminal points of the intersecting leads, because if two leads intersect, by exchanging the terminal points, they can not only be made not to intersect, but also the total length of the leads is shortened, so the shortest lead arrangement must be without the intersection of the leads. Therefore, it is feasible to use the boundary arrangement method to improve the aesthetic and readability of the CAD drawing. However, in this method, the range of the point set required for labeling of the CAD drawing is relatively wide, and if only one subset is divided, the lead of some points will be particularly long, affecting the aesthetic degree of the CAD drawing.

[0006] The above content is only used to assist in understanding the technical solutions of the present application and does not represent the acknowledgement of the above content as prior art. SUMMARY

[0007] The main purpose of the present application is to provide a drawing component automatic labeling method, device, equipment and storage medium, aiming at improving the aesthetic degree of CAD drawing.

[0008] To achieve the above purpose, the present application provides a drawing component automatic labeling method, which comprises the following steps:

[0009] The initial set of lead points is dynamically divided into multiple subsets by using K-Means;

[0010] Based on the multiple subsets, boundaries corresponding to the multiple subsets are generated;

[0011] Candidate points are generated on the boundaries corresponding to the multiple subsets to obtain a candidate point set;

[0012] Based on the candidate point set, a labeling point set is generated;

[0013] Based on the labeling point set and the multiple subsets, the components are labeled by using K-M algorithm.

[0014] Optionally, the initial set of lead points is dynamically divided into multiple subsets by using K-Means, which comprises:

[0015] It is judged whether the initial set of lead points meets the division threshold;

[0016] If yes, the initial set of lead points is divided into a plurality of subsets according to a cluster center point distance threshold by using the K-Means, and then the step of judging whether the initial set of lead points meets a division threshold is performed.

[0017] If no, the step of generating boundaries corresponding to the plurality of subsets based on the plurality of subsets is performed.

[0018] Optionally, the boundaries corresponding to the plurality of subsets are vertical boundaries.

[0019] Optionally, the generating a set of labeled points based on the set of candidate points comprises:

[0020] judging whether the candidate point in the set of candidate points is on the outermost boundary;

[0021] If yes, a labeled point is selected based on a weighted distance;

[0022] If no, a labeled point is selected based on a minimum distance;

[0023] generating the set of labeled points based on the labeled point.

[0024] In addition, to achieve the above object, the application further provides a device for automatically labeling a drawing component, which comprises:

[0025] a subset division module configured to divide an initial set of lead points into a plurality of subsets by using K-Means;

[0026] a boundary generation module configured to generate boundaries corresponding to the plurality of subsets based on the plurality of subsets;

[0027] a candidate point set generation module configured to generate candidate points on the boundaries corresponding to the plurality of subsets to obtain a set of candidate points;

[0028] a labeled point set generation module configured to generate a set of labeled points based on the set of candidate points;

[0029] a labeling module configured to label the component by using K-M algorithm based on the set of labeled points and the plurality of subsets.

[0030] Optionally, the subset division module comprises:

[0031] a first judging module configured to judge whether the initial set of lead points meets a division threshold;

[0032] a division unit configured to, when the output result of the first judging module is yes, divide the initial set of lead points into a plurality of subsets according to a cluster center point distance threshold by using the K-Means, and then perform the step of judging whether the initial set of lead points meets a division threshold;

[0033] The first execution unit is configured to execute the subset division module when the first judging module outputs a result of no.

[0034] Optionally, the boundaries corresponding to the multiple subsets are vertical boundaries.

[0035] Optionally, the marking point set generation module comprises:

[0036] The second judging unit is configured to judge whether the candidate point in the candidate point set is on the outermost boundary.

[0037] The marking point selection unit is configured to select a marking point based on a weighted distance when the second judging unit outputs a result of yes.

[0038] And select a marking point based on a minimum distance when the second judging unit outputs a result of no.

[0039] The marking point set generation unit is configured to generate the marking point set based on the marking point.

[0040] In addition, to achieve the above object, the present application further provides a drawing component automatic marking device, which comprises a memory, a processor and a drawing component automatic marking program stored in the memory and capable of running on the processor, and the drawing component automatic marking program is configured to implement the method as described above.

[0041] In addition, to achieve the above object, the present application further provides a storage medium, which stores a drawing component automatic marking program, and the drawing component automatic marking program implements the method as described above when executed by a processor.

[0042] The drawing component automatic marking method, device, equipment and storage medium provided by the present application can dynamically divide the lead point set into multiple subsets according to a cluster center point distance threshold by using K-Means, so as to optimize the lead length and avoid the situation that the lead of some points is particularly long if only one subset is divided. BRIEF DESCRIPTION OF DRAWINGS

[0043] Figure 1 FIG. 1 is a structural schematic diagram of a drawing component automatic marking device according to an embodiment of the present application;

[0044] Figure 2 FIG. 4 is a flowchart of a drawing component automatic marking method according to an embodiment of the present application;

[0045] Figure 3 FIG. 5 is a whole flowchart of a drawing component automatic marking method according to an embodiment of the present application;

[0046] Figure 4It is a structural schematic diagram of the automatic drawing component labeling device.

[0047] The implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION

[0048] It should be understood that the specific embodiments described herein are intended to be illustrative only and not limiting of the present application.

[0049] Reference Figure 1 , Figure 1 It is a structural schematic diagram of the automatic drawing component labeling device of the hardware running environment involved in the embodiment of the present application.

[0050] As Figure 1 shown, the automatic drawing component labeling device can include a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 can include a display screen, an input unit such as a keyboard, and can also include a standard wired interface, a wireless interface. The network interface 1004 can optionally include a standard wired interface, a wireless interface (such as a wireless fidelity (Wi-Fi) interface). The memory 1005 can be a high-speed random access memory (RAM) memory, or a stable non-volatile memory (NVM), such as a magnetic disk memory. The memory 1005 can also be a storage device independent of the aforementioned processor 1001.

[0051] Those skilled in the art can understand Figure 1 that the structure shown in the figure does not constitute a limitation on the automatic drawing component labeling device, and can include more or fewer components than the figure, or combine certain components, or different component arrangements.

[0052] As Figure 1 shown, the memory 1005 as a storage medium can include an operating system, a network communication module, a user interface module, and an automatic drawing component labeling program.

[0053] In Figure 1The network interface 1004 is mainly used for data communication with the data multi-terminal synchronous processing device; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the drawing component automatic labeling device can be arranged in the drawing component automatic labeling device, the drawing component automatic labeling device calls the drawing component automatic labeling program stored in the memory 1005 through the processor 1001, and executes the drawing component automatic labeling method provided in the embodiment of the application.

[0054] Based on the above hardware structure, the drawing component automatic labeling method embodiment of the application is proposed.

[0055] Reference Figure 2 , Figure 2 The flowchart of the drawing component automatic labeling method, the drawing component automatic labeling method comprises the following steps:

[0056] S10, the initial set of lead points is dynamically divided into a plurality of subsets by K-Means;

[0057] S20, a plurality of boundaries corresponding to a plurality of subsets are generated based on the plurality of subsets;

[0058] S30, candidate points are generated on the boundaries corresponding to the plurality of subsets, and a candidate point set is obtained;

[0059] S40, a labeling point set is generated based on the candidate point set;

[0060] S50, based on the labeling point set and the plurality of subsets, K-M algorithm is used to label the components.

[0061] It should be noted that, in this embodiment, the initial set of lead points is dynamically divided into a plurality of subsets by K-Means according to the cluster center point distance threshold, so as to optimize the lead length and avoid the situation that if only one subset is divided, the lead of some points is particularly long.

[0062] In an embodiment, as shown in the drawing, Figure 3 The step S10 comprises the following steps:

[0063] It is judged whether the initial set of lead points meets the division threshold;

[0064] If yes, the initial set of lead points is divided into a plurality of subsets by K-Means according to the cluster center point distance threshold, and then the step of judging whether the initial set of lead points meets the division threshold is executed;

[0065] If no, the step of generating a plurality of boundaries corresponding to a plurality of subsets based on the plurality of subsets is executed.

[0066] It should be noted that the division threshold will be different in different use scenarios, and the threshold range should be considered according to the corresponding business.

[0067] It should be noted that the center point distance threshold is determined according to business significance and experience. If you want the subset to be as concentrated as possible, the threshold can be set a little smaller. Generally, an experienced value of 40 unit annotation width can be considered when the two average annotation text lengths in the horizontal or vertical direction do not conflict.

[0068] In an embodiment, the boundaries corresponding to the plurality of subsets are vertical boundaries.

[0069] It should be noted that this embodiment only uses vertical boundaries, simplifies the annotation point judgment, increases the vertical alignment, and improves the aesthetic appearance.

[0070] In an embodiment, the step S40 comprises the following steps:

[0071] determining whether the candidate point in the candidate point set is on the outermost boundary;

[0072] If yes, the annotation point is selected based on the weighted distance;

[0073] If no, the annotation point is selected based on the minimum distance;

[0074] Based on the annotation point, the annotation point set is generated.

[0075] It should be noted that the global outermost boundary weighting is adopted in this embodiment to reduce the internal boundary congestion conflict.

[0076] This embodiment can effectively solve the problems of cross lead, text overlap, and uneven arrangement in CAD drawing component annotation, and can also solve the problem of too long lead caused by traditional boundary arrangement method, thereby further improving the readability and aesthetic appearance of CAD drawings.

[0077] In addition, with reference to Figure 4 , the embodiment of the present application also provides a drawing component automatic annotation device, which comprises:

[0078] The subset division module 10 is used to dynamically divide the lead point initial set into a plurality of subsets by K-Means;

[0079] The boundary generation module 20 is used to generate boundaries corresponding to the plurality of subsets based on the plurality of subsets;

[0080] The candidate point set generation module 30 is used to generate candidate points on the boundaries corresponding to the plurality of subsets to obtain a candidate point set.

[0081] The labeling point set generation module 40 is configured to generate a labeling point set based on the candidate point set.

[0082] The labeling module 50 is configured to use a K-M algorithm to label the component based on the labeling point set and the plurality of subsets.

[0083] It should be noted that in the embodiment, the K-Means is used to dynamically divide the lead point set into a plurality of subsets according to a cluster center point distance threshold, so as to optimize the lead length and avoid the situation that the lead of some points is particularly long if only one subset is divided.

[0084] In an embodiment, the subset division module 10 comprises:

[0085] The first judgment module is configured to judge whether the lead point initial set meets a division threshold.

[0086] The division unit is configured to, when the output result of the first judgment module is yes, divide the lead point initial set into a plurality of subsets according to the cluster center point distance threshold by using the K-Means, and then execute the step of judging whether the lead point initial set meets the division threshold.

[0087] The first execution unit is configured to, when the output result of the first judgment module is no, execute the step of the subset division module.

[0088] In an embodiment, the boundaries corresponding to the plurality of subsets are vertical boundaries.

[0089] It should be noted that in the embodiment, only the vertical boundary is used, so that the labeling point judgment is simplified, the vertical neatness is increased, and the aesthetic degree is improved.

[0090] In an embodiment, the labeling point set generation module 40 comprises:

[0091] The second judgment unit is configured to judge whether the candidate point in the candidate point set is on the outermost boundary.

[0092] The labeling point selection unit is configured to, when the output result of the second judgment unit is yes, select a labeling point based on a weighted distance.

[0093] And configured to, when the output result of the second judgment unit is no, select a labeling point based on a minimum distance.

[0094] The labeling point set generation unit is configured to generate the labeling point set based on the labeling point.

[0095] It should be noted that in the embodiment, the global outermost boundary weighting is used to reduce the internal boundary congestion conflict situation.

[0096] In addition, the embodiment of the present application also provides a storage medium, wherein the storage medium stores a drawing component automatic labeling program, and the drawing component automatic labeling program realizes the steps of the drawing component automatic labeling method when executed by a processor.

[0097] Since the storage medium adopts all the technical solutions of the above-mentioned embodiments, it has all the beneficial effects brought by the technical solutions of the above-mentioned embodiments, which will not be repeated here.

[0098] In addition, it should be noted that in this paper, the term "comprise", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or system including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or system. Without more limitations, the element defined by the sentence "comprises a" does not exclude the presence of other identical elements in the process, method, article or system including the element.

[0099] The above-mentioned embodiment numbers of the present application are only for description, not representing the advantages and disadvantages of the embodiments.

[0100] Through the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be realized by means of software and necessary general hardware platform, of course, also can be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application or the part of the prior art can be embodied in the form of software product, which is stored in a storage medium (such as read only memory (Read Only Memory, ROM) / RAM, magnetic disc, optical disc), including a plurality of instructions to make a terminal device (which can be a mobile phone, computer, node packaging device, or network device, etc.) execute the method described in each embodiment of the present application.

[0101] The above is only the preferred embodiment of the present application, and does not limit the patent scope of the present application, and any equivalent structure or equivalent process transformation, or direct or indirect application in other related technical fields, is also included in the patent protection scope of the present application.

Claims

1. A method for automatically annotating components on drawings, characterized in that, The method includes the following steps: The initial set of leading points is dynamically divided into multiple subsets using K-Means, including determining whether the initial set of leading points meets the partitioning threshold; if so, the initial set of leading points is divided into multiple subsets using K-Means based on the cluster center point distance threshold, and then the step of determining whether the initial set of leading points meets the partitioning threshold is executed; if not, the step of generating boundaries corresponding to the multiple subsets is executed. Generate boundaries corresponding to the multiple subsets; Candidate points are generated on the boundaries corresponding to multiple subsets to obtain a candidate point set; Based on the candidate point set, a set of labeled points is generated, including determining whether the candidate points in the candidate point set are on the outermost boundary; if so, a labeled point is selected based on a weighted distance; if not, a labeled point is selected based on a minimum distance; and the set of labeled points is generated based on the labeled points. Based on the set of labeled points and multiple subsets, the KM algorithm is used to label the components.

2. The automatic annotation method for drawing components as described in claim 1, characterized in that, The boundaries corresponding to multiple subsets are vertical boundaries.

3. An automatic annotation device for drawing components, characterized in that, The device includes: The subset partitioning module is used to dynamically divide the initial set of endpoints into multiple subsets using K-Means; A boundary generation module is used to generate boundaries corresponding to the multiple subsets based on the multiple subsets; The candidate point set generation module is used to generate candidate points on the boundaries corresponding to multiple subsets to obtain a candidate point set; The annotation point set generation module is used to generate an annotation point set based on the candidate point set; The annotation module is used to annotate components based on the set of annotation points and multiple subsets, using the KM algorithm. The subset partitioning module includes: The first judgment module is used to determine whether the initial set of the leading points satisfies the partitioning threshold. The partitioning unit is used to divide the initial set of leading points into multiple subsets according to the cluster center point distance threshold using the K-Means when the output result of the first judgment module is yes, and then execute the step of judging whether the initial set of leading points meets the partitioning threshold. The first execution unit is configured to execute the step of generating a boundary corresponding to the multiple subsets based on the multiple subsets when the output result of the first judgment module is negative; The annotation point set generation module includes: The second judgment unit is used to determine whether the candidate point in the candidate point set is on the outermost boundary; The annotation point selection unit is used to select annotation points based on weighted distance when the output result of the second judgment unit is yes. And for selecting a marker point based on the minimum distance when the output result of the second judgment unit is negative; The annotation point set generation unit is used to generate the annotation point set based on the annotation points.

4. The automatic annotation device for drawing components as described in claim 3, characterized in that, The boundaries corresponding to multiple subsets are vertical boundaries.

5. An automatic annotation device for drawing components, characterized in that, The automatic annotation device for drawing components includes: a memory, a processor, and an automatic annotation program for drawing components stored in the memory and executable on the processor, wherein the automatic annotation program for drawing components is configured to implement the method as described in any one of claims 1 to 2.

6. A storage medium, characterized in that, The storage medium stores an automatic annotation program for drawing components, which, when executed by a processor, implements the method as described in any one of claims 1 to 2.

Citation Information

Patent Citations

  • A floor defect image automatic detection method based on morphological characteristics

    CN109685788A

  • Insertion of Annotation Labels in a CAD Drawing

    US20200097617A1