A labeling intelligent avoidance layout method and system for shipbuilding
Patent Information
- Application Number
- CN202611150569.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-31
- Publication Date
- 2026-10-30
AI Technical Summary
[0013]针对现有技术中存在的标注布局效率低下、布局质量不佳以及缺乏场景自适应能力等问题,本发明提供一种面向船舶制造的标注智能避让布局方法及系统,通过融合空间索引加速、多类型标注差异化处理与场景自适应参数配置等技术手段,实现船舶工程图纸中高密度、多类型工程标注的高效自动化避让布局
[0041]1.传统逐对碰撞检测方法的计算复杂度为O(n²),当标注数量达到数百甚至上千个时计算耗时急剧增加,而本发明通过构建基于包围盒的层次化空间索引结构,将单次碰撞检测的复杂度从O(n)降低至O(mlogn),其中m为实际与查询区域相交的对象数量,通常远小于n,在典型船舶工程图纸场景中,碰撞检测次数可缩减90%以上,使得大规模标注的实时避让布局成为可能。
Smart Images

Figure CN123013285A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital design and computer-aided design technology for shipbuilding, specifically to an intelligent obstacle avoidance layout technology for multiple types of engineering annotations in ship engineering drawings. Background Technology
[0002] In the entire process of digital design in shipbuilding, the two-dimensional engineering drawings generated by 3D modeling software are the core basis for workshop manufacturing and on-site installation, and the engineering annotation information contained therein is of paramount importance.
[0003] However, typical ship engineering drawings often have extremely high information density. A single drawing may contain hundreds of part number bubble labels and hundreds of linear dimension labels, with the total number of labels often reaching thousands. How to achieve a reasonable layout of these labels within the limited drawing space and avoid overlap between labels and between labels and the ship structure graphics is the key to ensuring the readability of drawings, improving the efficiency of drawing reading in the manufacturing process, and ensuring the accuracy of construction.
[0004] Therefore, achieving efficient and automated obstacle avoidance layout in engineering drawing annotations has become an important issue that urgently needs to be addressed in the field of digital design for shipbuilding.
[0005] In existing technologies, the layout of annotations in ship design software mainly relies on manual adjustments by designers. Designers need to drag and drop annotations one by one to the appropriate position and try repeatedly. However, due to the highly coupled spatial overlap between annotations, moving an annotation to eliminate an overlap often causes new conflicts with adjacent objects. This method of operation is not only inefficient, but the final layout quality also depends heavily on the designer's personal experience and lacks objective optimization guarantees.
[0006] Although some traditional CAD software has built-in obstacle avoidance algorithms, there are still significant technical bottlenecks when handling such large-scale annotations, specifically in the following aspects:
[0007] 1. Traditional algorithms typically employ a pairwise traversal detection strategy to determine the overlap between labels. When processing hundreds of labels, the system already struggles. When the number of labels reaches thousands, the enormous computational time makes real-time interactive design impractical.
[0008] 2. The simple one-way offset strategy used by some software is ineffective in densely labeled areas, often getting stuck in a vicious cycle where moving forward solves one overlap, but moving backward creates a new overlap. In addition, this strategy does not fully consider the essential differences in spatial constraints between dimension annotations and bubble annotations, and also ignores the rationality of the leader angle, resulting in poor final layout quality.
[0009] 3. Most existing public methods adopt a greedy strategy, that is, placing labels in a specific order. This first-come-first-served mechanism means that labels placed later can only find a position in the remaining space, often forcing them to choose suboptimal solutions with excessively long leader lines or large angle deviations. The overall layout quality is far from the global optimum.
[0010] 4. Existing methods generally use fixed avoidance parameters, which cannot be dynamically adjusted according to the needs of different process stages and lack flexible scenario adaptive configuration capabilities.
[0011] In summary, existing ship engineering drawing annotation layout technologies have significant shortcomings in terms of computational efficiency, layout quality, and scene adaptability. In particular, when facing large-scale scenarios with high density and multiple types of annotations, existing technologies lack an automated obstacle avoidance solution that can respond in real time, optimize globally, and adapt to different scenarios.
[0012] Therefore, further research and improvement are urgently needed in this field to provide an efficient and intelligent annotation layout method. Summary of the Invention
[0013] To address the problems of low efficiency, poor layout quality, and lack of scene adaptability in existing annotation layout technologies, this invention provides an intelligent obstacle avoidance layout method and system for shipbuilding. By integrating spatial index acceleration, multi-type annotation differentiation processing, and scene adaptive parameter configuration, it achieves efficient and automated obstacle avoidance layout of high-density, multi-type engineering annotations in shipbuilding engineering drawings.
[0014] To achieve the above objectives, this invention provides an intelligent obstacle avoidance layout method for shipbuilding, comprising the following steps: acquiring the objects to be annotated and their projection parameters in a 3D scene; projecting the objects to be annotated onto a 2D drawing space to generate several annotation objects and corresponding model entity objects; loading scene configuration parameters matching the current process stage; constructing spatial indexes of the annotation objects and model entity objects in the 2D drawing space; searching for obstacle avoidance positions for each type of annotation object according to the scene configuration parameters; moving each annotation object from its initial position to its target placement position so that the overlap rate of each annotation object in the 2D drawing space meets preset conditions; and outputting the 2D engineering drawings after obstacle avoidance processing.
[0015] In the above method, the spatial index is a hierarchical spatial index structure based on bounding boxes. During the avoidance position search process, the placed objects that have spatial intersection with the candidate placement position are obtained by querying the spatial index, thereby avoiding the need to traverse and detect all placed objects one by one.
[0016] In practice, each node of the spatial index maintains a directed bounding box that surrounds all its child nodes. The insertion operation uses a minimum expansion cost strategy to select the optimal leaf node. For a candidate child node to be inserted, the expansion cost after merging it with the current bounding box bounds is calculated according to the following formula:
[0017] ExpandCost(child,bounds)=Area(Union(child.Bounds,bounds))-Area(child.Bounds)
[0018] The Union operation calculates the merged bounding box of two directed bounding boxes, and the Area operation calculates the area of the directed bounding box. During each insertion, the child node path with the lowest expansion cost is selected and recursively descended until the leaf node is reached to insert the data item. When the node capacity exceeds the threshold, the node is split into two child nodes by sorting by the center coordinate and using the median position.
[0019] The query operation recursively traverses from the root node. For the candidate labeled region (candidate), the collision detection query is executed using the following formula:
[0020] CollisionCheck(candidate,RTree)={items|item.Bounds∩candidate.Bounds≠∅,item∈RTree.Query(candidate.Bounds)}
[0021] The Query operation only accesses nodes in the spatial index whose bounding boxes intersect with the candidate region. It only enters the child node search when the bounding box of a node intersects with the query region, thereby greatly reducing unnecessary collision detection computation.
[0022] In the above method, for linear dimension objects, the avoidance position search is carried out according to the process of grouping, layering, and layer-by-layer collaborative offset. First, linear dimensions that share an attachment point and whose dimension line directions meet the parallel condition are grouped into the same group. Then, the linear dimensions in the same group are divided into several levels according to the distance from the dimension line to the attachment point. Finally, starting from the innermost level, the offset direction and offset amount are determined layer by layer, with the outer layer following the offset direction of the inner layer. This layered grouping collaborative processing method ensures the consistency of the offset of each dimension in the same group and avoids visual confusion caused by the independent offset of individual dimensions.
[0023] Specifically, the layered processing of linear dimensioning includes: calculating the vertical distance from the dimension line of each linear dimensioning in the same group to the attachment point; grouping linear dimensionings with a vertical distance difference less than a preset threshold into the same layer; and sorting linear dimensionings with text overlap in the same layer by dimensioning length and then migrating the overlapping items to adjacent layers.
[0024] When determining the offset direction and offset amount layer by layer, the preset offset amount is traversed along the positive and negative directions of the dimension line normal for the current level. The total collision deduction under each offset scheme is calculated. The offset direction and offset amount with the lowest total deduction are selected as the offset scheme for the current level. The outer level adopts the same offset direction as the innermost level and the offset amount is determined independently.
[0025] In the above method, for bubble-labeled objects, the avoidance location search follows the process of clustering, radial divergence, and location search. First, the leader attachment points of each bubble label are clustered to form several label clusters. Then, the bubble labels within each label cluster are distributed radially from the cluster center to each leader attachment point. Finally, the location search is performed on the bubble labels within each label cluster to determine the leader angle and label offset of each bubble label. The global problem is decomposed into local sub-problems through clustering, and a reasonable initial distribution state is created for the subsequent location search through radial divergence.
[0026] Specifically, the clustering process of bubble annotation uses a probability distribution to select the initial cluster center and performs clustering iteration. Starting from the initial number of clusters, it judges whether the maximum radius of each annotation cluster exceeds the preset distance threshold. The annotation clusters with the maximum radius exceeding the preset distance threshold are split into two sub-clusters and re-clustered until the maximum radius of all annotation clusters does not exceed the preset distance threshold or the maximum number of clusters is reached.
[0027] For the search of bubble labels within each label cluster, when the number of bubble labels within the label cluster is within a preset range, the candidate locations for each bubble label are traversed sequentially to expand the path. At each step, several paths with the highest scores are retained, and finally, the path scheme with the highest total score is selected as the layout result of the label cluster.
[0028] In the above method, when calculating the score of the candidate placement position during the avoidance position search process, the spatial index is queried to obtain the collision objects that have spatial intersection with the candidate placement position. The corresponding deduction weight is determined according to the type of the collision object and the deduction value of each collision object is accumulated. The angle deduction value is determined according to the lead angle deviation and lead folding state corresponding to the candidate placement position. The final score of the candidate placement position is obtained by subtracting the accumulated collision deduction value and angle deduction value from the initial score.
[0029] Specifically, for the i-th candidate placement location, its score is calculated according to the following formula:
[0030] Score(position)=InitScore-IteratorPenalty×iteration-ΣDeductPointByCollisionType(annoType,collisionType)-AnglePenaltyRatio×|angle-optimalAngle|-UnsuitableAngle×IsAcuteFold(leader,rect)
[0031] In this context, `InitScore` is the initial maximum score, `IteratorPenalty` is the deduction value for each iteration, `iteration` is the current iteration number, and `DeductPointByCollisionType` is a function that finds predefined deduction weights based on the annotation type and collision type. Collision types cover various scenarios such as annotation text collisions, annotation text collisions with model entities, and leader line collisions. `AnglePenaltyRatio` is the leader line angle deviation penalty coefficient, `angle` is the leader line angle corresponding to the current candidate position, and `optimalAngle` is the preset optimal leader line angle. `UnsuitableAngle` is the leader line foldback penalty coefficient, and `IsAcuteFold` is a Boolean function that determines whether a foldback has occurred between the leader line and the label box.
[0032] During the scoring process, collisions between annotation texts, collisions between annotation texts and model entities, and deviations of leader angles from the optimal direction are all assigned different deduction weights, thereby achieving a multi-dimensional quantitative evaluation of layout quality. When the score of a candidate position is higher than the permissible placement threshold, the position is immediately accepted without continuing to search for more alternative solutions; if none of the alternative solutions reach the threshold, the solution with the highest score is selected as the suboptimal solution.
[0033] In the above methods, the scene configuration parameters include at least one of the following: visual parameters, search step size parameters, maximum number of iterations parameters, deduction weight parameters for various collisions, and scoring threshold parameters. Among the scene configuration parameters corresponding to different process stages, the deduction weight parameters and the maximum number of iterations parameters are different, so that the same algorithm framework can flexibly adapt to the differentiated process requirements of different shipbuilding stages.
[0034] The present invention also provides a labeling intelligent obstacle avoidance layout system for shipbuilding, including a projection transformation module, a scene configuration module, a spatial index module, an obstacle avoidance processing module, and an output module.
[0035] The projection transformation module is used to obtain the objects to be annotated and their projection parameters in the 3D scene, project the objects to be annotated onto the 2D drawing space, and generate several annotated objects and their corresponding model entity objects.
[0036] The scenario configuration module is used to load scenario configuration parameters that match the current process stage.
[0037] The spatial index module is used to construct spatial indexes of labeled objects and model entity objects in two-dimensional paper space.
[0038] The obstacle avoidance module is used to search for obstacle avoidance positions for each type of annotation object according to the scene configuration parameters, and move each annotation object from its initial position to the target placement position so that the overlap rate of each annotation object in the two-dimensional drawing space meets the preset conditions.
[0039] The output module is used to output two-dimensional engineering drawings after the obstacle avoidance process.
[0040] Compared with the prior art, the present invention has the following advantages:
[0041] 1. The computational complexity of traditional pairwise collision detection methods is O(n²). When the number of annotations reaches hundreds or even thousands, the computation time increases dramatically. However, this invention reduces the complexity of a single collision detection from O(n) to O(mlogn) by constructing a hierarchical spatial index structure based on bounding boxes, where m is the actual number of objects intersecting with the query region, which is usually much smaller than n. In a typical marine engineering drawing scenario, the number of collision detections can be reduced by more than 90%, making real-time avoidance layout of large-scale annotations possible.
[0042] 2. Existing simple offset strategies and greedy strategies often get stuck in local optima when facing densely labeled areas, resulting in excessively long leader lines, excessive angle deviations, or even continuous overlap between labels. This invention uses a multi-type hierarchical penalty scoring system to perform a refined quantitative evaluation of layout quality. It ensures visual consistency of labels in the same group through hierarchical grouping and collaborative offset of linear dimension labels. It achieves a near-global optimal layout in small and medium-sized clusters through a strategy that combines clustering, radial divergence, and branch search of bubble labels.
[0043] 3. Existing technologies use fixed avoidance parameters, which cannot be flexibly adjusted according to the requirements of different process stages in shipbuilding. In contrast, this invention uses a three-level configurable parameter system to pre-set differentiated parameter combinations for different process stages. In large-scale scenarios, the number of iterations is appropriately reduced to prioritize computational efficiency, while in small-scale scenarios, the number of iterations and penalty weights are increased to pursue better layout quality. This allows the same algorithm framework to flexibly adapt to various process scenarios such as pipe installation, ticket production, pipe support production, iron outfitting installation, and electrical outfitting installation, avoiding the high cost of developing independent algorithms for each scenario.
[0044] 4. In the traditional ship design process, designers need to spend several hours manually adjusting the position of annotations to avoid overlap. However, this invention automates this process completely. Users only need to trigger an avoidance operation once to complete the intelligent layout optimization of all annotations within tens of seconds, which greatly reduces the time for manual intervention, reduces the workload of designers, and ensures the objectivity and consistency of the layout results.
[0045] In summary, this invention effectively overcomes the shortcomings of existing technologies in terms of computational efficiency, layout quality, and scenario adaptability, providing an efficient, reliable, and configurable complete solution for intelligent obstacle avoidance layout in engineering drawings for shipbuilding. Attached Figure Description
[0046] Figure 1 This is a schematic diagram of the overall architecture of the intelligent obstacle avoidance layout system provided in an embodiment of the present invention;
[0047] Figure 2 A schematic diagram illustrating the principle of R-Tree spatial index construction and querying provided in this embodiment of the invention;
[0048] Figure 3 A flowchart illustrating the linear dimension annotation hierarchical grouping collaborative offset algorithm provided in an embodiment of the present invention;
[0049] Figure 4 This is a flowchart illustrating the bubble-annotated K-Means++ clustering and radial divergence algorithm provided in an embodiment of the present invention.
[0050] Figure 5 This is a schematic diagram illustrating the process of expanding and pruning the bubble-annotated branch search path according to an embodiment of the present invention.
[0051] Figure 6 This is a schematic diagram of the collision type hierarchy of the multi-type hierarchical penalty scoring system provided in an embodiment of the present invention. Detailed Implementation
[0052] To enhance understanding of the present invention, the invention will be further described in detail below with reference to embodiments and accompanying drawings. These embodiments are only for explaining the invention and do not constitute a limitation on the scope of protection of the invention.
[0053] In this embodiment of the invention, the annotation objects include two types: linear dimensioning and bubble annotation. Linear dimensioning consists of three parts: dimension line, dimension extension line, and annotation text, occupying a narrow rectangular space area; bubble annotation consists of a circular or rectangular label frame and a leader line, with one end of the leader line connected to the leader attachment point of a part on the 3D model, and the other end connected to the label frame.
[0054] I. System Architecture and Initialization Process
[0055] like Figure 1 As shown, the system mainly consists of a projection transformation module, a scene adaptive parameter configuration module, a spatial index module, a linear dimension annotation avoidance module, a bubble annotation avoidance module, and a penalty scoring system.
[0056] In the specific implementation process, the system first receives input data from the 3D scene, which includes the objects to be annotated in the 3D scene and camera projection parameters. The objects to be annotated cover various entities in the 3D model, as well as the associated 3D annotation objects. The projection transformation module calculates the 3D to 2D projection matrix based on the received camera projection parameters, projects the objects to be annotated in the 3D scene onto the 2D drawing space, and generates several annotation objects and corresponding model entity objects.
[0057] During system initialization, the scene adaptive parameter configuration module loads the corresponding three-level parameter configuration from the configuration factory based on the current shipbuilding process stage. This three-level parameter configuration includes annotation visual configuration, algorithm behavior configuration, and penalty rule configuration. The annotation visual configuration is used to set visual parameters such as annotation ratio, text height of various types of annotations, and font style. The algorithm behavior configuration is used to set algorithm behavior parameters such as angle search step size, offset step size, avoidance mode, clustering distance threshold, maximum number of clusters, and maximum number of iterations. The penalty rule configuration is used to set the deduction weights for various types of collisions and the tolerance placement threshold.
[0058] Different shipbuilding process stages correspond to different parameter combinations. For example, the pipe installation stage has a large number of annotations and dense scene objects, so a lower number of iterations and a medium penalty weight are used to prioritize computational efficiency; the pipe support fabrication stage has fewer annotations, so a higher number of iterations and a penalty weight are used to pursue better layout quality.
[0059] II. Construction and Querying of R-Tree Spatial Indexes
[0060] To support high-frequency collision detection queries in subsequent avoidance processing, this invention constructs a hierarchical spatial index structure based on directed bounding boxes, such as... Figure 2 As shown, during the drawing object registration phase, the system traverses all annotable objects in the drawing scene and adds linear dimension annotations, bubble annotations, and model entity objects to the avoidance manager one by one. After each object is projected onto a two-dimensional plane, its directed bounding box is calculated, and then the directed bounding box is inserted into the R-Tree spatial index.
[0061] Each node in an R-Tree spatial index maintains a directed bounding box that surrounds all its child nodes. Insertion operations use a minimum expansion cost strategy to select the optimal leaf node.
[0062] For a candidate child node to be inserted, the expansion cost after merging it with the current bounding box (bounds) to be inserted is calculated as follows:
[0063] ExpandCost(child,bounds)=Area(Union(child.Bounds,bounds))-Area(child.Bounds)
[0064] The Union operation calculates the merged bounding box of two directed bounding boxes, which is to take the minimum and maximum values of the coordinates of all vertices of the two bounding boxes to form a new directed bounding box; the Area operation calculates the area of a directed bounding box.
[0065] Each time an insertion occurs, the system starts from the root node and recursively descends by selecting the child node path with the lowest expansion cost layer by layer until it reaches the leaf node. Then, the data item is inserted into the leaf node. When the number of data items in the leaf node exceeds the preset capacity threshold, the system sorts them according to the X-axis direction of the center coordinates of each data item and splits the node into two child nodes at the median position.
[0066] The query operation recursively traverses from the root node. For the candidate labeled region (candidate), the collision detection query is executed using the following formula:
[0067] CollisionCheck(candidate,RTree)={items|item.Bounds∩candidate.Bounds≠∅,item∈RTree.Query(candidate.Bounds)}
[0068] The Query operation only accesses nodes in the R-Tree whose bounding boxes have spatial intersection with the candidate regions. Specifically, the query starts from the root node and determines whether the directed bounding box of the current node intersects with the candidate region. If they do not intersect, the node is pruned and the entire subtree is skipped. If they intersect, the node is further checked in the child node until the leaf node is reached. All placed objects that have spatial intersection with the candidate region are returned. This hierarchical spatial pruning strategy greatly reduces the amount of unnecessary collision detection computation.
[0069] III. Avoidance measures for linear dimensioning
[0070] like Figure 3 As shown, for linear dimensioning objects, the avoidance location search is performed in three steps: grouping, layering, and layer-by-layer collaborative offsetting.
[0071] During the grouping phase, the system iterates through all linear dimensions and determines whether any two linear dimensions meet the grouping conditions. The grouping conditions include: the dimension lines of the two dimensions are in the same or opposite direction, i.e., the two dimension lines are parallel; the two dimensions share at least one dimension line attachment point; and the two dimensions are located on the same three-dimensional plane.
[0072] If all the above conditions are met, the two labels will be merged into the same group. The grouping operation will be implemented using a disjoint-set data structure, and finally all linear dimension labels will be divided into several non-overlapping groups.
[0073] During the layering stage, for linear dimension annotations within each group, the system sorts them from smallest to largest according to the vertical distance from the dimension line to the attachment point. It calculates the vertical distance from the dimension line to the attachment point of each linear dimension annotation within the same group, and groups linear dimension annotations with a vertical distance difference less than a preset threshold and located on the same plane into the same layer. For linear dimension annotations with overlapping text within the same layer, the system sorts them by annotation length and moves the overlapping items to adjacent layers to avoid mutual occlusion between annotation text within the same layer.
[0074] During the layer-by-layer collaborative offset phase, the system processes each layer starting from the innermost layer. For the current layer, offset attempts are made along the positive and negative directions of the dimension line normal. In each direction, the preset offset levels are traversed, and the total collision deduction of all labels in the layer under the offset scheme is calculated for each offset scheme.
[0075] Collision deductions are obtained by querying the R-Tree spatial index. Specifically, after moving the label by the current offset, the R-Tree is queried to obtain all placed objects that have spatial intersection with that position. Then, the deductions are accumulated according to the collision type. The system selects the offset direction and offset amount with the lowest total deduction as the offset scheme for the current level. The outer layer adopts the same offset direction as the innermost level, but can independently determine its own offset amount to ensure that there is no overlap between layers. In this way, the offset direction of each linear dimension label within the same group is consistent, avoiding visual confusion caused by the independent offset of individual labels.
[0076] IV. Handling of Bubble Markings
[0077] like Figure 4 As shown, for bubble-labeled objects, the avoidance location search is performed in three steps: clustering, radial divergence, and location search.
[0078] During the clustering phase, the system performs spatial clustering on the leader attachment points of all bubble labels. The clustering adopts the K-Means++ initialization strategy, which selects the initial cluster center based on the squared distance probability distribution to avoid getting trapped in local optima. The system starts from the number of clusters K=1, performs K-Means clustering iteration, assigns each label point to the nearest cluster center, and updates the cluster center position.
[0079] After each clustering is completed, check the maximum radius of each cluster, which is the maximum distance from each labeled point in the cluster to the cluster center. If the maximum radius of a cluster exceeds the preset distance threshold and the current number of clusters has not yet reached the maximum number of clusters limit, then split the cluster that exceeds the threshold into two sub-clusters and then re-execute K-Means clustering. Repeat the above iterative process until the maximum radius of all clusters does not exceed the preset distance threshold or reaches the maximum number of clusters limit.
[0080] During the radiation divergence phase, for each cluster, the system calculates the radiation direction angle from each label within the cluster to the cluster center, so that the label boxes of each bubble label are arranged outward along the radiation direction from the cluster center to each lead attachment point. This process avoids the original positions of the labels within the cluster being too concentrated, creating good initial distribution conditions for subsequent position search.
[0081] During the location search phase, the system selects different optimization strategies based on the size of each labeled cluster, such as... Figure 5 As shown, for small to medium-sized clusters with the number of bubble labels within a preset range, a branch search strategy is adopted. In this strategy, a path refers to a complete sequence of candidate position combinations formed after selecting candidate positions sequentially from the first bubble label to the last bubble label of the current label cluster. Specifically, each bubble label within the cluster is processed sequentially according to the radial angle order. For each label, all candidate positions are traversed, and several candidate paths with the highest scores are retained. When expanding to the next label, several sub-paths are expanded from each currently retained path. Pruning is performed to retain a limited number of paths with the highest cumulative scores. Finally, the path scheme with the highest total score is selected from all complete paths as the layout result of the label cluster. For clusters with more than 8 labels or less than 3 labels, an iterative greedy strategy is adopted to ensure computational efficiency.
[0082] V. Punishment Scoring System
[0083] like Figure 6 As shown, each time the system attempts to place a label in a candidate location, it first retrieves all collision objects that have spatial intersection with the candidate location by querying the R-Tree spatial index, then deducts points based on the collision type, and finally selects the location with the fewest deductions as the optimal layout.
[0084] The penalty scoring system is divided into three levels. The first level is the annotation-to-annotation collision layer, which covers collisions between annotation text and annotation text, annotation text and bubble leader, annotation text and dimension line, bubble leader and bubble leader, and bubble leader and dimension line, etc. Different collision types are assigned different deduction weights. The second level is the annotation-to-model entity collision layer, which covers collisions between annotation text and pipe, annotation text and valve, annotation text and pipe support, bubble leader and hull parts, and dimension line and hull parts, etc. The third level is the leader angle rationality layer, which covers the penalty for deviation of the bubble leader from the optimal angle in the vertical or horizontal direction, as well as the penalty for the folding back between the leader and the rectangular label frame.
[0085] For the i-th alternative placement location, its score is calculated according to the following formula:
[0086] Score(position)=InitScore-IteratorPenalty×iteration-ΣDeductPointByCollisionType(annoType,collisionType)-AnglePenaltyRatio×|angle-optimalAngle|-UnsuitableAngle×IsAcuteFold(leader,rect)
[0087] In this context, `InitScore` is the initial maximum score; `IteratorPenalty` is the deduction value for each iteration, and `iteration` is the current iteration number. By introducing an iteration penalty in the scoring, it encourages finding feasible positions with small offsets; `DeductPointByCollisionType` is a function that looks up predefined deduction weights based on the label type and collision type. This function queries the corresponding deduction value from a pre-configured deduction weight table; `AnglePenaltyRatio` is the leader angle deviation penalty coefficient, where `angle` is the leader angle corresponding to the current candidate position, and `optimalAngle` is the preset optimal leader angle; `UnsuitableAngle` is the leader foldback penalty coefficient, and `IsAcuteFold` is a Boolean function that determines whether a foldback has occurred between the leader and the label box. This function returns true when the leader folds back from the label box vertex.
[0088] After the scoring is completed, the system determines whether the score of the candidate location is higher than the preset tolerance placement threshold. If it is higher than the threshold, the location is accepted immediately without searching for more alternatives. If none of the alternatives meet the threshold, the highest-scoring option is selected as the suboptimal solution. This "accept if it meets the standard" judgment strategy effectively controls the search time while ensuring the layout quality.
[0089] The above scoring mechanism can be configured to use different deduction weight tables for different process stages, and the specific implementation depends on the loaded scenario configuration parameters.
[0090] Implementation Example
[0091] The method and system of the present invention will be illustrated below with reference to a specific scenario of a ship's pipe installation diagram.
[0092] During the design process of the pipe installation drawing for a certain hull section, the 3D modeling software generated a 2D engineering drawing containing 186 pipes, 42 valves, 28 pipe supports, 235 bubble annotations, and 168 linear dimension annotations.
[0093] The designer initiates the intelligent obstacle avoidance layout system of this invention. The system first loads the corresponding three-level parameter configuration from the configuration factory according to the current process stage "pipe installation". Due to the large number of annotations and dense scene objects in this scene, the maximum number of iterations in the parameter combination loaded by the system is set to 50, and the deduction weight of various collisions is set to a medium level in order to achieve a balance between obstacle avoidance effect and calculation efficiency.
[0094] The system iterates through all annotable objects in the drawing scene and inserts the 235 bubble annotations, 168 linear dimension annotations, and the 2D projection bounding boxes of 186 pipes, 42 valves, and 28 pipe supports into the R-Tree spatial index one by one; after the R-Tree is constructed, the system triggers the automatic avoidance process.
[0095] For the 168 linear dimensions, the system first performs a grouping operation. After disjoint-set data structure grouping, a total of 47 groups are formed. The largest group contains 12 dimensions. These dimensions share the same set of attachment points and the dimension lines are parallel to each other. The system sorts the 12 dimensions in this group according to the vertical distance from the dimension line to the attachment point and divides them into 4 levels. Starting from the innermost layer, the system performs collaborative offset layer by layer. After traversing and scoring each direction and offset, the innermost layer selects the scheme of offsetting 3 mm along the positive direction of the dimension line normal. The remaining outer layers follow the positive direction and determine their respective offsets. Finally, all dimensions in this group have consistent offsets and do not overlap.
[0096] For 235 bubble labels, the system performs K-Means++ adaptive clustering on their leader attachment points, iterating from K=1 to form 18 label clusters. The largest cluster contains 7 bubble labels, with their leader attachment points concentrated in an area with a radius of about 300 mm. The system performs radial divergence processing on this cluster, causing the 7 labels to distribute outward along their respective radial directions. Since the cluster size is 7, which is within the preset size range of 3 to 8, the system adopts a branch search strategy: processing the 7 labels in order of radial angle, traversing 24 angles within a 360-degree range for each label with a step size of 15 degrees, and using 3 preset offsets. At each step, the 3 paths with the highest scores are retained. After pruning, the 50 paths with the highest cumulative scores are retained. Finally, the complete path scheme with the highest total score is selected as the layout result of the cluster.
[0097] Throughout the avoidance process, the score calculation for each alternative location is performed by quickly querying the R-Tree to obtain the collision object. In typical operations, a single query only needs to visit about 5% of the R-Tree nodes, reducing the number of collision detections by about 92% compared to the pairwise traversal method. The entire avoidance process is completed within 25 seconds, outputting a two-dimensional engineering drawing with all annotations non-overlapping and reasonable leader angles. Designers can directly use this drawing for workshop manufacturing and on-site installation without any manual adjustments.
[0098] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A labeling-based intelligent obstacle avoidance layout method for shipbuilding, characterized in that, Includes the following steps: Obtain the object to be annotated and its projection parameters in the 3D scene, project the object to be annotated onto the 2D drawing space, and generate several annotated objects and corresponding model entity objects; Load scenario configuration parameters that match the current process stage; Construct spatial indices for the labeled objects and the model entity objects in the two-dimensional drawing space; According to the scene configuration parameters, avoidance position search is performed on each type of annotation object, and each annotation object is moved from the initial position to the target placement position so that the overlap rate of each annotation object in the two-dimensional drawing space meets the preset condition. Output two-dimensional engineering drawings after obstacle avoidance processing.
2. The intelligent obstacle avoidance layout method for shipbuilding according to claim 1, characterized in that, The spatial index is a hierarchical spatial index structure based on bounding boxes. During the avoidance position search process, the placed objects that have spatial intersection with the candidate placement positions are obtained by querying the spatial index.
3. The intelligent obstacle avoidance layout method for shipbuilding according to claim 1, characterized in that, When performing an avoidance location search on the dimension object of the linear dimension type, the following is included: Linear dimensions that share an attachment point and whose dimension line direction satisfies the parallel condition are grouped together. Linear dimensioning within the same group is divided into several levels based on the distance from the dimension line to the attachment point; Starting from the innermost layer, determine the offset direction and offset amount layer by layer, with the outer layer following the offset direction of the inner layer.
4. The intelligent obstacle avoidance layout method for shipbuilding according to claim 1, characterized in that, When performing an avoidance position search on the bubble annotation type, the following is included: Cluster the leader attachment points of each bubble label to form several label clusters; The bubble markings within each of the aforementioned marking clusters are distributed divergently along the radial direction from the cluster center to each lead attachment point; The positions of the bubble labels within each label cluster are searched to determine the leader angle and label offset of each bubble label.
5. The intelligent obstacle avoidance layout method for shipbuilding according to claim 3, characterized in that, The method of dividing linear dimensioning within the same group into several levels based on the distance from the dimension line to the attachment point includes: Calculate the vertical distance from the dimension line of each linear dimension annotation within the same group to the attachment point; Linear dimension annotations with a vertical distance difference less than a preset threshold are grouped into the same level; For linear dimension annotations with overlapping text within the same level, sort them by annotation length and then move the overlapping items to adjacent levels. The step-by-step determination of the offset direction and offset amount includes: For the current level, traverse each preset offset along the positive and negative directions of the dimension line normal and calculate the total collision deduction under each offset scheme; Select the offset direction and offset amount with the lowest total deduction as the offset scheme for the current level; The outermost level adopts the same offset direction as the innermost level, and the offset amount is determined independently.
6. The intelligent obstacle avoidance layout method for shipbuilding according to claim 4, characterized in that, The clustering of the lead attachment points marked on each bubble includes: Initial cluster centers are selected using a probability distribution, and clustering iterations are performed. Starting from the initial number of clusters, determine whether the maximum radius of each labeled cluster exceeds a preset distance threshold; The label clusters whose maximum radius exceeds the preset distance threshold are split into two sub-clusters and re-clustered until the maximum radius of all label clusters does not exceed the preset distance threshold or the maximum number of clusters is reached.
7. The intelligent obstacle avoidance layout method for shipbuilding according to claim 4, characterized in that, The step of searching for the location of bubble labels within each label cluster includes: when the number of bubble labels within a label cluster is within a preset range, sequentially traversing the candidate locations for each bubble label to expand the path, retaining several paths with the highest scores at each step, and finally selecting the path scheme with the highest total score as the layout result of the label cluster.
8. The intelligent obstacle avoidance layout method for shipbuilding according to claim 1, characterized in that, During the avoidance location search process, the calculation of the score for the candidate placement location includes: Query the spatial index to obtain collision objects that have spatial intersection with the candidate placement location; Determine the corresponding deduction weight based on the type of the collision object, and accumulate the deduction value of each collision object; The angle deduction value is determined based on the lead angle deviation and lead folding state corresponding to the candidate placement position; The final score for the candidate placement position is obtained by subtracting the accumulated collision deduction and angle deduction from the initial score.
9. The intelligent obstacle avoidance layout method for shipbuilding according to claim 1, characterized in that, The scene configuration parameters include at least one of the following: visual parameters, search step size parameters, maximum number of iterations parameters, deduction weight parameters for various collisions, and scoring threshold parameters; among the scene configuration parameters corresponding to different process stages, the deduction weight parameters and the maximum number of iterations parameters are different.
10. A labeled intelligent obstacle avoidance layout system for shipbuilding, characterized in that, include: The module includes a projection transformation module, a scene configuration module, a spatial indexing module, an obstacle avoidance processing module, and an output module. The projection transformation module is used to obtain the object to be annotated and the projection parameters in the three-dimensional scene, project the object to be annotated onto the two-dimensional drawing space, and generate several annotated objects and corresponding model entity objects. The scenario configuration module is used to load scenario configuration parameters that match the current process stage; The spatial index module is used to construct spatial indexes for the labeled objects and the model entity objects in the two-dimensional drawing space; The avoidance processing module is used to search for avoidance positions for each type of annotation object according to the scene configuration parameters, and move each annotation object from its initial position to the target placement position, so that the overlap rate of each annotation object in the two-dimensional drawing space meets the preset conditions. The output module is used to output two-dimensional engineering drawings after the avoidance process.
