Component labeling method and device, computer equipment, storage medium and program product
Through the component labeling method, the component subsets are split using area selection and connection relationships, and the labels are automatically generated by combining attribute parameter grouping, which solves the problem of low efficiency of traditional manual labeling and realizes efficient and accurate component labeling.
Patent Information
- Application Number
- CN202510895482.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-10-17
AI Technical Summary
In the existing technology, component annotation relies on manual operation, which is inefficient and prone to errors. It cannot automatically avoid information occlusion, and re-operation is required when the design changes, which is time-consuming and labor-intensive.
Determine component sets through area selection, split component subsets based on connection relationships, and group them according to attribute parameters. Automatically generate annotations and intelligently adjust positions to avoid information obstruction.
It improves annotation efficiency, reduces manual operation time, ensures annotation accuracy, avoids errors and omissions, and adapts to complex component layouts.
Smart Images

Figure CN120808382A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image annotation, and in particular to a component annotation method and device, computer equipment, storage medium and program product. BACKGROUND
[0002] In the field of building structure design and construction, component annotation is a key link to generate clear and standard construction drawings, which requires accurate expression of the geometric dimensions and material specifications of components. However, most current design software and workflows still rely on manual operation by designers. In the component annotation process, designers need to select components one by one and adjust the annotation position to meet the drawing specification. This not only wastes a lot of human resources and reduces design efficiency, but also may lead to inconsistent annotation results. SUMMARY
[0003] Therefore, the present application provides a component annotation method, device, computer equipment, storage medium and program product to solve the problems of low efficiency and unstable quality caused by manual operation.
[0004] In a first aspect, the present application provides a component annotation method, comprising: obtaining a target building drawing to be annotated, the target building drawing comprising a plurality of components; in response to a region marquee operation on the target building drawing, determining a target marquee region and a set of components to be annotated in the target marquee region; based on the connection relationship between each first target component in the set of components to be annotated, splitting the set of components to be annotated to obtain a plurality of component subsets; for any component subset, based on the first component attribute parameters corresponding to each second target component in the component subset, splitting the component subset to obtain a plurality of component groups; for any component group, annotating each third target component in the component group according to a preset annotation rule to generate a target annotation result.
[0005] The component annotation method provided by the present application captures the set of components to be annotated by marquee, avoiding the tedious steps of point selection. By pre-splitting the component subsets according to the connection relationship to isolate irrelevant components, and then subdividing the groups according to the attribute parameters to realize the homogenization of the component set and apply the preset annotation rule for batch processing, the efficiency is significantly improved while ensuring the rationality of the annotation layout, and the tediousness of manual annotation adjustment is completely avoided.
[0006] In an optional implementation, the set of components to be labeled is split based on the connection relationship between each first target component in the set of components to be labeled to obtain a plurality of component subsets, including: splitting the set of components to be labeled based on the connection relationship between each first target component to obtain a plurality of component split sets; for any component split set, classifying each fourth target component in the component split set according to the component direction to obtain a horizontal component subset and a vertical component subset; wherein the component subset includes the horizontal component subset and the vertical component subset.
[0007] The component labeling method provided by the embodiment of the application separates the topologically independent component set by the connection relationship, and then classifies the components in the horizontal direction and the vertical direction to form the same-direction component subset, thereby laying a foundation for subsequent unified application of directional labeling rules and avoiding labeling conflicts caused by multi-directional mixing from the source.
[0008] In an optional implementation, the set of components to be labeled is split based on the connection relationship between each first target component in the set of components to be labeled to obtain a plurality of component split sets, including: for any first target component in the set of components to be labeled, traversing all adjacent components connected with the first target component; determining all first adjacent components corresponding to the first target component as a component split set corresponding to the first target component.
[0009] The component labeling method provided by the embodiment of the application accurately aggregates the components topologically associated by traversing the physical joint connection relationship between the components to form the same-group split set, thereby ensuring that the subsequent labeling processing is strictly limited within the same connected system and avoiding labeling misplacement caused by misassociation across systems.
[0010] In an optional implementation, for any component split set, each fourth target component in the component split set is classified according to the component direction to obtain a horizontal component subset and a vertical component subset, including: obtaining the number of joints and the joint direction of each fourth target component; for any fourth target component, when the number of joints of the fourth target component satisfies a first preset rule and / or the joint direction satisfies a second preset rule, the fourth target component is determined as a horizontal component; other fourth target components in the component split set except the horizontal component are determined as vertical components; a horizontal component subset is constructed by using the horizontal components, and a vertical component subset is constructed by using the vertical components.
[0011] The component labeling method provided by the embodiment of the application realizes automatic and accurate classification of the component direction by the preset rule of the number of joints and the direction, forms the horizontal subset and the vertical subset, provides a classification basis for subsequent same-direction labeling rules, and completely avoids subjective errors of manual direction judgment.
[0012] In an optional implementation, when the joint quantity of the fourth target component meets the first preset rule, the fourth target component is determined as a horizontal component, including: obtaining the joint quantity of the fourth target component; and when the joint data is greater than a preset value, the fourth target component is determined as a horizontal component.
[0013] The component labeling method provided in the embodiments of the present application can quickly determine a complex component as a horizontal component by using a preset joint quantity threshold, significantly simplify the direction classification logic, avoid the redundant overhead of the joint-by-joint direction calculation, ensure that the main components are preferentially included in the horizontal group for unified processing, and improve the classification efficiency.
[0014] In an optional implementation, when the joint quantity of the fourth target component meets the first preset rule and the joint direction meets the second preset rule, the fourth target component is determined as a horizontal component, including: obtaining a target included angle between the joint direction of the fourth target component and a horizontal coordinate axis; if the joint quantity is one and the target included angle is within a preset interval, the fourth target component is determined as a horizontal component; and if the joint quantity is two and at least one joint of the fourth target component corresponds to a target included angle within the preset interval, the fourth target component is determined as a horizontal component.
[0015] The component labeling method provided in the embodiments of the present application can ensure the direction determination accuracy of the horizontal component by strictly limiting the included angle interval between the joint direction and the horizontal axis, and realize the strong constraint of the classification logic by combining the joint quantity condition, thereby eliminating the risk of misjudgment from the physical connection essence.
[0016] In an optional implementation, the component subset is split based on the first component attribute parameters corresponding to each second target component in the component subset, to obtain a plurality of component groups, including: each second target component in the component subset is sorted according to the corresponding first component attribute parameter, and a fifth target component located at a target position is determined by using the sorting result; and the second adjacent components corresponding to the fifth target component are traversed from the target position, and if a current traversed second adjacent component is a preset component type, the traversal is ended, and all the current traversed second adjacent components are determined as a component group.
[0017] The component labeling method provided in the embodiments of the present application can position the starting component by attribute parameter sorting, automatically cut off the grouping along the connection path until the preset type component, realize the intelligent cutting of the physically continuous components, and ensure the direction consistency of the components in the same group and the reusability of the labeling rules.
[0018] In an optional implementation, the first component attribute parameter comprises a horizontal position and a vertical position, each second target component in the component subset is sorted according to the corresponding first component attribute parameter, and the fifth target component located at the target position is determined by using the sorting result, comprising: each horizontal component in the component subset is sorted according to the horizontal position, and the target horizontal component located at the minimum horizontal position is determined by using the sorting result; each vertical component in the component subset is sorted according to the vertical position, and the target vertical component located at the minimum vertical position is determined by using the sorting result; wherein the fifth target component comprises the target horizontal component and the target vertical component.
[0019] The component labeling method provided by the embodiment of the application accurately positions the extreme value position component through horizontal coordinate and vertical coordinate sorting, ensures that the grouping starting point is always a physical topology end point, provides a determined starting anchor point for subsequent continuous traversal along the connection path, and guarantees the consistency of the same group component direction and the labeling sequence.
[0020] In an optional implementation, each third target component in the component grouping is labeled according to a preset labeling rule to generate a target labeling result, comprising: obtaining the second component attribute parameter corresponding to each third target component, and determining the labeling feature corresponding to each third target component by using the second component attribute parameter; labeling each third target component in the component grouping according to the labeling feature to generate an initial labeling result; and adjusting the initial labeling result according to a preset adjustment rule to obtain the target labeling result.
[0021] The component labeling method provided by the embodiment of the application dynamically generates adaptive labeling features through component attribute parameters, realizes the physical matching of the initial labeling, and then applies a preset adjustment rule to batch optimize conflicts, thereby forming a labeling layout that takes into account individual characteristics and overall avoidance.
[0022] In an optional implementation, the second component attribute parameter comprises a component type, a component direction, a component joint direction and a component size; the labeling feature comprises a labeling lead-out point, a labeling lead line angle, a labeling segmentation line direction and a labeling lead line length; the labeling feature corresponding to each third target component is determined by using the second component attribute parameter, comprising: the labeling lead-out point corresponding to each third target component is determined by using the component type of each third target component; the labeling lead line angle corresponding to each third target component is determined by using the component direction of each third target component; the labeling segmentation line direction corresponding to each third target component is determined by using the component joint direction of each third target component; and the labeling lead line length corresponding to each third target component is determined by using the component size of each third target component.
[0023] The component labeling method provided by the embodiment of the application realizes the refinement and automation of the generation of labeling features through the strong logical mapping of four types of attribute parameters, i.e., component types, directions, joint directions and sizes, and the physical characteristics of each labeling are strictly matched with the components.
[0024] In an optional embodiment, the initial labeling result is adjusted according to a preset adjustment rule to obtain a target labeling result, including: for a third target component in a horizontal or inclined direction, detecting whether the interval of adjacent labeling split lines corresponding to adjacent third target components is less than a preset interval threshold; if the interval is less than the preset interval threshold, performing mirror processing on the labeling position of the third target component that meets the preset condition to obtain the target labeling result.
[0025] The component labeling method provided by the embodiment of the application realizes the refinement and automation of the generation of labeling features through the strong logical mapping of four types of attribute parameters, i.e., component types, directions, joint directions and sizes, and the physical characteristics of each labeling are strictly matched with the components.
[0026] In an optional embodiment, the initial labeling result is adjusted according to a preset adjustment rule to obtain a target labeling result, including: if the third target component is an elbow, the labeling lead direction of the elbow is adjusted to the opposite direction of the elbow turning angle to obtain the target labeling result.
[0027] In an optional embodiment, it is detected whether the adjusted elbow labeling text represented by the target labeling result conflicts with adjacent pipe labeling; if there is a conflict, the lead length corresponding to the elbow is extended by a preset step length so that the elbow labeling text does not conflict with the adjacent pipe labeling; if the extended lead length exceeds a maximum lead length threshold, a conflict identifier is labeled.
[0028] The component labeling method provided by the embodiment of the application realizes the refinement and automation of the generation of labeling features through the strong logical mapping of four types of attribute parameters, i.e., component types, directions, joint directions and sizes, and the physical characteristics of each labeling are strictly matched with the components.
[0029] In an optional embodiment, the initial labeling result is adjusted according to a preset adjustment rule to obtain a target labeling result, including: if the third target component is a three-way pipe fitting, the labeling lead-out point corresponding to the three-way pipe fitting is set in the opposite direction of the branch pipe, and the labeling split line corresponding to the three-way pipe fitting is adjusted based on the branch pipe angle direction to obtain the target labeling result; if the third target component is a four-way pipe fitting, the labeling lead-out point corresponding to the four-way pipe fitting is set in the direction of the angle bisector of any two adjacent joints, and the labeling lead angle corresponding to the four-way pipe fitting is adjusted based on the angle between the main pipe and the branch pipe to obtain the target labeling result.
[0030] The component labeling method provided by the embodiment of the present application ensures that the labeling positions of the multi-way component meet the physical connection nature by labeling the opposite direction of the anchor branch pipe and the direction of the adjacent joint bisector angle of the four-way labeling, and then dynamically adjusts the angle between the split line and the lead line according to the branch pipe and the main pipe angle, so as to realize the topological adaptability of the complex node labeling.
[0031] In a second aspect, the present application provides a component labeling device, comprising: an acquisition module configured to acquire a target architectural drawing to be labeled, the target architectural drawing comprising a plurality of components; a determination module configured to determine a target frame selection region and a set of components to be labeled in the target frame selection region in response to a region frame selection operation on the target architectural drawing; a first splitting module configured to split the set of components to be labeled based on a connection relationship between each first target component in the set of components to be labeled, to obtain a plurality of component subsets; a second splitting module configured to split any component subset based on first component attribute parameters corresponding to each second target component in the component subset, to obtain a plurality of component groups; and a labeling module configured to label each third target component in any component group according to a preset labeling rule, to generate a target labeling result.
[0032] In a third aspect, the present application provides a computer device, comprising: a memory and a processor, which are communicatively connected with each other, and the memory stores computer instructions; the processor executes the computer instructions, thereby performing the component labeling method of the first aspect or any of the corresponding embodiments thereof.
[0033] In a fourth aspect, the present application provides a computer readable storage medium, which stores computer instructions, and the computer instructions are used to make a computer execute the component labeling method of the first aspect or any of the corresponding embodiments thereof.
[0034] In a fifth aspect, the present application provides a computer program product, which comprises computer instructions, and the computer instructions are used to make a computer execute the component labeling method of the first aspect or any of the corresponding embodiments thereof. BRIEF DESCRIPTION OF DRAWINGS
[0035] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the specific embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.
[0036] Figure 1 is a flowchart of the component labeling method according to the embodiment of the present application;
[0037] Figure 2 is a schematic diagram of a node graph according to an embodiment of the present application;
[0038] Figure 3 is a schematic diagram of another component labeling method according to an embodiment of the present application;
[0039] Figure 4 is a schematic diagram of a component split set corresponding to a node graph according to an embodiment of the present application;
[0040] Figure 5 is a schematic diagram of still another component labeling method according to an embodiment of the present application;
[0041] Figure 6 is a schematic diagram of component grouping according to an embodiment of the present application;
[0042] Figure 7 is a schematic diagram of determining a labeling split line direction according to an embodiment of the present application;
[0043] Figure 8 is a schematic diagram of labeling interval being half of labeling character height in a horizontal direction according to an embodiment of the present application;
[0044] Figure 9 is a schematic diagram of labeling interval being half of labeling character height in a vertical direction according to an embodiment of the present application;
[0045] Figure 10 is a target labeling result of a horizontal direction pipe in a node graph according to an embodiment of the present application;
[0046] Figure 11 is a target labeling result of a vertical direction pipe in a node graph according to an embodiment of the present application;
[0047] Figure 12 is a target labeling result of a cross direction pipe in a node graph according to an embodiment of the present application;
[0048] Figure 13 is a target labeling result of a T direction pipe in a node graph according to an embodiment of the present application;
[0049] Figure 14 is a target labeling result of a T direction pipe in another node graph according to an embodiment of the present application;
[0050] Figure 15 is a target labeling result of a fire hydrant in a node graph according to an embodiment of the present application;
[0051] Figure 16 is a target labeling result of a fire hydrant in another node graph according to an embodiment of the present application;
[0052] Figure 17 is a target annotation result of a fire hydrant in a node graph according to another embodiment of the present application:
[0053] Figure 18 is a target annotation result of a fire hydrant in a node graph according to another embodiment of the present application:
[0054] Figure 19 is a structural block diagram of a component annotation device according to an embodiment of the present application;
[0055] Figure 20 is a hardware structure schematic diagram of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION
[0056] To make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in connection with the drawings in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0057] In the field of architectural design and construction, component annotation of architectural drawings is a key link for conveying design intent and guiding construction. With the complication and diversification of modern architectural structures, the types of components in drawings are increasingly rich, and the spatial positional relationship and functional connection relationship between components are increasingly complex.
[0058] The traditional component annotation method mainly relies on manual operation. The designer needs to identify the components in the drawing one by one and manually annotate the type, specification, size and other information of the components. For large drawings containing a large number of components, this method not only consumes a lot of time and effort, but also is prone to annotation errors or information omissions due to human negligence. In addition, the information occlusion problem cannot be automatically avoided during the annotation process, and the designer needs to repeatedly manually adjust the annotation position, especially in the component dense area, which is tedious and time-consuming. When the drawing design is changed, the traditional annotation method cannot associate and update the relevant annotations, and needs to perform the whole process operation again, further increasing the workload.
[0059] Therefore, the technical solution of the present application determines a set of components to be annotated by region framing, and splits the components into different subsets according to the connection relationship between the components. Then, the components are further grouped according to attribute parameters, and annotations are automatically generated according to preset rules, and the annotation positions are intelligently adjusted to avoid information occlusion. Through automatic splitting and rule-based annotation, the time consumption of manual traversal and adjustment is reduced. At the same time, the hierarchical processing and parameter matching improve the accuracy of the annotation, effectively avoiding errors and omissions caused by human negligence, and significantly improving the annotation efficiency in complex component layout.
[0060] According to an embodiment of the present application, a component labeling method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from here.
[0061] In this embodiment, a component labeling method is provided, which can be used in computer equipment such as notebook computers, desktop computers, etc. Figure 1 The flowchart of the component labeling method according to an embodiment of the present application is shown in FIG. 1, which includes the following steps: Figure 1
[0062] In step S101, a target building drawing to be labeled is obtained, which includes a plurality of components.
[0063] The target building drawing refers to a specific building design drawing that needs to be labeled, for example, a node drawing in the field of water supply design. The node drawing is a design drawing for showing the internal pipe components and connection relationship of the node, as shown in FIG. 2. The plurality of components refers to various building structural parts or components included in the target building drawing, for example, various pipe fittings in the node drawing, including tees, wyes, elbows, valves, etc. Specifically, the building drawing file uploaded by the user can be read through a file import interface, or the existing drawing data can be called from a local database or cloud storage, which is not limited here. For example, the node drawing can be obtained by loading the water supply node drawing file designed by the user, which contains different pipe fittings and their connection relationship. After parsing the file, it is converted into an operable digital drawing. Figure 2
[0064] In step S102, in response to a region marquee operation on the target building drawing, a target marquee region and a set of components to be labeled in the target marquee region are determined.
[0065] The region marquee operation refers to an operation of marqueeing a specific region on the target building drawing by the user through interactive means, which aims to determine the component range that needs to be labeled. The target marquee region refers to a specific drawing region determined by the user through the region marquee operation, which contains the components that need to be labeled. The set of components to be labeled refers to the set of components that need to be labeled determined by the region marquee operation, which contains all the components in the target marquee region. Specifically, the marquee interaction of the user on the drawing interface (such as mouse dragging to form a rectangular frame) is listened to, and the coordinate range of the target marquee region is recorded. All components whose coordinates fall within this range are selected to form an initial set of components to be labeled, i.e., all component objects in the target marquee region.
[0066] Step S103, based on the connection relationship between each first target component in the set of components to be labeled, the set of components to be labeled is split to obtain a plurality of component subsets.
[0067] The first target component refers to a single component in the set of components to be labeled. The component subset refers to a subset obtained by splitting according to the connection relationship between the first target components. Specifically, by judging the connection properties between each first target component, these first target components are split into several subsets with internal connection relationship.
[0068] Step S104, for any component subset, based on the first component attribute parameter corresponding to each second target component in the component subset, the component subset is split to obtain a plurality of component groups.
[0069] The second target component refers to a single component in the component subset, and the first component attribute parameter refers to the key attribute possessed by the second target component, which is used to divide the component groups. The component group refers to a sub-group obtained by further splitting the component subset based on the first component attribute parameter. Specifically, the first component attribute parameter corresponding to each second target component is obtained, and the grouping condition is constructed according to the first component attribute parameter. All components in the component subset are traversed, and they are assigned to the corresponding group according to the grouping condition to obtain a plurality of component groups.
[0070] Step S105, for any component group, each third target component in the component group is labeled according to the preset labeling rule to generate a target labeling result.
[0071] The preset labeling rule refers to a specific rule preset for guiding component labeling. The third target component refers to a single component in the component group. The target labeling result refers to the final result generated after labeling the components in the component group. Specifically, after the component group is determined, each third target component in the component group is labeled according to the preset labeling rule. The preset labeling rule covers the specifications of identification format, position, etc., and the content of labeling is performed according to the attributes of the components and design requirements.
[0072] The component labeling method provided by the embodiment of the application avoids the tedious steps of point selection by frame selection to capture the set of components to be labeled. By pre-splitting the component subset according to the connection relationship, the irrelevant components are isolated, and then the attribute parameters are used for subdivision to realize the homogenization of the component set and apply the preset labeling rule for batch processing, which significantly improves the efficiency while ensuring the rationality of the labeling layout, and completely avoids the tediousness of manual adjustment.
[0073] In this embodiment, a component labeling method is provided, which can be used in computer devices such as notebook computers, desktop computers, etc. Figure 3 is a flowchart of the component labeling method according to the embodiment of the application, asFigure 3 As shown, the flow includes the following steps:
[0074] In step S201, a target architectural drawing to be labeled is acquired, and the target architectural drawing includes a plurality of components. For details, please refer to Figure 1 The step S101 of the embodiment shown will not be repeated here.
[0075] In step S202, in response to a region marquee operation on the target architectural drawing, a target marquee region and a set of components to be labeled in the target marquee region are determined. For details, please refer to Figure 1 The step S102 of the embodiment shown will not be repeated here.
[0076] In step S203, based on the connection relationship between each first target component in the set of components to be labeled, the set of components to be labeled is split to obtain a plurality of component subsets.
[0077] Specifically, the above step S203 includes:
[0078] In step S2031, based on the connection relationship between each first target component, the set of components to be labeled is split to obtain a plurality of component split sets.
[0079] The component split set refers to a split set obtained according to the connection relationship between the first target components. Specifically, according to the connection relationship between each first target component, the adjacent components of any first target component are determined, and the adjacent components are used to generate the component split set.
[0080] In some optional embodiments, the above step S2031 includes:
[0081] In step a1, for any first target component in the set of components to be labeled, all first adjacent components connected to the joints of the first target component are traversed.
[0082] The first adjacent component refers to the component directly connected to the joint of the first target component. Specifically, for any first target component in the set of components to be labeled, all joints (such as 3 joints of a three-way pipe fitting and 2 joints of an elbow in a node graph) are traversed one by one, and the components connected to each joint are obtained through each joint. These connected components are the first adjacent components.
[0083] In step a2, all first adjacent components corresponding to the first target component are determined as the component split set corresponding to the first target component.
[0084] All first adjacent components connected to the joints of the first target component are collected to form a set, and the set is the component split set corresponding to the first target component. For example, as shown in Figure 4As shown, all the node graph pipes in XH-2 and XH-3 are selected, and the result of the splitting is that the XH-2 node graph pipe is a set of component splitting sets, and the XH-3 node graph pipe is a set of component splitting sets. Specifically, take a selected pipe, traverse each joint, and through a recursive search algorithm, obtain all the pipes connected by the joints, that is, the pipes in XH-2, which are divided into group 1. For example, take a pipe A (assuming that it has two joints 1 and joint 2), traverse joint 1, obtain pipe B connected by joint 1, and add pipe B to the stack stack. Obtain joint 1 and joint 2 of pipe B, if B joint 1 is connected to joint 1 in pipe A, continue to traverse B joint 2, obtain pipe C connected by B joint 2, and add pipe C to the stack stack. Continue to obtain joint 1 and joint 2 of pipe C, if C joint 1 is connected to joint 1 in pipe B, continue to traverse C joint 2, if C joint 2 is not connected to a pipe, backtrack to pipe A. Determine whether pipe A is in the stack, if not, add pipe A to the stack, otherwise, do not add to the stack. Continue to traverse joint 2 of pipe A until all paths are traversed, and obtain all pipes in the stack stack, that is, the pipe set (group 1) in the XH-2 node graph. Remove the pipes obtained from group 1 from the original selected pipes to form a new selected pipe set. Recycle the above steps, and the pipe set group 2 (group 3……) in the XH-2 (XH-3……) node graph can be obtained. In this way, the grouping is continued until the number of pipes in the newly formed pipe set is 0, and the result obtained at this time is that each node graph pipe is a group.
[0085] In the above embodiment, by traversing the physical joint connection relationship between components, the same group splitting set is accurately aggregated by aggregating the topologically associated components, and the subsequent labeling processing is strictly limited in the same connected system, so that misassociation caused by cross-system misassociation is avoided.
[0086] In step S2032, for any component splitting set, each fourth target component in the component splitting set is classified according to the component direction to obtain a horizontal component subset and a vertical component subset.
[0087] The component subset includes the horizontal component subset and the vertical component subset.
[0088] The fourth target component refers to a single component in the component splitting set. The horizontal component subset refers to a set composed of horizontal components, and the vertical component subset refers to a set composed of vertical components. Specifically, the component direction of each fourth target component is determined, and each fourth target component in the component splitting set is classified according to the component direction to obtain a horizontal component subset and a vertical component subset.
[0089] In some optional embodiments, the above step S2032 includes:
[0090] Step b1, obtaining the number of joints and the joint direction of each fourth target component.
[0091] The number of joints refers to the number of interfaces on the component for connecting other components. The joint direction refers to the orientation of the component joint in the global coordinate system. Specifically, for each fourth target component in the component decomposition set, the inherent joint number attribute (such as 1, 2, 3, or 4) is directly obtained from its component object data. At the same time, the direction vector of each joint in the global coordinate system (i.e., the direction in which the joint points) is calculated, and the specific joint direction of each joint is determined according to the angle between the direction vector and the positive direction of the X-axis.
[0092] Step b2, for any fourth target component, when the number of joints of the fourth target component meets the first preset rule and / or the joint direction meets the second preset rule, the fourth target component is determined as a horizontal component.
[0093] The first preset rule refers to the judgment rule about the number of joints. The second preset rule refers to the judgment rule about the joint direction. Specifically, for any fourth target component, if the number of joints of the component meets any condition in the first preset rule and / or the joint direction meets the second preset rule, the component is determined as a horizontal component.
[0094] In some optional embodiments, when the number of joints of the fourth target component meets the first preset rule, the fourth target component is determined as a horizontal component, comprising: obtaining the number of joints of the fourth target component; when the joint data is greater than a preset value, the fourth target component is determined as a horizontal component.
[0095] The number of joints is obtained by directly reading the inherent attribute data of the fourth target component. Specifically, each component object has predefined its joint number attribute (such as 1, 2, 3, or 4) in the system, which is determined by the component type (for example, a three-way pipe fitting in a node graph has 3 joints, and a four-way pipe fitting has 4 joints), and this attribute value can be directly called for judgment. When the number of joints is greater than or equal to a preset value (which can be 3, for example), regardless of the joint direction, it is directly determined as a horizontal component. For example, three-way pipe fittings and four-way pipe fittings in a node graph are automatically classified as horizontal pipe fittings.
[0096] In the above embodiments, the complex component is quickly determined as a horizontal component by a preset joint number threshold, which significantly simplifies the direction classification logic, avoids the redundant overhead of joint-by-joint direction calculation, and at the same time ensures that the main component is preferentially included in the horizontal group for unified processing, thereby improving the classification efficiency.
[0097] In some optional embodiments, when the joint number of the fourth target component meets the first preset rule and the joint direction meets the second preset rule, the fourth target component is determined as a horizontal component, including: obtaining a target angle between the joint direction of the fourth target component and a horizontal coordinate axis; if the joint number is one and the target angle is within a preset interval, the fourth target component is determined as a horizontal component; if the joint number is two and at least one joint of the fourth target component corresponds to a target angle within the preset interval, the fourth target component is determined as a horizontal component.
[0098] Based on the global coordinate system, the angle between each joint direction vector and the positive direction of the X axis is calculated. Specifically, the joint direction vector is extracted from the component object data. The angle θ between the vector and the X axis is calculated by the vector angle formula, and this θ value is the target angle, which can be, for example, [-π / 4, π / 4] or [3π / 4, 5π / 4].
[0099] According to whether the target angle θ between the joint direction and the direction of the X axis is within a preset interval (such as [-π / 4, π / 4] or [3π / 4, 5π / 4]), the component joints are counted HorizonCnt. If the joint number is 1 and HorizonCnt is 1, it is a horizontal component; if the joint number is 2 and HorizonCnt is greater than or equal to 1, it is a horizontal component.
[0100] In the above embodiments, by strictly limiting the angle interval between the joint direction and the horizontal axis, the direction determination accuracy of the horizontal component is ensured, and the strong constraint of the classification logic is realized by combining the joint number condition, which physically eliminates the risk of misjudgment.
[0101] Step b3, the components in the component split set are divided into other fourth target components except the horizontal components, which are determined as vertical components.
[0102] After completing the horizontal / non-horizontal judgment of all fourth target components in the component split set, all remaining components that are not determined as horizontal components (i.e., do not meet the horizontal judgment rule) are uniformly determined as vertical components.
[0103] Step b4, using the horizontal components to construct a horizontal component subset, and using the vertical components to construct a vertical component subset.
[0104] After completing the horizontal / vertical classification, all fourth target components determined as horizontal components are collected to form a horizontal component subset. At the same time, all fourth target components determined as vertical components are collected to form another vertical component subset. In this way, the component split set is clearly divided into horizontal and vertical groups.
[0105] In the above embodiment, the preset rules of joint quantity and direction are used to realize automatic and accurate classification of component directions, forming horizontal subsets and vertical subsets, providing a classification basis for subsequent same-direction marking rules, and completely avoiding subjective errors in manual judgment of direction.
[0106] Step S204: For any component subset, the component subset is split based on the first component attribute parameters corresponding to each second target component in the component subset to obtain multiple component groups. Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.
[0107] Step S205: for any component group, mark each third target component in the component group according to the preset marking rules to generate a target marking result. Figure 1 Step S105 of the illustrated embodiment will not be described in detail here.
[0108] The component labeling method provided by the embodiment of the present invention splits and isolates a topologically independent component set through connection relationships, and then reclassifies it according to the horizontal and vertical directions to form a subset of components in the same direction. This lays the foundation for the subsequent unified application of directional labeling rules and avoids labeling conflicts caused by multi-directional mixing from the source.
[0109] In this embodiment, a component marking method is provided, which can be used for computer equipment, such as laptop computers, desktop computers, etc. Figure 5 : is a flow chart of a component marking method according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:
[0110] Step S301: Obtain the target building drawing to be annotated, which includes multiple components. Figure 3 Step S201 of the illustrated embodiment will not be described in detail here.
[0111] Step S302: In response to the region selection operation on the target architectural drawing, the target selection region and the set of components to be annotated within the target selection region are determined. Figure 3 Step S202 of the illustrated embodiment will not be described in detail here.
[0112] Step S303: Based on the connection relationship between each first target component in the component set to be annotated, the component set to be annotated is split to obtain multiple component subsets. Figure 3 Step S203 of the illustrated embodiment will not be described in detail here.
[0113] Step S304 : for any component subset, the component subset is split based on the first component attribute parameters corresponding to each second target component in the component subset to obtain a plurality of component groups.
[0114] Specifically, the step S304 includes:
[0115] In step S3041, for any component subset, each second target component in the component subset is sorted according to the corresponding first component attribute parameter, and the fifth target component located at the target position is determined by using the sorting result.
[0116] The sorting result refers to the sequence set after sorting the components in the component subset. The target position is used to locate the starting component of traversal. The fifth target component is the starting point of traversing adjacent components. Specifically, within a component subset that has been divided, each second target component is sorted according to a specific attribute (i.e., the first component attribute parameter). After sorting, the component at the end of the sorting sequence is selected as the starting point or key point, i.e., the fifth target component.
[0117] In some optional embodiments, the first component attribute parameter includes a horizontal position and a vertical position, and the step S3041 includes:
[0118] In step c1, each horizontal component in the component subset is sorted according to the horizontal position, and the target horizontal component located at the minimum horizontal position is determined by using the sorting result.
[0119] The horizontal components in the component subset are arranged in ascending order according to the horizontal position (i.e., the X coordinate), and the horizontal component located at the leftmost side (the minimum value of the X coordinate) after sorting is the target horizontal component.
[0120] In step c2, each vertical component in the component subset is sorted according to the vertical position, and the target vertical component located at the minimum vertical position is determined by using the sorting result.
[0121] The fifth target component includes the target horizontal component and the target vertical component.
[0122] The vertical components in the component subset are arranged in ascending order according to the vertical position (i.e., the Y coordinate), and the vertical component located at the lowermost side (the minimum value of the Y coordinate) after sorting is the target vertical component.
[0123] In step S3042, the second adjacent components corresponding to the fifth target component are traversed from the target position, and if it is identified that the second adjacent component currently traversed is of a preset component type, the traversal is ended, and all the second adjacent components currently traversed are determined as a component group.
[0124] The second adjacent component refers to the adjacent component connected with the fifth target component through a joint. The preset component type refers to a component that needs special marking processing, such as an elbow, a tee, a cross, and the like in a node diagram. Specifically, starting from the joint of the fifth target component, the second adjacent component (i.e., the component directly connected through the joint) connected therewith is recursively traversed. During the traversal process, if a preset component type is encountered, the traversal is stopped, and all adjacent components traversed are collected as a component group. For example, as shown in FIG. 8, the subdivided component groups 1 to 8 are obtained. Figure 6
[0125] The component marking method provided by the embodiment of the present application positions a starting component through attribute parameter sorting, traverses along a connection path until a preset type component is automatically truncated for grouping, realizes intelligent cutting of physically continuous components, and ensures direction consistency of components in the same group and reusability of marking rules.
[0126] In step S305, for any component group, each third target component in the component group is marked according to a preset marking rule, and a target marking result is generated.
[0127] Specifically, the above step S305 includes:
[0128] In step S3051, the second component attribute parameter corresponding to each third target component is obtained, and a marking feature corresponding to each third target component is determined by using the second component attribute parameter.
[0129] The second component attribute parameter refers to a key attribute possessed by each third target component. The marking feature refers to a marking element generated according to the second component attribute parameter. Specifically, specific attributes (i.e., the second component attribute parameter) of each third target component are collected and analyzed. By using these attribute information, the marking feature required for marking each specific component is calculated according to a predefined marking rule, that is, the marking feature.
[0130] In some optional embodiments, the second component attribute parameter includes a component type, a component direction, a component joint direction, and a component size; the marking feature includes a marking lead-in point, a marking lead line angle, a marking segmentation line direction, and a marking lead line length; and the above step S3051 includes:
[0131] In step d1, the second component attribute parameter corresponding to each third target component is obtained. For details, refer to step S3051, which is not described here again.
[0132] In step d2, the marking lead-in point corresponding to each third target component is determined by using the component type of each third target component.
[0133] The annotation lead-out point refers to the annotation starting position calculated according to the component type. Specifically, the lead-out point is set according to different characteristics of the component type. For example, the annotation lead-out point of the tee fitting in the node graph is the opposite direction of the branch pipe, the lead-out point of the four-way fitting is the bisector direction of the included angle between the adjacent main pipe and branch pipe, and the lead-out point of the elbow is the opposite direction of the turning angle.
[0134] In step d3, the annotation lead line angle corresponding to each third target component is determined by using the component direction of each third target component.
[0135] The annotation lead line angle refers to the included angle between the lead line and the coordinate axis. Specifically, if the component is in the horizontal direction (with an error of ±10° from the X axis), the component and the lead line form an included angle of 60°; if it is in the vertical direction (with an error of ±10° from the Y axis), the component and the lead line form an included angle of 45°; if it is in the inclined direction (not satisfying the horizontal / vertical condition), the component and the lead line form an included angle of 90°.
[0136] In step d4, the annotation split line direction corresponding to each third target component is determined by using the component joint direction of each third target component.
[0137] The annotation split line direction refers to the split line direction determined by the component joint direction (such as up, down, left, and right), which is used to distinguish the position of the annotation text. Specifically, the direction of the annotation split line (up, down, left, and right) is determined according to the direction vector of the component joint in the global coordinate system. For example, as shown in FIG. 6, the joint 2 direction Vec2 of the tee fitting in the node graph is to the left, and the annotation split line direction corresponding thereto is to the left. Figure 7
[0138] In step d5, the annotation lead line length corresponding to each third target component is determined by using the component size of each third target component.
[0139] The annotation lead line length refers to the lead line length automatically calculated according to the component outer package size. Specifically, the annotation lead line length corresponding to each third target component is calculated according to the outer package size of the third target component. For example, for the pipe fittings of the two joints in the node graph, the lead line length can be 3 times the outer package height (the outer package height is the default value of 1, and the width is calculated by the joint position). The initial lead line length of special pipe fittings such as elbows, tees, and four-way fittings in the node graph can be 2 times the outer package height.
[0140] In the above embodiment, through the strong logical mapping of four types of attribute parameters (component type, direction, joint direction, and size) and annotation features, the refinement and automation of annotation feature generation are realized, and it is ensured that each annotation strictly matches the physical characteristics of the component.
[0141] In step S3052, each third target component in the component grouping is annotated according to the annotation features, and an initial annotation result is generated.
[0142] The initial labeling result refers to a preliminary result generated by labeling the components grouped according to the labeling features. Specifically, according to the labeling lead-in point, lead line angle, segmentation line direction and lead line length of each third target component, a labeling entity is generated in the drawing. Starting from the lead-in point, the lead line is drawn according to the lead line angle, and the labeling text is added along the segmentation line direction to generate the initial labeling result.
[0143] In step S3053, the initial labeling result is adjusted according to a preset adjustment rule to obtain a target labeling result.
[0144] The preset adjustment rule refers to a preset rule for optimizing the initial labeling result. Specifically, before adjusting the initial labeling result according to the preset adjustment rule, it is checked whether the horizontal and inclined direction labeling spacing is not less than half of the labeling text height, as shown in FIG. 6. Figure 8 It is also required that the vertical direction up and down labeling text spacing meet the same requirement, as shown in FIG. 7. Figure 9 If there is insufficient spacing or overlapping labeling, the initial labeling result is adjusted according to the preset adjustment rule to obtain a target labeling result, as shown in FIG. 8. Figure 10 to Figure 18
[0145] The component labeling method provided by the embodiment of the application generates adaptive labeling features dynamically through component attribute parameters, realizes the physical matching of the initial labeling, and then applies the preset adjustment rule to batch optimize conflicts to form a labeling layout that takes into account individual characteristics and overall avoidance.
[0146] In some optional embodiments, the above step S3053 includes:
[0147] In step e1, for the third target component in the horizontal or inclined direction, it is detected whether the spacing of the adjacent labeling segmentation lines corresponding to the adjacent third target components is less than a preset spacing threshold.
[0148] The vertical distance (Y direction difference) between the labeling segmentation lines of the two adjacent third target components in the same component group after sorting according to the X coordinate (horizontal direction) or a specific direction is calculated. This distance is compared with a preset spacing threshold (for example, it can be set to half of the labeling text height). If the calculated actual vertical spacing is greater than or equal to the threshold, the labeling is directly performed; if the spacing of the adjacent labeling segmentation lines is less than the threshold, it is determined that the spacing is insufficient and subsequent adjustment is required.
[0149] In step e2, if the spacing is less than the preset spacing threshold, the labeling position of the third target component satisfying the preset condition is mirror processed to obtain a target labeling result.
[0150] When the insufficient spacing is detected, mirror the labeling entities that meet the preset condition (such as the components in even order) in the direction of the component grouping. Specifically, the labels (including the lead-in points, the lead lines, and the labeling texts) of these components are symmetrically flipped to the other side of the components (for example, the original labels above the components are mirrored to the below, and the original labels below the components are mirrored to the above). In this way, the adjacent labels that may overlap above (or below) are staggered and distributed to the upper and lower sides of the components.
[0151] In the above embodiments, by dynamically detecting whether the spacing between adjacent labeling split lines is less than a preset threshold, the mirror processing is triggered, the labeling position is adaptively shunted, and the risk of labeling overlap in dense areas is completely avoided.
[0152] In some optional embodiments, the above step S3053 further includes:
[0153] Step f1, if the third target component is an elbow, the direction of the labeling lead line of the elbow is adjusted to the opposite direction of the elbow turning angle, to obtain a target labeling result.
[0154] When the third target component is an elbow pipe in the node graph, first determine the turning angle formed by the two joints. The direction of the labeling lead line is set to the opposite direction of the bisector of the turning angle (i.e., the direction away from the center of the elbow turning). This setting is to make the labeling lead line lead out from the most “open” area of the elbow, and to minimize the possibility of the lead line intersecting with other pipe components or labels.
[0155] Step f2, detecting whether the adjusted elbow labeling text represented by the target labeling result conflicts with the adjacent pipe component labeling.
[0156] After setting the direction of the lead line of the elbow, a virtual selection set (or a collision detection box) is created. The range of this box is the outer rectangle of the elbow labeling text, and the width and height of the box are each extended by half the height of the labeling text. Check whether the extended virtual box overlaps or intersects with the outer rectangle of other existing pipe component labels (texts or lead lines) on the drawing. If there is overlap or intersection, it is determined that there is a conflict.
[0157] Step f3, if there is a conflict, the length of the lead line corresponding to the elbow is extended by a preset step length, so that the elbow labeling text does not conflict with the adjacent pipe component labeling.
[0158] If a conflict is detected, the length of the lead line of the elbow labeling is gradually increased. The step length of each increase can be half the height of the labeling text. Each time the length of the lead line is increased, the position of the labeling text moves outward along with the end of the lead line, and at this time, the conflict detection is re-performed (i.e., the extended virtual box is recalculated and checked for intersection with other labels). This process is repeated until the extended virtual box no longer conflicts with other labels.
[0159] Step f4, if the length of the extended leader exceeds the maximum leader length threshold, a conflict identifier is marked.
[0160] If the length of the leader reaches a preset maximum upper limit (for example, 8 times the height of the labeled text) during the process of extending the leader, but the conflict still exists (that is, the virtual box still intersects with other labels), the extension of the leader is stopped. At this time, the current (even with conflicts) labeling position is directly adopted, but the text color of the elbow label is set to red (or other obvious identifier). This red identifier is the "conflict identifier", which explicitly informs the user that the label at this position may still overlap with other labels although it has been avoided as much as possible, and the user needs to pay attention or manually intervene.
[0161] In the above embodiment, by setting the elbow label leader direction to be opposite to the turning angle, and dynamically detecting conflicts and gradually extending the leader, the self-adaptive avoidance of the elbow label is realized. When the extension exceeds the threshold, a conflict identifier is used for early warning, which balances the automation processing and manual intervention.
[0162] In some optional embodiments, the above step S3053 further includes:
[0163] Step g1, if the third target component is a tee pipe, the label exit point corresponding to the tee pipe is set in the opposite direction of the branch pipe, and the label split line corresponding to the tee pipe is adjusted based on the branch pipe angle direction to obtain the target labeling result.
[0164] For a tee pipe (one main pipe inlet, one main pipe outlet, and one branch pipe outlet) in the node graph, the label exit point is positioned in the opposite direction of the branch pipe joint direction (i.e., the direction away from the branch pipe extension). The direction of the label split line is determined according to the angle direction formed by the branch pipe joint and the main pipe joint, which can be set to be parallel or perpendicular to the angle direction to ensure that the label text is arranged neatly and coordinated with the pipe layout. This setting can clearly distinguish the tee label from the main pipe label, reduce confusion, and obtain the final avoidance label.
[0165] Step g2, if the third target component is a four-way pipe, the label exit point corresponding to the four-way pipe is set in the direction of the angle bisector of any two adjacent joints, and the label leader angle corresponding to the four-way pipe is adjusted based on the angle between the main pipe and the branch pipe to obtain the target labeling result.
[0166] For the four-way pipe fitting (four joints, cross intersection) in the node graph, select any two adjacent joints, calculate the bisector direction between the included angle of their direction vectors, and set the label lead-out point in this direction (the purpose is to lead out the label from the relatively "open" quadrant). The angle of the label lead line is dynamically calculated and determined according to the included angle between the selected main pipe joint direction and the adjacent branch pipe joint direction (follow the general lead line angle rules as described above, such as 60° for horizontal pipe, 45° for vertical pipe, and 90° for inclined pipe). This setting ensures that the label position of the four-way complex pipe fitting is relatively balanced, the lead line angle is reasonable, and a clear and unobstructed target label result is formed.
[0167] In the above embodiments, by anchoring the branch pipe reverse direction for the tee label and using the adjacent joint included angle bisector direction for the four-way label, it is ensured that the label position of the multi-way component conforms to the physical connection nature. Then, the split line and the lead line angle are dynamically adjusted according to the included angle between the branch pipe and the main pipe, to realize the topological adaptability of complex node labeling.
[0168] In the present embodiment, a component labeling device is also provided, which is used to implement the above embodiments and preferred embodiments, and has been described above and will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware is also possible and contemplated.
[0169] The present embodiment provides a component labeling device, as shown in Figure 19 , comprising:
[0170] The acquisition module 401 is configured to acquire a target architectural drawing to be labeled, the target architectural drawing comprising a plurality of components;
[0171] The determination module 402 is configured to, in response to a region marquee operation on the target architectural drawing, determine a target marquee region and a set of components to be labeled in the target marquee region;
[0172] The first splitting module 403 is configured to split the set of components to be labeled based on the connection relationship between each first target component in the set of components to be labeled, to obtain a plurality of component subsets;
[0173] The second splitting module 404 is configured to, for any component subset, split the component subset based on the first component attribute parameters corresponding to each second target component in the component subset, to obtain a plurality of component groups;
[0174] The labeling module 405 is configured to, for any component group, label each third target component in the component group according to a preset labeling rule, to generate a target labeling result.
[0175] In some optional embodiments, the first splitting module 403 comprises:
[0176] The first splitting sub-module is configured to split the set of components to be labeled based on the connection relationship between the first target components, to obtain a plurality of component split sets.
[0177] The classification sub-module is configured to classify each fourth target component in the component split set according to the component direction, to obtain a horizontal component subset and a vertical component subset; wherein the component subset comprises the horizontal component subset and the vertical component subset.
[0178] In some optional embodiments, the first splitting sub-module comprises:
[0179] The traversal unit is configured to traverse all the first adjacent components connected to the first target component for any first target component in the set of components to be labeled.
[0180] The first determination unit is configured to determine all the first adjacent components corresponding to the first target component as the component split set corresponding to the first target component.
[0181] In some optional embodiments, the classification sub-module comprises:
[0182] The acquisition unit is configured to acquire the number of joints and the joint direction of each fourth target component.
[0183] The second determination unit is configured to determine the fourth target component as a horizontal component when the number of joints of the fourth target component meets the first preset rule and / or the joint direction meets the second preset rule for any fourth target component.
[0184] The third determination unit is configured to determine the other fourth target components in the component split set except the horizontal component as vertical components.
[0185] The component unit is configured to construct the horizontal component subset using the horizontal components and construct the vertical component subset using the vertical components.
[0186] In some optional embodiments, the second determination unit comprises:
[0187] The first acquisition sub-unit is configured to acquire the number of joints of the fourth target component.
[0188] The first determination sub-unit is configured to determine the fourth target component as a horizontal component when the number of joints is greater than a preset value.
[0189] In some optional embodiments, the second determination unit further comprises:
[0190] The second acquisition subunit is configured to acquire a target angle between a joint direction of the fourth target component and a horizontal coordinate axis.
[0191] The second determination subunit is configured to determine the fourth target component as a horizontal component if the number of joints is one and the target angle is within a preset interval.
[0192] The third determination subunit is configured to determine the fourth target component as a horizontal component if the number of joints is two and the target angle corresponding to at least one joint of the fourth target component is within a preset interval.
[0193] In some optional embodiments, the second splitting module 404 comprises:
[0194] The sorting sub-module is configured to sort each second target component in the component subset according to the corresponding first component attribute parameter, and determine the fifth target component located at the target position by using the sorting result.
[0195] The first determination sub-module is configured to traverse the second adjacent components corresponding to the fifth target component from the target position, and end the traversal and determine all the second adjacent components currently traversed as the component group if it is identified that the second adjacent component currently traversed is a preset component type.
[0196] In some optional embodiments, the sorting sub-module comprises:
[0197] The first sorting unit is configured to sort each horizontal component in the component subset according to a horizontal position, and determine a target horizontal component located at a minimum horizontal position by using the sorting result.
[0198] The second sorting unit is configured to sort each vertical component in the component subset according to a vertical position, and determine a target vertical component located at a minimum vertical position by using the sorting result. The fifth target component comprises the target horizontal component and the target vertical component.
[0199] In some optional embodiments, the labeling module 405 comprises:
[0200] The second determination sub-module is configured to acquire a second component attribute parameter corresponding to each third target component, and determine a labeling feature corresponding to each third target component by using the second component attribute parameter.
[0201] The labeling sub-module is configured to label each third target component in the component group according to the labeling feature, and generate an initial labeling result.
[0202] The adjustment sub-module is configured to adjust the initial labeling result according to a preset adjustment rule, and obtain a target labeling result.
[0203] In some optional embodiments, the second determination sub-module comprises:
[0204] The fourth determining unit is configured to determine a label lead-in point corresponding to each third target component by using a component type of each third target component.
[0205] The fifth determining unit is configured to determine a label lead-in angle corresponding to each third target component by using a component direction of each third target component.
[0206] The sixth determining unit is configured to determine a label split line direction corresponding to each third target component by using a component joint direction of each third target component.
[0207] The seventh determining unit is configured to determine a label lead-in length corresponding to each third target component by using a component size of each third target component.
[0208] In some optional embodiments, the adjusting sub-module comprises:
[0209] The first detecting unit is configured to detect, for a third target component in a horizontal or inclined direction, whether a spacing of an adjacent label split line corresponding to an adjacent third target component is less than a preset spacing threshold.
[0210] The mirroring unit is configured to, if the spacing is less than the preset spacing threshold, perform mirroring processing on a label position of the third target component that meets the preset condition to obtain a target label result.
[0211] In some optional embodiments, the adjusting sub-module further comprises:
[0212] The first adjusting unit is configured to, if the third target component is an elbow, adjust a label lead-in direction of the elbow to be in a reverse direction of an elbow turning angle to obtain a target label result.
[0213] In some optional embodiments, the adjusting sub-module further comprises:
[0214] The second detecting unit is configured to detect whether an adjusted elbow label text represented by the target label result conflicts with an adjacent pipe fitting label.
[0215] The lengthening unit is configured to, if there is a conflict, lengthen a lead-in length corresponding to the elbow by a preset step length, so that the elbow label text does not conflict with the adjacent pipe fitting label.
[0216] The labeling unit is configured to, if the lengthened lead-in length exceeds a maximum lead-in length threshold, label a conflict identifier.
[0217] In some optional embodiments, the adjusting sub-module further comprises:
[0218] The second adjusting unit is configured to, if the third target component is a tee pipe fitting, set a label lead-out point corresponding to the tee pipe fitting in the opposite direction of the branch pipe, and adjust a label split line corresponding to the tee pipe fitting based on the included angle direction of the branch pipe to obtain a target label result.
[0219] The third adjusting unit is configured to, if the third target component is a four-way pipe fitting, set a label lead-out point corresponding to the four-way pipe fitting in the direction of the bisector of any two adjacent joints, and adjust a label lead angle corresponding to the four-way pipe fitting based on the included angle between the main pipe and the branch pipe to obtain a target label result.
[0220] Further function descriptions of the above-mentioned modules and units are the same as those of the above-mentioned embodiments, and will not be described here.
[0221] The component labeling device in the embodiment is in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and a memory executing one or more software or fixed programs, and / or other devices that can provide the above-mentioned functions.
[0222] The component labeling device provided by the embodiment of the application avoids the tedious steps of point selection by capturing a set of components to be labeled by frame selection. The component subsets are pre-split according to the connection relationship to isolate irrelevant components, and then the same component set is obtained according to attribute parameters and the preset labeling rules are applied for batch processing, which significantly improves the efficiency while ensuring the rationality of the labeling layout and completely avoids the tediousness of manual adjustment.
[0223] The embodiment of the application further provides a computer device having the above-mentioned Figure 19 component labeling device.
[0224] Please refer to Figure 20 , Figure 20 is a structural schematic diagram of a computer device provided by an optional embodiment of the application, as Figure 20As shown, the computer device includes: one or more processors 10, memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of a GUI on an external input / output device (such as, a display device coupled to an interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 20 A processor 10 is taken as an example.
[0225] The processor 10 may be a central processing unit, a network processor, or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.
[0226] The memory 20 stores instructions that can be executed by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0227] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0228] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0229] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 can be connected through a bus or other means, Figure 20 The bus connection is taken as an example.
[0230] The input device 30 can receive inputted digital or character information, and generate key signal input related to user settings and function control of the computer device, such as touch screen, keypad, mouse, trackpad, touchpad, pointing stick, one or more mouse buttons, trackball, joystick, etc. The output device 40 can include display device, auxiliary lighting device (e.g. LED), and tactile feedback device (e.g. vibration motor), etc. The display device includes but is not limited to liquid crystal display, light emitting diode, display and plasma display. In some optional embodiments, the display device can be a touch screen.
[0231] The computer device also includes a communication interface for communication between the computer device and other devices or communication networks.
[0232] The embodiments of the present application also provide a computer readable storage medium, and the method according to the embodiments of the present application can be implemented in hardware, firmware, or recorded in a storage medium, or be implemented as computer code stored in a remote storage medium or non-transitory machine readable storage medium and stored in a local storage medium to be downloaded through a network, so that the method described herein can be processed by such software on a storage medium using a general purpose computer, a special purpose processor or programmable or special purpose hardware. The storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk or a solid state disk, etc. Further, the storage medium can also include a combination of the above-mentioned types of memories. It can be understood that the computer, processor, microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code, when the software or computer code is accessed and executed by the computer, processor or hardware, the method shown in the above embodiments is implemented.
[0233] Part of the present application can be applied as a computer program product, for example, computer program instructions, when executed by a computer, through the operation of the computer, can invoke or provide the method and / or technical solutions according to the present application. Those skilled in the art should understand that the form of computer program instructions in computer readable medium includes but is not limited to source files, executable files, installation package files and the like, and accordingly, the way of computer program instructions executed by computer includes but is not limited to: the computer directly executes the instructions, or the computer compiles the instructions and then executes the corresponding compiled program, or the computer reads and executes the instructions, or the computer reads and installs the instructions and then executes the corresponding installed program. Here, the computer readable medium can be any available computer readable storage medium or communication medium accessible to the computer.
[0234] Although the embodiments of the present application are described in conjunction with the drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present application, and such modifications and changes fall within the scope defined by the appended claims.
Claims
1. A component marking method, characterized in that: The method comprises: Acquire a target building drawing to be annotated, wherein the target building drawing includes a plurality of components; In response to a region selection operation on the target architectural drawing, determining a target selection region and a set of components to be annotated within the target selection region; Splitting the set of components to be annotated based on the connection relationship between each first target component in the set of components to be annotated to obtain multiple component subsets; For any of the component subsets, based on the first component attribute parameters corresponding to each second target component in the component subset, the component subset is split to obtain a plurality of component groups; For any of the component groups, each third target component in the component group is labeled according to a preset labeling rule to generate a target labeling result.
2. The method according to claim 1, characterized in that The component set to be labeled is split based on the connection relationship between each first target component in the component set to be labeled to obtain multiple component subsets, including: Splitting the set of components to be annotated based on the connection relationship between each of the first target components to obtain multiple component split sets; For any of the component split sets, classify each fourth target component in the component split set according to component direction to obtain a horizontal component subset and a vertical component subset; The component subset includes the horizontal component subset and the vertical component subset.
3. The method according to claim 2, characterized in that The component set to be labeled is split based on the connection relationship between each of the first target components to obtain multiple component split sets, including: For any first target component in the set of components to be labeled, traverse first adjacent components connected to all joints of the first target component; All first adjacent components corresponding to the first target component are determined as a component split set corresponding to the first target component.
4. The method according to claim 2 or 3, characterized in that For any of the component split sets, classifying each fourth target component in the component split set according to component direction to obtain a horizontal component subset and a vertical component subset, including: Obtaining the number and direction of joints of each of the fourth target components; For any of the fourth target components, when the number of joints of the fourth target component meets the first preset rule and / or the joint direction meets the second preset rule, the fourth target component is determined to be a horizontal component; Determine the fourth target components other than the horizontal component in the component splitting set as vertical components; The horizontal component subset is constructed using the horizontal components, and the vertical component subset is constructed using the vertical components.
5. The method according to claim 4, characterized in that When the number of joints of the fourth target component satisfies a first preset rule, determining the fourth target component as a horizontal component includes: obtaining the number of joints of the fourth target component; When the joint data is greater than a preset value, the fourth target component is determined as the horizontal component.
6. The method according to claim 4, characterized in that When the number of joints of the fourth target component satisfies a first preset rule and the joint direction satisfies a second preset rule, determining the fourth target component as a horizontal component includes: Obtaining a target angle between the joint direction of the fourth target component and the horizontal coordinate axis; If the number of the joints is one and the target angle is within a preset range, determining the fourth target component as the horizontal component; If the number of the joints is two and the target angle corresponding to at least one joint of the fourth target component is within the preset range, the fourth target component is determined to be the horizontal component.
7. The method according to claim 1, characterized in that The component subset is split based on the first component attribute parameters corresponding to each second target component in the component subset to obtain multiple component groups, including: sorting the second target components in the component subset according to the corresponding first component attribute parameters, and determining the fifth target component located at the target position using the sorting result; The second adjacent components corresponding to the fifth target component are traversed from the target position. If it is identified that the currently traversed second adjacent component is of a preset component type, the traversal is terminated, and all the currently traversed second adjacent components are determined as the component group.
8. The method according to claim 7, characterized in that The first component attribute parameters include a horizontal position and a vertical position, and sorting the second target components in the component subset according to the corresponding first component attribute parameters, and determining the fifth target component located at the target position using the sorting result, includes: Sorting the horizontal components in the component subset according to their horizontal positions, and determining a target horizontal component located at a minimum horizontal position using the sorting result; sorting the vertical components in the component subset according to their vertical positions, and determining a target vertical component located at a minimum vertical position using the sorting result; Wherein, the fifth target component includes the target horizontal component and the target vertical component.
9. The method according to claim 1, characterized in that The step of labeling each third target component in the component group according to a preset labeling rule to generate a target labeling result includes: Acquire the second component attribute parameters corresponding to each of the third target components, and determine the annotation features corresponding to each of the third target components using the second component attribute parameters; Annotate each of the third target components in the component group according to the annotation features to generate an initial annotation result; The initial labeling result is adjusted according to a preset adjustment rule to obtain the target labeling result.
10. The method according to claim 9, characterized in that The second component attribute parameters include component type, component direction, component joint direction and component size; the annotation features include annotation lead-out point, annotation lead angle, annotation dividing line direction and annotation lead length; Determining the annotation features corresponding to each of the third target components using the second component attribute parameters includes: Determining a label lead-out point corresponding to each of the third target components by using the component type of each of the third target components; Determining the annotation lead angle corresponding to each of the third target components by using the component direction of each of the third target components; Determining the directions of the marking dividing lines corresponding to the respective third target components by using the component joint directions of the respective third target components; The dimension of each third target component is used to determine the length of the annotation lead corresponding to each third target component.
11. The method according to claim 9, characterized in that The adjusting the initial labeling result according to a preset adjustment rule to obtain the target labeling result includes: For the third target component in the horizontal or inclined direction, detecting whether the spacing between adjacent marked dividing lines corresponding to adjacent third target components is less than a preset spacing threshold; If the distance is less than the preset distance threshold, the marked position of the third target component that meets the preset conditions is mirrored to obtain the target marking result.
12. The method according to claim 9, characterized in that The adjusting the initial labeling result according to a preset adjustment rule to obtain the target labeling result includes: If the third target component is an elbow, the direction of the annotation leader of the elbow is adjusted to the opposite direction of the elbow turning angle to obtain the target annotation result.
13. The method according to claim 12, characterized in that Also includes: Detecting whether the adjusted elbow annotation text represented by the target annotation result conflicts with adjacent pipe fitting annotations; If there is a conflict, the length of the lead corresponding to the elbow is extended according to a preset step length so that there is no conflict between the elbow annotation text and the adjacent pipe annotation; If the extended lead length exceeds the maximum lead length threshold, a conflict mark is marked.
14. The method according to claim 9, characterized in that The adjusting the initial labeling result according to a preset adjustment rule to obtain the target labeling result includes: If the third target component is a tee pipe, the annotation lead-out point corresponding to the tee pipe is set in the opposite direction of the branch pipe, and the annotation segmentation line corresponding to the tee pipe is adjusted based on the angle direction of the branch pipe to obtain the target annotation result; If the third target component is a four-way pipe fitting, the annotation lead-out point corresponding to the four-way pipe fitting is set in the direction of the angle bisector between any two adjacent joints, and the annotation lead-in angle corresponding to the four-way pipe fitting is adjusted based on the angle between the main pipe and the branch pipe to obtain the target annotation result.
15. A component marking device, characterized in that: The device comprises: An acquisition module is used to acquire a target building drawing to be annotated, wherein the target building drawing includes a plurality of components; a determination module, configured to determine a target framed area and a set of components to be annotated within the target framed area in response to a framed area selection operation on the target architectural drawing; A first splitting module is used to split the set of components to be labeled based on the connection relationship between each first target component in the set of components to be labeled to obtain multiple component subsets; A second splitting module is configured to split any of the component subsets based on the first component attribute parameters corresponding to each second target component in the component subset to obtain a plurality of component groups; The labeling module is used to label each third target component in any component group according to a preset labeling rule to generate a target labeling result.
16. A computer program product, characterized in that The invention comprises computer instructions, wherein the computer instructions are used to make a computer execute the component marking method according to any one of claims 1 to 14.
Citation Information
Patent Citations
Drawing splitting method and related device
CN111783180A
Two-dimensional drawing labeling method and device and electronic equipment
CN113553453A
Component filling method and device, storage medium and electronic device
CN118840451A