A method and apparatus for positioning a drawing
By identifying and matching the intersection points of common axes in drawings, constructing bounding boxes, and calculating axis number similarity, the problem of manual intervention required for drawing positioning is solved, achieving automated positioning and improving accuracy and efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GLODON CO LTD
- Filing Date
- 2022-09-21
- Publication Date
- 2026-07-03
Smart Images

Figure CN117788559B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automatic processing technology for architectural drawings, and specifically to a drawing positioning method and apparatus. Background Technology
[0002] When using engineering quantity calculation software, users need to draw modeling elements based on the components indicated in the drawings. Typically, the detailed dimensions and relative positions of components in the drawings are indicated using axes. To accurately calculate quantities and facilitate subsequent checks, the CAD drawings, which have been divided into sub-drawings, need to be aligned using the axis grid within the engineering quantity calculation software, and scaled according to the drawing ratio of each sub-drawing.
[0003] In some related technologies, positioning reference points in drawings need to be determined through manual annotation, and then the offsets and scaling ratios between CAD drawings are calculated based on these reference points. This process requires staff to manually traverse all the sub-drawings requiring positioning within the entire set of drawings and annotate the positioning reference points one by one. Therefore, drawing positioning cannot yet be fully automated. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a drawing positioning method and apparatus that can automatically position drawings.
[0005] This invention provides a drawing positioning method, wherein a first drawing contains a first region, and a second drawing contains a second region with the same structure as the first region; the method includes:
[0006] Identify common axes that exist in both the first region and the second region, and determine the intersection point of the common axes obtained by their intersection;
[0007] Based on the distribution of the common axis intersection points in the first and second drawings, the common axis intersection points in the first and second drawings are matched; and
[0008] Based on the location information of the intersection point of the successfully matched common axis in the first drawing and the second drawing, the adjustment parameters between the first drawing and the second drawing are determined, and the first drawing and the second drawing are positioned based on the adjustment parameters.
[0009] Based on the distribution of common axis intersection points in the first and second drawings, the common axis intersection points in the first and second drawings are matched. Based on the position information of the successfully matched common axis intersection points in the first and second drawings, the adjustment parameters between the first and second drawings can be determined. This achieves the purpose of automatic drawing positioning.
[0010] In some embodiments, matching the intersection points of common axes in the first drawing and the intersection points of common axes in the second drawing includes:
[0011] Construct a first bounding box for the intersection of the common axes in the first drawing, and construct a second bounding box for the intersection of the common axes in the second drawing;
[0012] Determine the first position of the intersection point of the common axes in the first drawing relative to the first bounding box, and the second position of the intersection point of the common axes in the second drawing relative to the second bounding box;
[0013] Calculate the positional similarity between the first position and the second position, and based on the calculated positional similarity, match the intersection points of the common axes in the first drawing and the intersection points of the common axes in the second drawing.
[0014] Matching the intersection points of common axes in the first drawing and the intersection points of common axes in the second drawing based on the position of the intersection points of common axes relative to the bounding box can simplify the matching process and improve matching accuracy.
[0015] In some embodiments, the method further includes:
[0016] Obtain the first axis number information of the intersection point of the common axis lines in the first drawing, and obtain the second axis number information of the intersection point of the common axis lines in the second drawing;
[0017] Calculate the axis number similarity between the first axis number information and the second axis number information, and match the intersection points of common axes in the first drawing and the second drawing based on the axis number similarity.
[0018] Adding axis number similarity calculation during the matching process of common axis intersections can improve the accuracy of drawing positioning.
[0019] In some embodiments, matching the intersection points of common axes in the first drawing and the intersection points of common axes in the second drawing includes:
[0020] Based on the positional similarity and the axis number similarity, weights are generated for the intersection points of common axes in the first drawing and the second drawing, and the intersection points of common axes in the first drawing and the second drawing are matched based on the weights.
[0021] By using weights derived from positional similarity and axis number similarity to match the intersection points of common axes in the first drawing and the second drawing, the matching results can be made more accurate.
[0022] In some embodiments, calculating the positional similarity between the first position and the second position includes:
[0023] Determine the first and second positions in the first drawing, and determine the second position in the second drawing;
[0024] In the first drawing, a first direction vector pointing from the first position to the first reference position is determined, and in the second drawing, a second direction vector pointing from the second position to the second reference position is determined;
[0025] Calculate the similarity between the first direction vector and the second direction vector to calculate the positional similarity between the first position and the second position.
[0026] Calculating positional similarity by using the similarity of direction vectors simplifies the calculation process.
[0027] In some embodiments, the adjustment parameter includes an offset;
[0028] Determining the adjustment parameters between the first drawing and the second drawing includes:
[0029] Based on the position information of the intersection point of each successfully matched common axis in the first drawing and the second drawing, the offset between the first drawing and the second drawing is determined respectively, and a vote is taken on each offset;
[0030] The offset with the highest vote is used as the offset between the first drawing and the second drawing.
[0031] The adjustment parameter with the highest vote is more accurate and can improve the positioning accuracy of the drawing.
[0032] In some embodiments, before determining the intersection point of the common axes, the method further includes performing the following operations for the first drawing and the second drawing respectively:
[0033] Identify axis entities in the drawing, each axis entity representing an axis number circle in the drawing and the axis of that axis number circle;
[0034] Traverse the axis entities and divide the axis entities with intersecting relationships into an axis cluster;
[0035] The axis cluster with the most axis entities is taken as the target axis cluster, and the intersection points of the axes within the target axis cluster are determined to obtain axis intersection point entities. The common axis intersection points are determined based on the axis intersection point entities of the first drawing and the second drawing.
[0036] In this way, the intersection of common axes can be identified through program code, improving the feasibility of automatic drawing positioning.
[0037] In some embodiments, determining the intersection points of the axes within the target axis cluster includes:
[0038] Traverse the axis entities within the target axis cluster. For any two axis entities that intersect, generate the axis intersection point of the two axis entities and store the position information of the axis intersection point in the drawing and the axis number corresponding to the axis intersection point.
[0039] By calculating the intersection points of the axes pairwise, the problem of missing intersection points can be prevented, and the calculation process is relatively simple.
[0040] In some embodiments, after generating the intersection of the axes, the method further includes:
[0041] Among the obtained axis intersections, those with the same position information are merged into one axis intersection, and the axis number corresponding to each axis intersection before merging is used as the axis number corresponding to the merged axis intersection.
[0042] In this way, duplicate axis intersections can be removed, making the generated axis intersections more accurate and avoiding the problem of increased computation caused by duplicate axis intersections.
[0043] In some embodiments, dividing axis entities with intersecting axes into an axis cluster includes:
[0044] Each axis cluster is initially divided into an axis entity;
[0045] For any given axis cluster, traverse the other axis clusters outside the given axis cluster in sequence. If there is an axis entity in the other axis cluster that intersects with the axis entity in the given axis cluster, assign the corresponding axis entity in the other axis cluster to the given axis cluster, and delete the axis entity assigned to the given axis cluster from the other axis cluster.
[0046] Clustering is used to find axis entities that have intersecting relationships, and the search results are relatively accurate.
[0047] In some embodiments, after positioning the first drawing and the second drawing based on the adjustment parameters, the method further includes:
[0048] In the axis intersection entities of the first drawing and the second drawing, the proportion of axis intersections with the same position information is determined, and the accuracy of drawing positioning is determined based on the proportion.
[0049] This enables automatic checking of positioning results, reducing the workload of manual inspection.
[0050] In another aspect, the present invention provides a drawing positioning device, which includes a processor and a memory. The memory is used to store a computer program, which, when executed by the processor, implements the method described above.
[0051] In another aspect, the present invention provides a computer-readable storage medium for storing a computer program that, when executed by a processor, implements the method described above. Attached Figure Description
[0052] The features and advantages of the invention will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the invention in any way. In the drawings:
[0053] Figure 1 A partial schematic diagram of an architectural design drawing provided in one embodiment of this application is shown;
[0054] Figure 2 Is with Figure 1 A partial schematic diagram of another architectural design drawing that accompanies the architectural design drawings in the document;
[0055] Figure 3 A flowchart illustrating an embodiment of the axis intersection entity recognition method provided in this application is shown.
[0056] Figure 4 This illustration shows a graphical diagram obtained after recognizing the axis number circles in a drawing according to an embodiment of this application;
[0057] Figure 5 A schematic diagram of an axis provided in one embodiment of this application is shown;
[0058] Figure 6 To and Figure 5 A schematic diagram of another axis, different from the one in the diagram;
[0059] Figure 7 To Figure 4 The graphical schematic diagram obtained after identifying the axis entities in the drawing;
[0060] Figure 8 To Figure 7 A graphical schematic diagram obtained by dividing the drawings into axis clusters;
[0061] Figure 9 To Figure 8 The graphical diagram obtained after calculating the intersection points of the drawings;
[0062] Figure 10A schematic flowchart of a drawing positioning method provided in one embodiment of this application is shown;
[0063] Figure 11 A schematic diagram of a first drawing provided in one embodiment of this application is shown;
[0064] Figure 12 A schematic diagram of a second drawing provided in one embodiment of this application is shown;
[0065] Figure 13 An embodiment of this application provides a drawing positioning device. Detailed Implementation
[0066] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0067] In architectural design drawings, axes, also known as positioning axes, are typically used to determine the position or elevation of major components. For multiple drawings within the same set of architectural design drawings, due to differences in drawing scale and grid range, positioning operations are necessary. Specifically, this involves positioning axes with the same axis number on different drawings, adjusting their relative positions and spacing to be consistent.
[0068] For easier understanding, please refer to Figure 1 and Figure 2 . Figure 1 This is a partial schematic diagram of an architectural design drawing provided for one embodiment of this application. Figure 2 Is with Figure 1 A partial schematic diagram of another architectural design drawing that accompanies the architectural design drawings in the document. Figure 1 and Figure 2 In design drawings, the circles around the edges are called axis number circles, the numbers inside the axis number circles are called axis numbers, and the line segments connecting to the axis number circles are called axis lines. Axis numbers can be letters or numbers. Typically, axis numbers are represented by letters in the vertical direction of the drawing, and by numbers in the horizontal direction. Axis lines can be straight lines or curves. Figure 2 and Figure 1In architectural design drawings, there are areas with the same grid structure, meaning there are axes with the same axis numbers (axis numbers A, B, C, 1, 2). However, because the two drawings are drawn at different scales, a positioning operation is required between the two drawings. Currently, drawing positioning requires manual intervention and cannot be automated.
[0069] Therefore, this application provides a drawing positioning method that can automatically position drawings. This drawing positioning method can be applied to industrial drafting software or to electronic devices running such software. The electronic device may include laptops, desktop computers, smartphones, tablets, etc.
[0070] In some embodiments, the drawing positioning method of this application positions the drawing based on the axis intersection points of the drawing. The axis intersection points can represent the intersection points of the axes of the main grid in the drawing. Before executing the drawing positioning method, the following operations can be performed on each drawing to determine the axis intersection points.
[0071] Let's take one of the drawings as an example. Please refer to [link / reference]. Figure 3 This is a flowchart illustrating a method for identifying axis intersection entities according to an embodiment of this application. The axis intersection entity identification method and the drawing positioning method can be applied to the same industrial drafting software, or to an electronic device running the industrial drafting software. The axis intersection entity identification method includes steps S31 to S33.
[0072] Step S31: Identify axis entities in the drawing. Each axis entity represents an axis number circle in the drawing and the axis of that axis number circle.
[0073] In some embodiments, when identifying the axis entity, the axis number rings in the drawing can be identified first. Then, based on the identified axis number rings, the axes connected to the axis number rings can be identified. Finally, the identified axis number rings and the axes connected to the axis number rings are combined to obtain the axis entity. The following will explain each step separately.
[0074] Axis number ring recognition:
[0075] In some embodiments, the axis number circle is composed of an arc. When identifying the axis number circle, the arc in the drawing can be identified first. For architectural design drawings, an arc can be composed of one or more two-dimensional curves. Therefore, the data elements of the two-dimensional curves can be extracted from the data elements of the architectural design drawings, and the bounding boxes of the two-dimensional curves can be calculated. Then, two-dimensional curves with intersecting bounding boxes are grouped into a cluster. Finally, the two-dimensional curves within each cluster are merged pairwise according to their intersection relationships (merging two intersecting two-dimensional curves into one). Thus, based on each cluster of two-dimensional curves, an arc can ultimately be obtained.
[0076] In some embodiments, after obtaining the arc, the arc can be checked and filtered according to the following rules:
[0077] Check if the arc is a closed arc. If yes, proceed to the next filtering step. If not, discard the arc.
[0078] Based on the bounding boxes of all text elements in the drawing, check if the diameter of the arc is greater than the average height of those bounding boxes. If yes, proceed to the next filtering step; otherwise, discard the arc.
[0079] Check if the arc contains a text element. If yes, proceed to the next filtering step; otherwise, remove the arc. In some embodiments, the arc's bounding box intersects with the text element's bounding box, and the text element is located at the center of the arc, indicating that the arc contains a text element. The text description in this text element is a text description that matches the arc, i.e., the axis number.
[0080] Check if the arc connects to the axis. If yes, determine that the arc is an axis number circle; otherwise, discard the arc. In some embodiments, the bounding box of the arc intersects the bounding box of a straight line or curve, and the endpoint of the straight line or curve is located on the arc, which can determine that the arc has a connected axis.
[0081] In some embodiments, after selecting the axle number circles according to the above rules, the axle number circles can be stored as axle number circle entities according to a predefined data structure. The axle number circle entity includes axle number circle information such as the center position, radius of the arc, and text description (i.e., axle number). In the program code, the axle number circle entity is used to represent the axle number circle. Please refer to [link to relevant documentation]. Figure 4 This is a graphical schematic diagram obtained by identifying the axis number circle in the drawing, which is an embodiment of this application. Figure 4 In this system, each axis number circle corresponds to an axis number circle entity. Each axis number circle entity stores the center position, radius of the arc, and text description of the corresponding axis number circle.
[0082] In this way, the identification of the axle number ring is completed.
[0083] Axis identification:
[0084] See also Figure 5 and Figure 6 . Figure 5 This is a schematic diagram of an axis provided for one embodiment of this application. Figure 6 To and Figure 5 A schematic diagram of another axis, different from the one shown in the diagram. (Through...) Figure 5 and Figure 6As can be seen, an axis line can include one or two line segments. The line segment directly connected to the axis number circle can be called the initial segment of the axis line. The line segment not connected to the axis number circle but connected to one end of the initial segment can be called the secondary segment of the axis line.
[0085] In some embodiments, the identified axis number circle can be used as a starting point to traverse the drawing data and check if there are any line segments (including straight lines or curves) whose bounding boxes intersect with the bounding box of the axis number circle, and one endpoint of the line segment lies on the arc of the axis number circle. If such line segments exist, the longest line segment is selected as the initial axis line, and other line segments on the arc of the axis number circle are discarded. Typically, these discarded line segments can be burr-like line segments on the axis number circle.
[0086] In some embodiments, based on the selected initial axis segment, it can be determined whether a secondary axis segment exists. If a secondary axis segment exists, it means that the axis is composed of the initial axis segment and the secondary axis segment; if no secondary axis segment exists, it means that the axis is composed only of the initial axis segment.
[0087] In some embodiments, the existence of a secondary axis segment can be determined by judging whether the length of the initial axis segment exceeds a length threshold. Specifically, if the length of the initial axis segment exceeds the length threshold, it indicates that the axis does not have a secondary axis segment and is composed only of the initial axis segment; if the length of the initial axis segment does not exceed the length threshold, it indicates that the axis has a secondary axis segment and is composed of both the initial and secondary axis segments. The length threshold can be determined based on the average height of all text in the drawing. Specifically, it can be an integer multiple of the average text height, for example, 3 to 5 times the average text height.
[0088] In some embodiments, when the axis is determined to include a secondary axis, the segment of the initial axis that is not connected to the axis number circle can be taken as the starting endpoint. Using the principle of bounding box intersection, all line segments that intersect with the starting endpoint are selected, and among the selected line segments, the line segments that meet the following conditions are determined as the secondary axis:
[0089] If the line segment is a curve, the curve and the axis of the initial segment are at the same center.
[0090] The line segment is separate from the arc of the axis number circle.
[0091] The length of the line segment is greater than the length of the initial axis segment.
[0092] In this way, the axis can be identified.
[0093] In some embodiments, after identifying the axis, the axis can be extended in a direction away from the axis number circle to a target line segment in the drawing. The target line segment can be the line segment in the drawing that is collinear with the axis and furthest from the axis number circle. Specifically, if the axis only includes an initial axis segment, the initial axis segment is extended in a direction away from the axis number circle to the target line segment in the drawing; if the axis includes an initial axis segment and a secondary axis segment, the secondary axis segment is extended in a direction away from the axis number circle to the target line segment in the drawing. If the axis is a curve, when extending the axis in a direction away from the axis number circle, it is also necessary to ensure that the extended curve is concentric with the axis.
[0094] In some embodiments, after extending the axis to the target line segment in the drawing, the target line segment and the extended axis are merged to obtain a new axis with an axis number circle. Then, the axis number circle and the new axis with the axis number circle are combined to obtain an axis entity. Similar to the axis number circle entity described above, the axis entity is used to represent an axis number circle and its axis in the program code. The axis entity can store attribute information of the axis number circle and the axis. Attribute information may include, but is not limited to, the center position, radius of the arc, and text description (i.e., axis number) of the axis number circle; and the position information of the axis. Based on this attribute information, an axis number circle and its axis can be determined in the drawing.
[0095] See also Figure 7 In order to Figure 4 The graphical schematic diagram is obtained by performing axis entity recognition on the drawings. Figure 7 In this context, a ring with a specific axis number and its axis line correspond to a single axis entity. From... Figure 7 As can be seen, for example, for the axis circle with axis number 1 and the axis of that axis circle, two identical axis entities will be generated. Therefore, after the axis entities are identified, duplicate axis entities can be removed. For multiple identical axis entities, only one axis entity can be kept, and the others can be deleted.
[0096] Step S32: Traverse the axis entities and divide the axis entities that have intersecting relationships into an axis cluster.
[0097] In some embodiments, for multiple axis entities, if any one of the multiple axis entities intersects with at least one other axis entity, then the multiple axis entities have an intersection relationship and can be classified into an axis cluster. For example, axis entities A, B, and C, where axis entity A intersects with axis entity B, and axis entity B intersects with axis entity C, then axis entities A, B, and C have an intersection relationship and can be classified into an axis cluster. This application provides a clustering method to find such axis entities with intersection relationships.
[0098] In some embodiments, each axis cluster can be initially assigned an axis entity. The axis entities in each axis cluster can be different. For any axis cluster, other axis clusters outside this cluster are traversed sequentially. If an axis entity in another axis cluster intersects with an axis entity in this cluster, the corresponding axis entity in the other cluster is assigned to this axis cluster, and the axis entity assigned to this cluster is deleted from the other axis clusters. Using clustering to find intersecting axis entities yields relatively accurate results. Figure 7 The following explanation uses axis entities numbered E, F, 8, 9, 2, and A as examples. In the following description, these axis entities will be referred to as axis entity E, axis entity F, axis entity 8, axis entity 9, axis entity 2, and axis entity A, respectively. First, these axis entities are divided into different axis clusters, serving as the initial axis entities for each cluster. Table 1 lists the initial correspondence between axis entities and axis clusters.
[0099] Table 1 Initial Correspondence between Axis Entities and Axis Clusters
[0100] Axis entity Axis cluster Axis Entity E Axis cluster E Axis Entity F Axis cluster F Axis Entity 8 Axis cluster 8 Axis Entity 9 Axis cluster 9 Axis Entity 2 Axis Cluster 2 Axis Entity A Axis cluster A
[0101] First, for axis entity E within axis cluster E, traverse the axis entities in other axis clusters. (Refer to the relevant documentation.) Figure 7 If the axis entities E within axis cluster E intersect with the axis entities in axis clusters 8 and 9, then axis entities 8 and 9 in axis cluster 8 are assigned to axis cluster E, and the axis entities in axis clusters 8 and 9 are deleted. At this point, axis clusters 8 and 9 no longer contain axis entities, and in subsequent traversals, axis clusters 8 and 9 can be filtered out. After the first traversal and axis entity merging, Table 2 lists the new correspondence between axis entities and axis clusters.
[0102] Table 2 shows the initial correspondence between axis entities and axis clusters after the first traversal.
[0103] Axis entity Axis cluster Axis Entity E, Axis Entity 8, Axis Entity 9 Axis cluster E, Axis Entity F Axis cluster F Axis Entity 2 Axis Cluster 2 Axis Entity A Axis cluster A
[0104] The second traversal can be performed on axis entities F within axis cluster F, and then on axis entities in other axis clusters. (See also...) Figure 7It can be seen that axis entity F intersects with axis entities 8 and 9 in axis cluster E, and axis entities 8 and 9 also intersect with axis entity E. Therefore, axis entities E, 8, 9, and F intersect. At this point, axis entities E, 8, and 9 can be assigned to axis cluster F, and axis entities E, 8, and 9 can be deleted from axis cluster E. After the second traversal and axis entity merging, Table 3 lists the new correspondence between axis entities and axis clusters.
[0105] Table 3 shows the initial correspondence between axis entities and axis clusters after the second traversal.
[0106] Axis entity Axis cluster Axis entity F, axis entity E, axis entity 8, axis entity 9 Axis cluster F Axis Entity 2 Axis Cluster 2 Axis Entity A Axis cluster A
[0107] The third traversal can be performed on axis entity 2 within axis cluster 2, and then on axis entities in other axis clusters. (See also...) Figure 7 It can be seen that axis entity 2 does not intersect with any axis entity in axis cluster F. Therefore, axis entity 2 and axis entities in axis cluster F cannot be assigned to the same axis cluster. However, axis entity 2 intersects with axis entity A. Therefore, axis entity A can be assigned to axis cluster 2, and axis entity A can be deleted from axis cluster A. After the third traversal and axis entity merging, Table 4 lists the correspondence between the new axis entities and axis clusters.
[0108] Table 4 shows the initial correspondence between axis entities and axis clusters after the third traversal.
[0109] Axis entity Axis cluster Axis entity F, axis entity E, axis entity 8, axis entity 9 Axis cluster F Axis Entity 2, Axis Entity A Axis Cluster 2
[0110] After traversal, the axis entities in axis cluster 2 and axis cluster F no longer have an intersection relationship, and axis cluster F and axis cluster 2 are independent axis clusters.
[0111] This completes the division of the axis cluster. See also... Figure 8 In order to Figure 7 The graphical schematic diagram obtained by dividing the drawings into axis clusters. Figure 8 In the diagram, the meshes corresponding to thick lines and the meshes corresponding to thin lines belong to different axis clusters.
[0112] In some embodiments, each axis cluster can also be stored as an axis cluster entity. Each axis cluster entity can include axis entity information within the axis cluster, such as axis number circle information and axis position corresponding to each axis entity.
[0113] Step S33: Select the axis cluster with the most axis entities as the target axis cluster, and determine the intersection points of the axes within the target axis cluster to obtain the axis intersection point entities.
[0114] In some embodiments, for a given drawing, the main grid contains the most axis entities. The axis cluster with the most axis entities is designated as the target axis cluster, indicating that the target axis cluster corresponds to the axis cluster in the main grid of the drawing. The target axis cluster includes the axis entities from the main grid. Figure 8 For example, the mesh corresponding to the thin lines is the main axis mesh of the drawing.
[0115] In some embodiments, after determining the target axis cluster, other axis clusters can be deleted, and the axis entities within the target axis cluster can be traversed. For any two axis entities whose axes intersect, the intersection point of the two axis entities is generated, and the position information of the intersection point in the drawing and the corresponding axis number are stored. The position information of the intersection point includes its coordinates in the drawing. Please refer to [link to relevant documentation]. Figure 9 In order to Figure 8 The graphical diagram is obtained by calculating the intersection points of the drawings. Figure 9 In the diagram, a small black dot represents an intersection point of axes. The axis number corresponding to the intersection point refers to the axis number of the axis on which the intersection point is located. For example, the axis number corresponding to the intersection point 'a' is 1 and A. Calculating the intersection points of axes pairwise by the axis entities can prevent the problem of missing intersection points, and the calculation process is relatively simple.
[0116] In some embodiments, the calculation of axis intersections is performed pairwise between axis entities, which may result in the generation of axis intersections with the same positional information. For example... Figure 9 In the diagram, the intersection of axes 5 and 4 results in intersection point aa. The intersection of axes 4 and A results in intersection point bb, and the intersection of axes 5 and A results in intersection point cc. These are the same intersection point (i.e., located in the same position). Therefore, a deduplication operation can be performed on the generated intersection points. Specifically, intersection points with the same positional information are merged into one intersection point, and the axis numbers corresponding to the original intersection points are used as the axis numbers of the merged intersection point. Taking the intersection points aa, bb, and cc as an example, deduplication can be achieved by merging intersection points aa, bb, and cc into one intersection point dd, and using the axis numbers corresponding to intersection points aa, bb, and cc as the axis numbers corresponding to the merged intersection point dd. That is, intersection point dd corresponds to axis numbers 5, 4, and A. This removes duplicate intersection points, making the generated intersection points more accurate and avoiding the increased computational burden caused by duplicate intersection points.
[0117] In some embodiments, an axis intersection entity can be generated based on the deduplicated axis intersections. The axis intersection entity can store information about each axis intersection in the target axis cluster, including the position information of the axis intersection, the axis number corresponding to the axis intersection, etc.
[0118] In some embodiments, after performing the operations in steps S31 to S33 for each drawing to be located, the axis intersection point entity can be determined for each drawing. It is understood that different drawings may have different corresponding axis intersection point entities.
[0119] In some embodiments, a reference drawing can be first determined among the drawings to be positioned based on the intersection points of the axes of each drawing to be positioned. Specifically, the drawing to be positioned with the most intersection points can be used as the reference drawing, and other drawings to be positioned are adjusted based on the reference drawing to achieve positioning between the drawings. Here, adjustment can refer to scaling or offsetting other drawings to be positioned based on the reference drawing.
[0120] Please see Figure 10 This is a schematic flowchart illustrating a drawing positioning method provided in one embodiment of this application. The drawing positioning method can be used to position a first drawing and a second drawing, wherein one of the first and second drawings is a reference drawing, and the other drawing is adjusted based on the reference drawing. The first drawing contains a first region, and the second drawing contains a second region with the same structure as the first region. Here, "same structure" means that the first and second regions have the same grid structure. The first region can be at least a portion of the main grid in the first drawing, and the second region can be at least a portion of the main grid in the second drawing. In the following description, it is assumed that the first drawing is the reference drawing. The drawing positioning method includes steps S11 to S13.
[0121] Step S11: Identify the common axis that exists in both the first and second regions, and determine the intersection point of the common axis obtained by the intersection of the common axes.
[0122] In some embodiments, the common axis existing in both the first and second regions is the axis with the same axis number in both regions. The common axis and its intersection point can be determined based on the axis intersection point entities of the first and second drawings. Specifically, the axis numbers with the same axis number can be filtered from the axis intersection point entities of the first and second drawings, and the axes corresponding to these common axis numbers are taken as the common axis existing in both the first and second regions. Then, the axis intersection point obtained by intersecting these common axes is taken as the common axis intersection point. Here, the intersection of common axes in the first region yields the corresponding common axis intersection point in the first drawing; the intersection of common axes in the second region yields the corresponding common axis intersection point in the second drawing. Thus, by storing the position information and corresponding axis number of each axis intersection point in the target axis cluster through the axis intersection point entities, and then filtering out axis intersection point entities with the same axis number from the axis intersection point entities, the common axis intersection points can be identified through program code, improving the feasibility of automatic drawing positioning.
[0123] Step S12: Match the common axis intersection points in the first drawing and the common axis intersection points in the second drawing according to the distribution of the common axis intersection points in the first drawing and the second drawing.
[0124] In some embodiments, the distribution of the intersection points of the common axes in the first drawing may be the same as or similar to the distribution of the intersection points of the common axes in the second drawing. See also Figure 11 and Figure 12 . Figure 11 A schematic diagram of a first drawing provided for one embodiment of this application. Figure 12 This is a schematic diagram of a second drawing provided for one embodiment of this application. The first drawing can be a reference drawing. Taking the intersection points a and b of the common axis as an example, the distance and coordinates of the intersection points a and b in the first drawing are different from those in the second drawing. However, in both drawings, the intersection point b is located to the lower right of the intersection point a. That is, the distribution of the intersection points a and b in the first drawing is the same as their distribution in the second drawing. Based on this distribution relationship, the intersection points of the common axis in corresponding positions in the first and second drawings can be matched. For example, the intersection point a in the first drawing and the intersection point a in the second drawing can be matched. Therefore, this application provides a method for matching the intersection points of the common axis in the first drawing and the intersection points of the common axis in the second drawing.
[0125] In some embodiments, a first bounding box can be constructed for the intersection points of common axes in the first drawing, and a second bounding box can be constructed for the intersection points of common axes in the second drawing. Both the first and second bounding boxes can be rectangular bounding boxes. For any pair of matching intersection points of common axes in the first and second drawings, the position of the intersection point in the first drawing relative to the first bounding box can be the same as or similar to the position of the intersection point in the second drawing relative to the second bounding box. For example, both may be located in the middle of the bounding box. Therefore, after constructing the bounding boxes, a first position of the intersection point of common axes in the first drawing relative to the first bounding box and a second position of the intersection point in the second drawing relative to the second bounding box can be determined. Then, the positional similarity between the first and second positions is calculated, and based on the calculated positional similarity, the intersection points of common axes in the first and second drawings are matched. Specifically, the value of the positional similarity reflects the degree of similarity between the first and second positions. The higher the similarity between the first and second positions, the larger the positional similarity value can be, and vice versa. For example, the intersection point 'c' of shared axes in the first drawing and the intersection point 'c' of shared axes in the second drawing are both located near the middle of the bounding box, and their positions are relatively similar. Therefore, the similarity value between these two intersection points can be high. However, for the intersection point 'a' of shared axes in the first drawing and the intersection point 'c' of shared axes in the second drawing, the intersection point 'a' is located at the upper left corner of the bounding box, while the intersection point 'c' is located in the middle of the bounding box. The two positions differ significantly, so the similarity value between these two intersection points can be low. Matching the intersection points of shared axes in the first and second drawings based on their positions relative to the bounding box simplifies the matching process and improves matching accuracy.
[0126] Furthermore, this application provides a method for calculating positional similarity. Specifically, a first reference position is determined in a first drawing, and a second reference position is determined in a second drawing. Then, a first direction vector pointing from the first position to the first reference position is determined in the first drawing, and a second direction vector pointing from the second position to the second reference position is determined in the second drawing. Finally, the similarity between the first direction vector and the second direction vector is calculated to determine the positional similarity between the first position and the second position.
[0127] In some embodiments, the first reference position and the second reference position can be corresponding positions in the first and second drawings. The relative positional relationship between the first reference position and the first bounding box is the same as the relative positional relationship between the second reference position and the second bounding box. For example, the first reference position can be located in the middle of the first bounding box, and the second reference position can be located in the middle of the second bounding box. In the embodiment shown in this application, the first reference position is located at the lower left and upper right corners of the first bounding box, and the second reference position is located at the lower left and upper right corners of the second bounding box.
[0128] In some embodiments, if the first position of the intersection point of the common axes in the first drawing relative to the first bounding box is the same as the second position of the intersection point of the common axes in the second drawing relative to the second bounding box, then the first direction vector pointing from the first position to the first reference position and the second direction vector pointing from the second position to the second reference position should also be the same. For example, the direction vector of the intersection point c of the common axes in the first drawing pointing to the lower left corner of the first bounding box is the same as the direction vector of the intersection point c of the common axes in the second drawing pointing to the lower left corner of the second bounding box. Conversely, if the first position of the intersection point of the common axes in the first drawing relative to the first bounding box is different from the second position of the intersection point c of the common axes in the second drawing relative to the second bounding box, then the first direction vector of the first position pointing to the first reference position and the second direction vector pointing from the second position to the second reference position should also be different. For example, the direction vector of the intersection point c of the common axes in the first drawing pointing to the lower left corner of the first bounding box is different from the direction vector of the intersection point b of the common axes in the second drawing pointing to the lower left corner of the second bounding box. Based on this, the positional similarity between the first position and the second position can be calculated by calculating the similarity between the first direction vector and the second direction vector. Specifically, the closer the dot product of two direction vectors is to 1, the greater the difference between the two direction vectors, the greater the difference between the first and second positions, the smaller the positional similarity value between the first and second positions, and the lower the matching degree between the intersection points of the common axis at the first position and the common axis at the second position. Conversely, the closer the dot product of two direction vectors is to 0, the smaller the difference between the two direction vectors, the smaller the difference between the first and second positions, the greater the positional similarity value between the first and second positions, and the higher the matching degree between the intersection points of the common axis at the first position and the common axis at the second position. Thus, by calculating positional similarity, it can be determined whether the intersection points of two common axes in the first and second drawings match. Using the similarity of direction vectors to perform positional similarity calculation simplifies the calculation process.
[0129] In some embodiments, in addition to the above-described positional similarity calculation, the drawing positioning method of this application can also obtain the first axis number information of the intersection point of the common axis lines in the first drawing, and the second axis number information of the intersection point of the common axis lines in the second drawing. Then, the axis number similarity between the first axis number information and the second axis number information is calculated, and the intersection points of the common axis lines in the first and second drawings are matched based on the axis number similarity. Generally, if the axis numbers corresponding to the two intersection points of the common axis lines in the first and second drawings are the same, it indicates that the two intersection points of the common axis lines are likely to match, and the axis number similarity value can be large, such as 1. If the axis numbers corresponding to the two intersection points of the common axis lines in the first and second drawings are not the same, it indicates that the two intersection points of the common axis lines are unlikely to match, and the axis number similarity value can be small, such as 0. By adding positional similarity calculation, the matching accuracy can be improved. For example, if the intersection point c of the common axis lines in the first drawing and the intersection point c of the common axis lines in the second drawing have the same axis number, the axis number similarity value can be 1; while the intersection point c of the common axis lines in the first drawing and the intersection point a of the common axis lines in the second drawing do not have the same axis number, the axis number similarity value can be 0. Adding axis number similarity calculation during the matching process of common axis intersections can improve the accuracy of drawing positioning.
[0130] In some embodiments, for the intersection of common axes in the first drawing and the second drawing, one of positional similarity and axis number similarity can be calculated, or both positional similarity and axis number similarity can be calculated simultaneously, and based on the calculation results, it can be determined whether the intersection of common axes in the first drawing and the second drawing matches.
[0131] In the embodiments shown in this application, both positional similarity and axis number similarity are calculated simultaneously. Based on these two similarities, the similarity of the intersection points of common axes in the two drawings is determined. Then, the intersection points of common axes in the two drawings are matched according to the similarity. The sum of the positional similarity and axis number similarity can be used as the similarity of the intersection points of common axes in the two drawings. It is understood that different weights can be set for positional similarity and axis number similarity when performing the similarity calculation; for example, the weight for positional similarity could be 60%, and the weight for axis number similarity could be 40%.
[0132] In some embodiments, for any intersection point of a common axis in the second drawing, the similarity between that intersection point and all intersection points of common axes in the first drawing can be calculated. For example, the similarity between the intersection point c of the common axis in the second drawing and the intersection points a, b, c, d... of the common axis in the first drawing can be calculated to obtain the similarity between the intersection point c and the intersection points a, b, c, d... of the common axis in the first drawing. Table 5 lists the similarity between the intersection point a of the common axis in the second drawing and the intersection points of the common axis in the first drawing.
[0133] Table 5 Similarity
[0134]
[0135] In some embodiments, weights can be generated for the intersection points of common axes in the first and second drawings based on positional similarity and axis number similarity, and the intersection points of common axes in the first and second drawings can be matched based on these weights. Specifically, the similarity obtained based on positional similarity and axis number similarity can be used as the weights for the intersection points of common axes in the first and second drawings. For example, based on Table 5 above, the weight of intersection point a of common axes in the second drawing and intersection point a of common axes in the first drawing is 3; the weight of intersection point a of common axes in the second drawing and intersection point b of common axes in the first drawing is 2.
[0136] In some embodiments, the intersection points of common axes in the first and second drawings can be matched using the KM algorithm or the Hungarian algorithm based on their weights. According to the characteristics of the KM or Hungarian algorithm, after matching, for each common axis intersection point in the second drawing, there is a matching common axis intersection point in the first drawing. Matching the common axis intersection points in the first and second drawings based on weights obtained from positional similarity and axis number similarity can make the matching results more accurate.
[0137] Step S13: Based on the position information of the intersection point of the successfully matched common axis in the first and second drawings, determine the adjustment parameters between the first and second drawings, and position the first and second drawings based on the adjustment parameters.
[0138] In some embodiments, matching pairs with similarity values greater than or equal to a threshold can be selected, and adjustment parameters between the first and second drawings can be determined based on the position information of the intersection points of the common axes in the matching pairs in the first and second drawings. The adjustment parameters between the first and second drawings may include the offset between them. The position information of the intersection points of the common axes in the first and second drawings may include the coordinates of the intersection points in the drawings. It is understood that for the intersection points of common axes in the first and second drawings, a higher similarity value indicates a more accurate match between the two intersection points, and the offset calculated based on the coordinates of these two intersection points is more accurate. If the similarity value is less than the threshold, the greater the difference between the intersection points of the common axes in the first and second drawings, the less accurate the offset calculated based on the coordinates of these two intersection points will be, thus reducing positioning accuracy.
[0139] In some embodiments, the offset may be the difference in coordinates of the intersection of matching common axes in the first and second drawings.
[0140] In some embodiments, when determining the offset between the first and second drawings, the offset between the first and second drawings can be determined based on the position information of the intersection points of each pair of successfully matched common axes in the first and second drawings, and a vote can be taken for each offset. The offset with the highest vote is then used as the offset between the first and second drawings. For example, if the offset determined based on the first, third, and sixth pairs of successfully matched axis intersections is 0.5, then the vote for offset 0.5 can be 3. If the offset determined based on the second and fourth pairs of successfully matched axis intersections is 0.4, then the vote for offset 0.4 can be 2. The offset with the highest vote is more accurate and can improve the accuracy of drawing positioning.
[0141] In some embodiments, the adjustment parameters between the first drawing and the second drawing may further include the scaling amount between the first drawing and the second drawing. Specifically, a first bounding box of the intersection points of the common axes in the first drawing can be determined based on the coordinates of the intersection points of the common axes in the first drawing; a second bounding box of the intersection points of the common axes in the second drawing can be determined based on the coordinates of the intersection points of the common axes in the second drawing; and then the scaling amount of the first drawing relative to the second drawing can be determined based on the length and width of the first bounding box and the length and width of the second bounding box.
[0142] In some embodiments, after determining the offset and scaling amount between the first drawing and the second drawing, the first drawing and the second drawing can be positioned based on the determined offset and scaling amount.
[0143] In some embodiments, after locating the first and second drawings based on offset and scaling, the proportion of axis intersection points with the same positional information can be determined within the axis intersection entities of the first and second drawings, and the accuracy of the drawing positioning can be determined based on this proportion. The positional information here can be the coordinates of the axis intersection entities. Specifically, in the axis intersection entities of the first and second drawings, the number of axis intersection points with the same coordinates and the total number of axis intersection points in each axis intersection entity are calculated. Then, the number of axis intersection points with the same coordinates is divided by the total number of axis intersection points in one of the axis intersection entities to obtain the proportion of axis intersection points with the same positional information. This achieves automatic checking of the positioning results, reducing the workload of manual checking.
[0144] In some embodiments, if the proportion of axis intersections with the same positional information is less than a threshold (e.g., 0.5), it indicates that after positioning, the coordinates of the axis intersections of the first and second drawings are less likely to coincide, resulting in lower positioning accuracy. Conversely, positioning is successful if the proportion of intersections with the same positional information is less than a threshold (e.g., 0.5).
[0145] In some embodiments of this application, based on the distribution of common axis intersection points in the first and second drawings, the common axis intersection points in the first and second drawings are matched. Based on the position information of the successfully matched common axis intersection points in the first and second drawings, adjustment parameters between the first and second drawings can be determined. This achieves automatic drawing positioning, thereby improving work efficiency and reducing the workload of manual positioning.
[0146] Please see Figure 13 This application provides a drawing positioning device according to one embodiment. The drawing positioning device includes a processor and a memory. The memory stores a computer program, which, when executed by the processor, implements the drawing positioning method described above.
[0147] The processor can be a central processing unit (CPU). It can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations thereof.
[0148] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the methods in the embodiments of this invention. The processor executes various functional applications and data processing by running the non-transitory software programs, instructions, and modules stored in the memory, thereby implementing the methods described in the above embodiments.
[0149] The memory may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created by the processor, etc. Furthermore, the memory may include high-speed random access memory and non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include memory remotely located relative to the processor, which can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0150] One embodiment of this application also provides a computer-readable storage medium for storing a computer program that, when executed by a processor, implements the above-described drawing positioning method.
[0151] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A method for locating drawings, characterized in that, The first drawing contains a first region, and the second drawing contains a second region with the same structure as the first region; the method includes: Identify common axes that exist in both the first region and the second region, and determine the intersection point of the common axes obtained by their intersection; According to the distribution of the common axis intersection points in the first and second drawings, matching the common axis intersection points in the first and second drawings includes: constructing a first bounding box for the common axis intersection points in the first drawing and constructing a second bounding box for the common axis intersection points in the second drawing; determining a first position of the common axis intersection points in the first drawing relative to the first bounding box and a second position of the common axis intersection points in the second drawing relative to the second bounding box; calculating the positional similarity between the first and second positions, and matching the common axis intersection points in the first and second drawings based on the calculated positional similarity; and Based on the location information of the intersection point of the successfully matched common axis in the first drawing and the second drawing, the adjustment parameters between the first drawing and the second drawing are determined, and the first drawing and the second drawing are positioned based on the adjustment parameters.
2. The method as described in claim 1, characterized in that, The method further includes: Obtain the first axis number information of the intersection point of the common axis lines in the first drawing, and obtain the second axis number information of the intersection point of the common axis lines in the second drawing; Calculate the axis number similarity between the first axis number information and the second axis number information, and match the intersection points of common axes in the first drawing and the second drawing based on the axis number similarity.
3. The method as described in claim 2, characterized in that, The matching of the intersection points of common axes in the first drawing and the intersection points of common axes in the second drawing includes: Based on the positional similarity and the axis number similarity, weights are generated for the intersection points of common axes in the first drawing and the second drawing, and the intersection points of common axes in the first drawing and the second drawing are matched based on the weights.
4. The method as described in claim 1, characterized in that, The calculation of the positional similarity between the first position and the second position includes: Determine a first position in the first drawing and a second position in the second drawing; In the first drawing, a first direction vector pointing from the first position to the first reference position is determined, and in the second drawing, a second direction vector pointing from the second position to the second reference position is determined; Calculate the similarity between the first direction vector and the second direction vector to calculate the positional similarity between the first position and the second position.
5. The method as described in claim 1, characterized in that, The adjustment parameters include offset; Determining the adjustment parameters between the first drawing and the second drawing includes: Based on the position information of the intersection point of each successfully matched common axis in the first drawing and the second drawing, the offset between the first drawing and the second drawing is determined respectively, and a vote is taken on each offset; The offset with the highest vote is used as the offset between the first drawing and the second drawing.
6. The method as described in claim 1, characterized in that, Before determining the intersection point of the common axis, the method further includes performing the following operations on the first drawing and the second drawing respectively: Identify axis entities in the drawing, each axis entity representing an axis number circle in the drawing and the axis of that axis number circle; Traverse the axis entities and divide the axis entities with intersecting relationships into an axis cluster; The axis cluster with the most axis entities is taken as the target axis cluster, and the intersection points of the axes within the target axis cluster are determined to obtain axis intersection point entities. The common axis intersection points are determined based on the axis intersection point entities of the first drawing and the second drawing.
7. The method as described in claim 6, characterized in that, Determining the intersection points of the axes within the target axis cluster includes: Traverse the axis entities within the target axis cluster. For any two axis entities that intersect, generate the axis intersection point of the two axis entities and store the position information of the axis intersection point in the drawing and the axis number corresponding to the axis intersection point.
8. The method as described in claim 7, characterized in that, After generating the intersection of the axes, the method further includes: Among the obtained axis intersections, those with the same position information are merged into one axis intersection, and the axis number corresponding to each axis intersection before merging is used as the axis number corresponding to the merged axis intersection.
9. The method as described in claim 6, characterized in that, The process of dividing intersecting axis entities into an axis cluster includes: Each axis cluster is initially divided into an axis entity; For any given axis cluster, traverse the other axis clusters outside the given axis cluster in sequence. If there is an axis entity in the other axis cluster that intersects with the axis entity in the given axis cluster, assign the corresponding axis entity in the other axis cluster to the given axis cluster, and delete the axis entity assigned to the given axis cluster from the other axis cluster.
10. The method as described in claim 6, characterized in that, After positioning the first drawing and the second drawing based on the adjustment parameters, the method further includes: In the axis intersection entities of the first drawing and the second drawing, the proportion of axis intersections with the same position information is determined, and the accuracy of drawing positioning is determined based on the proportion.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 10.
12. A drawing positioning device, characterized in that, The drawing positioning device includes a processor and a memory, the memory being used to store a computer program, which, when executed by the processor, implements the method as described in any one of claims 1 to 10.