Method, device and equipment for automatic cutting of CAD drawings and storage medium
Patent Information
- Application Number
- CN202510717023.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2045-05-30
AI Technical Summary
然而,前者只能提取特征明显的区域,对于多线段和重复线段等特征信息不明显的复杂实体存在遗漏现象,影响切割准确性,后者虽然具有较强的特征提取能力,但是其性能高度依赖高质量的训练数据集,在缺乏足够训练数据的情况下,切割精度会显著降低
[0018]In the technical solution provided in this disclosure, multiple target rectangles are determined based on the vertex coordinates of each line segment entity among multiple line segment entities. Since the area enclosed by each target rectangle covers part of the line segment entities among multiple line segment entities, and the area enclosed by multiple target rectangles covers multiple line segment entities, the feature information in the CAD drawing can be accurately preserved, thereby improving the accuracy of cutting.
Smart Images

Figure CN120783350B_ABST
Abstract
Description
Technical Field
[0001] The embodiments disclosed herein relate to the field of drawing cutting technology, and more specifically, to automatic cutting methods, apparatus, devices, and storage media for CAD drawings. Background Technology
[0002] CAD drawings refer to drawings created using computers and their graphics equipment to assist engineers in their work. CAD drafting is widely used in design work in various fields such as architecture, machinery, electronics, and automotive. It is used to describe and plan the design details of a project. A typical CAD drawing includes key parts such as boxes, list bars, connectors, topology diagrams, explanatory areas, and title blocks. Traditional CAD drawings are often large in content and information-dense, requiring frequent zooming and scrolling when viewing, which affects work efficiency. To more efficiently browse and process complex CAD drawings, drawing cutting technology is gradually becoming a popular solution in the industry.
[0003] Existing CAD drawing cutting technologies can be broadly categorized into two types: cutting technologies based on traditional machine learning and cutting technologies based on deep learning. Both methods extract key feature information from CAD drawings, such as regional distribution and entity types, and then cut the drawings based on this information. However, the former can only extract regions with obvious features, and it tends to miss complex entities with less obvious feature information, such as multi-line segments and repeating line segments, thus affecting cutting accuracy. While the latter has strong feature extraction capabilities, its performance is highly dependent on high-quality training datasets; without sufficient training data, cutting accuracy will significantly decrease. Summary of the Invention
[0004] The embodiments described herein provide an automatic cutting method, apparatus, device, and storage medium for CAD drawings, which can accurately cut CAD drawings and improve cutting flexibility.
[0005] Firstly, this disclosure provides an automatic cutting method for CAD drawings, including: Based on the vertex coordinates of each line segment entity in a plurality of line segment entities, multiple target rectangles are determined. The CAD drawing includes the plurality of line segment entities, and the area enclosed by each target rectangle covers a portion of the line segment entities in the plurality of line segment entities. The area enclosed by the multiple target rectangles covers the plurality of line segment entities. The vertex coordinates of the multiple target rectangles are stored and displayed, and each target rectangle corresponds to a rectangle identifier. In response to a user cutting command, the vertex coordinates of the target rectangle corresponding to the target rectangle identifier are read, and the target rectangle identifier is at least a portion of the multiple rectangle identifiers. Based on the vertex coordinates of the target rectangle corresponding to the target rectangle identifier, a clipping region is determined. Based on the user cutting command and the boundary information of the clipping region, the CAD drawing is clipped to obtain a target sub-drawing.
[0006] In some embodiments of this disclosure, reading the vertex coordinates of the target rectangle corresponding to the target rectangle identifier in response to a user cutting command includes: In response to the user's cutting command, a plurality of target rectangle identifiers are determined from the plurality of rectangle identifiers; the vertex coordinates of the target rectangle corresponding to each of the plurality of target rectangle identifiers are read.
[0007] In some embodiments of this disclosure, determining a plurality of target rectangle identifiers from the plurality of rectangle identifiers in response to the user cutting command includes: When the user cutting instruction is a general cutting instruction, all of the multiple rectangular identifiers are identified as the target rectangular identifier.
[0008] When the user cutting instruction is a first type of cutting instruction, a sub-drawing that matches the specified sub-drawing information is determined from multiple sub-drawings. The first type of cutting instruction includes the specified sub-drawing information, and the CAD drawing includes the multiple sub-drawings. Based on the sub-drawing that matches the specified sub-drawing information, the multiple target rectangle identifiers are determined from the multiple rectangle identifiers.
[0009] In some embodiments of this disclosure, determining a plurality of target rectangle identifiers from the plurality of rectangle identifiers in response to the user cutting command includes: When the user cutting instruction is a second type of cutting instruction, a sub-drawing that matches the specified sub-drawing information is determined from multiple sub-drawings. The second type of cutting instruction includes the specified sub-drawing information and specified area information. The CAD drawing includes the multiple sub-drawings. Based on the sub-drawing that matches the specified sub-drawing information, multiple first target rectangle identifiers are determined from the multiple rectangle identifiers. An area that matches the specified area information is determined from the sub-drawings that matches the specified sub-drawing information. Based on the area that matches the specified area information, at least one second target rectangle identifier is determined from the multiple first target rectangle identifiers.
[0010] In some embodiments of this disclosure, determining the clipping region based on the vertex coordinates of the target rectangle corresponding to the target rectangle identifier includes: Based on the vertex coordinates of the target rectangles corresponding to the plurality of target rectangle identifiers, the outermost rectangle is determined from the target rectangles corresponding to the plurality of target rectangle identifiers. The outermost rectangle is the target rectangle among the target rectangles corresponding to the plurality of target rectangle identifiers that is not contained by other target rectangles. Based on the vertex coordinates of the outermost rectangle, the boundary information of the clipping region is determined.
[0011] In some embodiments of this disclosure, the step of cutting the CAD drawing based on the user cutting command and the boundary information of the cutting area to obtain the target sub-drawing includes: Based on the boundary information of the clipping region, determine whether each of the multiple entity structures is located inside the clipping region. The CAD drawing includes the multiple entity structures, and the boundary information of the clipping region is the boundary information of the outermost rectangle. Extract all entity structures inside the clipping region and save all entity structures inside the clipping region as a new drawing to obtain the target sub-drawing.
[0012] In some embodiments of this disclosure, the step of cutting the CAD drawing based on the user cutting command and the boundary information of the cutting area to obtain the target sub-drawing includes: Based on the boundary information of the first clipping region, it is determined whether each of the multiple entity structures is located inside the first clipping region. The CAD drawing includes the multiple entity structures, and the boundary information of the first clipping region is the boundary information of the outermost rectangle. Based on the boundary information of the second clipping region, it is determined whether each of the multiple entity structures is located inside the second clipping region. The boundary information of the second clipping region is the boundary information of the target rectangle corresponding to the second target rectangle identifier. All entity structures located outside the second clipping region but inside the first clipping region are extracted, and all entity structures located outside the second clipping region but inside the first clipping region are saved as a new drawing to obtain the target sub-drawing.
[0013] Secondly, this disclosure provides an automatic cutting device for CAD drawings, comprising: The determination module is used to determine multiple target rectangles based on the vertex coordinates of each line segment entity among multiple line segment entities. The CAD drawing includes the multiple line segment entities, and the area enclosed by each target rectangle covers a portion of the multiple line segment entities.
[0014] A storage module is used to store the vertex coordinates of the plurality of target rectangles and display the plurality of target rectangles, wherein each target rectangle corresponds to a rectangle identifier.
[0015] The cutting module is used to respond to a user cutting command by reading the vertex coordinates of the target rectangle corresponding to the target rectangle identifier, wherein the target rectangle identifier is at least a portion of multiple rectangle identifiers; determining the clipping area based on the vertex coordinates of the target rectangle corresponding to the target rectangle identifier; and clipping the CAD drawing based on the user cutting command and the boundary information of the clipping area to obtain a target sub-drawing.
[0016] Thirdly, this disclosure provides an electronic device including a processor for executing a computer program stored in a memory, wherein the computer program, when executed by the processor, implements the steps of any of the methods provided in the first aspect.
[0017] Fourthly, this disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the methods provided in the first aspect.
[0018] In the technical solution provided in this disclosure, multiple target rectangles are determined based on the vertex coordinates of each line segment entity among multiple line segment entities. Since the area enclosed by each target rectangle covers part of the line segment entities among multiple line segment entities, and the area enclosed by multiple target rectangles covers multiple line segment entities, the feature information in the CAD drawing can be accurately preserved, thereby improving the accuracy of cutting.
[0019] By storing the vertex coordinates of multiple target rectangles and displaying multiple target rectangles, with each target rectangle corresponding to a rectangle identifier, feature information can be saved as structured data, ensuring seamless integration of cross-platform and cross-regional operations, rapid response to changes, and improving the flexibility and sharing efficiency of data management.
[0020] By responding to user cutting commands, the vertex coordinates of the target rectangle corresponding to the target rectangle identifier are read. Based on the vertex coordinates of the target rectangle corresponding to the target rectangle identifier, the cutting area is determined. The CAD drawing is then cut based on the user cutting command and the boundary information of the cutting area to obtain the target sub-drawing. Specific areas can be cut according to user needs to obtain sub-drawings with coordinates consistent with the CAD drawing. This ensures the integrity and accuracy of the drawing information, thereby improving cutting precision. It can also meet personalized needs in different scenarios, thereby improving cutting flexibility. Attached Figure Description
[0021] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings of the embodiments will be briefly described below. It should be understood that the drawings described below only relate to some embodiments of this disclosure and are not intended to limit this disclosure, wherein: Figure 1 This is a schematic CAD drawing of an optical fiber communication device provided in an embodiment of the present disclosure.
[0022] Figure 2 A schematic diagram illustrating the process of cutting CAD drawings using existing technology.
[0023] Figure 3 This is a flowchart illustrating an automatic cutting method for CAD drawings provided in an embodiment of the present disclosure.
[0024] Figure 4 This is a schematic diagram of a box-like structure provided in an embodiment of the present disclosure.
[0025] Figure 5 This is a schematic diagram of a convex polygon provided in an embodiment of this disclosure.
[0026] Figure 6 This is a schematic diagram of a target rectangle provided in an embodiment of the present disclosure.
[0027] Figure 7This is a schematic diagram of a target sub-drawing provided in an embodiment of this disclosure.
[0028] Figure 8 This is a schematic diagram of another target sub-drawing provided for an embodiment of this disclosure.
[0029] Figure 9 This is a schematic diagram of yet another target sub-drawing provided in an embodiment of the present disclosure.
[0030] Figure 10 This is a schematic diagram of the structure of an automatic cutting device for CAD drawings provided in an embodiment of this disclosure.
[0031] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the described embodiments of this disclosure without creative effort are also within the scope of protection of this disclosure.
[0033] Unless otherwise defined, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which this subject matter pertains. It will be further understood that terms such as those defined in commonly used dictionaries shall be interpreted as having meanings consistent with their meanings in the context of the specification and in the relevant art, and shall not be interpreted in an idealized or overly formal form unless otherwise explicitly defined herein. Furthermore, terms such as “first” and “second” are used only to distinguish one component (or part of a component) from another component (or another part of a component).
[0034] There are many shortcomings in the actual use of CAD drawings, especially in the browsing, positioning, and processing of drawings, where the following problems exist: (1) CAD drawings are complex and diverse, and one screen cannot display all the content. Users need to keep swiping the screen to view different areas, which is cumbersome and inefficient.
[0035] (2) CAD drawings usually cover all parts of the entire area. Staff in different positions need to check the entire drawing one by one to find the part that is relevant to them, which can easily lead to omissions or insufficient inspection, thus affecting the completion and accuracy of the work.
[0036] For example, Figure 1A schematic CAD drawing of an optical fiber communication device provided in this disclosure is shown below. Figure 1 As shown, the CAD drawing only displays four areas, which is insufficient to fully represent all the details. CAD drawings are complex and information-dense; even when zoomed in on specific areas, readability may still be limited, making viewing, analysis, and operation more difficult.
[0037] To more efficiently browse and process complex CAD drawings, drawing segmentation technology has emerged. CAD segmentation technology breaks down large drawings into multiple independent sub-drawings according to region. This not only reduces view clutter, allowing users to quickly and accurately locate the information they need and avoid missing key information, but also allows for the allocation of drawings by module according to different roles and work requirements. This enables professionals to focus only on the parts relevant to them, reducing unnecessary information interference. This approach not only improves collaboration efficiency but also reduces operational errors caused by the complexity of drawings, further optimizing engineering design and construction processes.
[0038] Currently, most CAD drawing cutting operations rely on professional software such as Autodesk CAD. However, these software programs typically require paid subscriptions and have high hardware requirements, increasing usage costs. Furthermore, when processing large drawings, users still need to frequently use zoom functions to view detailed structural information, which is cumbersome, inefficient, and highly dependent on the software.
[0039] To address these issues, more and more technologies are exploring CAD drawing cutting methods from different perspectives. By dividing complex drawings into multiple sub-drawings, users can directly view specific areas, thereby reducing reliance on specialized software and significantly improving operational efficiency. Figure 2 A process diagram illustrating the CAD drawing cutting method provided by the prior art, such as... Figure 2 As shown, the general steps of CAD drawing cutting methods include: inputting CAD drawings, preprocessing, area segmentation, and outputting sub-drawings of different areas.
[0040] Common drawing cutting techniques can be mainly divided into two categories: (1) Based on traditional machine learning algorithm cutting technology, the method first preprocesses the CAD drawing, for example, by filtering or noise reduction to remove impurities and interference information in the drawing. Then, it analyzes the information of interest in different areas of the CAD drawing, such as line segments, polygons and text, through geometric matrix and feature extraction technology, so as to extract key feature information. Finally, based on these features, the drawing is divided into multiple different areas to obtain a cutting result drawing with a clear structure.
[0041] (2) Deep learning-based cutting method: This method first performs simple preprocessing on the drawing, such as cropping and scaling, and then uses a deep learning model (such as a convolutional neural network) to adaptively learn key feature information in the CAD drawing, such as regional distribution and entity type, through a large number of high-quality training datasets. Finally, it completes intelligent regional segmentation based on the learned key feature information to obtain a cutting result drawing with a clear structure.
[0042] However, CAD drawings typically contain various types of entities, such as line segments, polygons, text, and symbols. The complexity and diversity of these entities make drawing processing difficult. Existing CAD drawing cutting techniques have the following problems when handling boundary areas such as multi-line segments, overlapping line segments, multiple texts, and hypertext boundaries: (1) Traditional machine learning algorithms can only extract regions with obvious features. For regions with indistinct features, such as multi-segment and repeating segment, there is a phenomenon of missing small regions or misjudging non-standard geometric shapes, resulting in inaccurate cutting.
[0043] (2) Although deep learning-based segmentation techniques have strong feature extraction capabilities, their performance is highly dependent on high-quality training datasets. In the absence of sufficient training data, the segmentation accuracy will decrease significantly. In addition, the poor generalization ability of learning, high computational cost, and long processing time will affect the segmentation efficiency.
[0044] (3) The application scenarios for cutting are fixed and cannot meet the personalized needs of users, resulting in poor cutting flexibility.
[0045] In view of this, this disclosure provides an automatic cutting method for CAD drawings, including determining multiple target rectangles based on the vertex coordinates of each line segment entity in multiple line segment entities, storing and displaying the multiple target rectangles, each target rectangle corresponding to a rectangle identifier, reading the vertex coordinates of the target rectangle corresponding to the target rectangle identifier in response to a user cutting command, the target rectangle identifier being at least a part of the multiple rectangle identifiers, determining the clipping region based on the vertex coordinates of the target rectangle corresponding to the target rectangle identifier, and clipping the CAD drawing based on the user cutting command and the boundary information of the clipping region to obtain a target sub-drawing.
[0046] Firstly, since the area enclosed by each target rectangle covers part of the line segment entities among multiple line segment entities, and the area enclosed by multiple target rectangles covers multiple line segment entities, the feature information in the CAD drawing can be accurately preserved, which can improve the accuracy of cutting.
[0047] Secondly, it can obtain sub-drawings with coordinates consistent with CAD drawings, which can ensure the integrity and accuracy of drawing information and improve cutting precision.
[0048] Thirdly, specific areas can be cut according to user needs, which can meet personalized needs in different scenarios and improve the flexibility of cutting.
[0049] Fourthly, feature information is stored as structured data, ensuring seamless integration across platforms and regions, rapid response to changes, and improved flexibility and efficiency in data management and sharing.
[0050] The technical solutions of this disclosure are described in detail below with reference to several specific embodiments.
[0051] Figure 3 This is a flowchart illustrating an automatic cutting method for CAD drawings provided in an embodiment of the present disclosure, as shown below. Figure 3 As shown, the specific steps of the automatic cutting method for CAD drawings include: S101, determine multiple target rectangles based on the vertex coordinates of each line segment entity in the multiple line segment entities.
[0052] For example, a CAD drawing includes multiple line segment entities, and the area enclosed by each target rectangle covers a portion of the multiple line segment entities. The area enclosed by the multiple target rectangles covers multiple line segment entities.
[0053] As a specific description of one possible implementation of S101, the following is an example: S201, determine multiple class box structures based on the vertex coordinates of each line segment entity in multiple line segment entities.
[0054] For example, a CAD drawing includes multiple line segment entities, and some of these line segment entities form a box-like structure. This box-like structure can be understood as a closed structure visually composed of multiple line segment entities, but in reality, it may be either a closed structure or a non-closed structure composed of multiple line segment entities. In other words, a box-like structure includes both closed and non-closed structures composed of multiple line segment entities. A box-like structure may contain overlapping line segment entities, different box-like structures may share a single line segment entity, and some line segment entities in different box-like structures may overlap.
[0055] Line segment entities include single-segment entities and multi-segment entities. A single-segment entity consists of two vertices: a start point and an end point. A multi-segment entity consists of multiple single-segment entities. The first single-segment entity shares a vertex with the next single-segment entity, and the last single-segment entity shares a vertex with the previous single-segment entity. When the number of single-segment entities in a multi-segment entity is greater than two, one vertex of the intermediate single-segment entity is shared with the previous single-segment entity, and the other vertex of the intermediate single-segment entity is shared with the next single-segment entity. Here, the intermediate line segment entity refers to any single-segment entity other than the first and last single-segment entities among all the single-segment entities that constitute a multi-segment entity.
[0056] As a specific description of one possible implementation of S201, the following is an example: S301, determine the length of each line segment entity based on the vertex coordinates of each line segment entity among multiple line segment entities.
[0057] For example, for a single line segment entity, based on the Euclidean algorithm, the length of the single line segment entity is determined according to its start and end coordinates. For instance, the length of the single line segment entity can be calculated using the following formula. : (1) in, The coordinates of the starting point of the single-line segment entity. These are the coordinates of the endpoint of the single-line segment entity.
[0058] For a polyline entity, based on the Euclidean algorithm, the length between all adjacent vertices in the polyline entity is determined using the coordinates of all adjacent vertices. The length of the polyline entity is then obtained by summing the lengths between all adjacent vertices. For example, the length of a polyline entity can be calculated using the following formula. : (2) in, n Let be the number of vertices of the polyline entity, and n An integer greater than or equal to 2. For the first segment in a polyline entity i The vertex coordinates of each vertex. For the first segment in a polyline entity i+ The coordinates of a single vertex.
[0059] S302, based on the length and color matrix of each line segment entity, selects multiple target line segment entities from multiple line segment entities.
[0060] For example, the line segment entity with a length greater than a preset length among multiple line segment entities is determined as the target line segment entity, and the target line segment entity is displayed based on the color matrix corresponding to the target line segment entity, thereby obtaining multiple box-like structures, wherein each box-like structure is composed of at least one target line segment entity.
[0061] For example, targeting Figure 1 The CAD drawing shown can be processed using S201 to remove unnecessary entity features such as title blocks, list bars, connectors, topology diagrams, and explanatory areas, retaining only the key areas, resulting in... Figure 4 The box-like structure shown is Figure 4 This is a schematic diagram of a box-like structure provided in an embodiment of the present disclosure.
[0062] As a specific description of another possible implementation when executing S201, the following is an example: Based on the vertex coordinates of each line segment entity among multiple line segment entities, the length of each line segment entity is determined. Line segment entities with a length greater than a preset length are identified as target line segment entities and displayed, thus obtaining a structure consisting of multiple box-like structures.
[0063] S202, determine multiple target rectangles based on the vertex set corresponding to each of the multiple box-like structures.
[0064] For example, each vertex set includes the vertices of all line segment entities contained in a box-like structure, and the region enclosed by each target rectangle covers all vertices in a vertex set.
[0065] As a specific description of one possible implementation of S202, the following is an example: S401, determine multiple convex polygons based on the vertex set corresponding to each of the multiple box-like structures.
[0066] In this context, the region enclosed by each convex polygon covers all vertices in a vertex set.
[0067] For example, a convex polygon can be the smallest convex polygon corresponding to a set of vertices, i.e., the convex hull. Based on the convex hull algorithm, the convex hull of the vertex set corresponding to each of the multiple box-like structures can be determined.
[0068] Specifically, firstly, the vertex coordinates of all line segment entities contained in each of the multiple box-like structures are extracted, thus obtaining the vertex set corresponding to each box-like structure. For example, the vertex set corresponding to each box-like structure is... .
[0069] Then, the convex hull algorithm is used to determine the minimum convex set of the vertex set corresponding to each class of box structure, resulting in, as shown below. Figure 5 The convex hull shown is Figure 5 This is a schematic diagram of a convex polygon provided in an embodiment of this disclosure. Each vertex in the vertex set is located on the edge or inside the corresponding convex hull, and the vertices of the convex hull are the outermost vertices in the corresponding vertex set.
[0070] In other embodiments, the convex polygon may also be a convex polygon outside the convex hull corresponding to the vertex set. This disclosure does not specifically limit this, but only limits that the area enclosed by each convex polygon includes all the boundary lines of a box-like structure.
[0071] S402, determine multiple target rectangles based on the vertex coordinates of each of the multiple convex polygons.
[0072] Each target rectangle encloses an area that covers an area enclosed by a convex polygon.
[0073] For example, a target rectangle can be the minimum bounding rectangle of a convex polygon. Then, based on the rotation caliper method, the target rectangle corresponding to each convex polygon is determined according to the vertex coordinates of each of the multiple convex polygons.
[0074] As a specific description of one possible implementation of S402, the following is an example: S501, based on the vertex coordinates of each convex polygon, determine the edge length, edge direction vector, and distance to all vertices of each edge in the convex polygon.
[0075] For example, firstly, based on the vertex coordinates of any adjacent vertices of each of the multiple convex polygons, the edge direction vector and edge length of each edge in each convex polygon are determined. Then, based on the edge direction vector of each edge in each convex polygon, the direction vector perpendicular to each edge is determined, that is, the perpendicular direction vector of each edge.
[0076] Then, based on the vertex coordinates of each vertex in each convex polygon, determine the distance between each edge and all vertices.
[0077] S502, determine multiple rectangles based on the side direction vector, vertical direction vector, and distance to all vertices of each side in each convex polygon.
[0078] For example, for each edge in each convex polygon, the length of the first side of the rectangle is determined based on the distance between the edge and all vertices, and the edge direction vector of that edge is used as the direction vector of the first side. For instance, first determine the maximum and minimum distances between the edge and all vertices, then find the two outermost vertices along the edge direction vectors of all vertices along the two paths from maximum to minimum distance and from minimum to maximum distance, and finally determine the length of the first side by the distance between these two outermost vertices along the edge direction vectors.
[0079] The maximum distance between an edge and all vertices is taken as the length of the second side of the rectangle, and the perpendicular vector of the edge is taken as the direction vector of the second side, thus obtaining a rectangle. Since a convex polygon consists of multiple edges, multiple rectangles can be obtained for a single convex polygon, and the number of rectangles is equal to the number of edges.
[0080] S503, determine the rectangle with the largest area among the multiple rectangles corresponding to each convex polygon as the target rectangle.
[0081] For example, the area of the multiple rectangles corresponding to each convex polygon is calculated, the rectangle with the largest area among the multiple rectangles corresponding to each convex polygon is determined as the target rectangle, and the vertex coordinates of the target rectangle are determined.
[0082] Alternatively, the rectangle with the smallest area among the multiple rectangles corresponding to each convex polygon can be determined as the corresponding target rectangle. Or, other rectangles besides the rectangles with the largest and smallest areas among the multiple rectangles corresponding to each convex polygon can be determined as the corresponding target rectangle.
[0083] In other embodiments, the target rectangle may also be a rectangle other than the minimum bounding rectangle of the convex polygon. For example, the target rectangle is the circumscribed rectangle of the circumcircle of the corresponding convex polygon. This disclosure does not specifically limit this, but only limits that the area enclosed by each target rectangle covers the area enclosed by a convex polygon.
[0084] Thus, by determining the vertex coordinates of each line segment entity within a CAD drawing, multiple box-like structures composed of partial line segment entities are identified. Based on the vertex set of all line segment entities contained in each of these box-like structures, multiple target rectangles covering all vertices in a single vertex set are determined. This method can accurately identify complex areas in CAD drawings, such as multi-line segments, overlapping line segments, and complex geometric images, capturing details that are difficult to perceive with the naked eye and completely extracting feature information from complex and minute areas, avoiding omissions and misjudgments, thereby improving cutting accuracy. Furthermore, it does not require a large amount of data for training, thus avoiding the problem of decreased cutting accuracy due to insufficient training data. It also does not require high computational costs or processing time, improving cutting efficiency.
[0085] S102, store the vertex coordinates of multiple target rectangles and display the multiple target rectangles.
[0086] For example, the vertex coordinates of the target rectangle corresponding to each of the multiple box-like structures are stored in the data, and a unique rectangle identifier is assigned to each target region to correspond to the coordinates in the CAD drawing. For example, for... Figure 4 After executing S102 and S103, the block-like structure shown can be obtained as follows: Figure 6 The target rectangle shown, Figure 6 This is a schematic diagram of a target rectangle provided in an embodiment of the present disclosure.
[0087] Different box-like structures may have containment relationships, and correspondingly, different target rectangles may also have containment relationships. Assigning a unique rectangle identifier to different target rectangles, storing the vertex coordinates of multiple target rectangles, and displaying multiple target rectangles can effectively distinguish all features within different box-like structures. This provides clear structured data support for subsequent precise cutting and processing, ensuring seamless integration across platforms and regions, rapid response to changes, and improved flexibility and sharing efficiency in data management.
[0088] S103, in response to the user's cutting command, reads the vertex coordinates of the target rectangle corresponding to the target rectangle identifier.
[0089] For example, the user cutting instruction can be any one of the following: a general cutting instruction, a first-type cutting instruction, and a second-type cutting instruction. The general cutting instruction includes a cutting request but does not include specified information; the first-type cutting instruction includes a cutting request and specified sub-drawing information but does not include specified area information; and the second-type cutting instruction includes a cutting request, specified sub-drawing information, and specified area information. The target rectangle identifier can be a subset of multiple rectangle identifiers, or all of the multiple rectangle identifiers.
[0090] First, in response to the user's cutting command, multiple target rectangle identifiers are determined from multiple rectangle identifiers.
[0091] For example, when the user's cutting instruction is a general cutting instruction, all rectangle identifiers among multiple rectangle identifiers are determined as the target rectangle identifier.
[0092] When the user's cutting instruction is a type 1 cutting instruction, the sub-drawing that matches the specified sub-drawing information is determined from multiple sub-drawings in the CAD drawing. Based on the sub-drawing that matches the specified sub-drawing information, multiple target rectangle identifiers are determined from multiple rectangle identifiers. For example, if the specified sub-drawing information is a sub-drawing that includes a topology diagram, the sub-drawing that includes the topology diagram is found from all the sub-drawings in the CAD drawing, and the multiple rectangle identifiers corresponding to the sub-drawing that includes the topology diagram are determined as target rectangle identifiers.
[0093] When the user's cutting instruction is a type 2 cutting instruction, the sub-drawing that matches the specified sub-drawing information is determined from multiple sub-drawings in the CAD drawing. Based on the sub-drawing that matches the specified sub-drawing information, multiple first target rectangle identifiers are determined from multiple rectangle identifiers. An area that matches the specified area information is determined from the sub-drawing that matches the specified sub-drawing information. Based on the area that matches the specified area information, at least one second target rectangle identifier is determined from the multiple first target rectangle identifiers.
[0094] Then, read the vertex coordinates of the target rectangles corresponding to the multiple target rectangle identifiers.
[0095] For example, when the user's cutting instruction is a general cutting instruction or a first-type cutting instruction, the vertex coordinates of the target rectangle corresponding to each of the multiple target rectangle identifiers are read. When the user's cutting instruction is a second-type cutting instruction, the vertex coordinates of the target rectangle corresponding to each of the multiple first-type target rectangle identifiers are read.
[0096] S104. Determine the clipping region based on the vertex coordinates of the target rectangle corresponding to the target rectangle identifier.
[0097] For example, in complex CAD drawings, target rectangles may be nested, meaning one target rectangle is completely contained within another. For instance, as... Figure 6 As shown, the target rectangle corresponding to rectangle identifier 1 includes the target rectangle corresponding to rectangle identifier 2, the target rectangle corresponding to rectangle identifier 2 includes the target rectangle corresponding to rectangle identifier 3, the target rectangle corresponding to rectangle identifier 5 includes the target rectangle corresponding to rectangle identifier 6, and the target rectangle corresponding to rectangle identifier 6 includes the target rectangles corresponding to rectangle identifier 4 and rectangle identifier 7.
[0098] As a specific description of one possible implementation when executing S104, the following is an example: First, based on the vertex coordinates of the target rectangles corresponding to multiple target rectangle identifiers, the outermost rectangle is determined from among the target rectangles corresponding to multiple target rectangle identifiers. The outermost rectangle is the target rectangle among the target rectangles corresponding to multiple target rectangle identifiers that is not contained within any other target rectangle. Second, based on the vertex coordinates of the outermost rectangle, the boundary information of the clipping region is determined.
[0099] For example, the outermost rectangle is usually the main area of the drawing, and the target rectangle contained within the outermost rectangle is usually a sub-area or a detail.
[0100] When the user's cutting command is a general cutting command, based on the vertex coordinates of the target rectangles corresponding to the multiple target rectangle identifiers, multiple target rectangles that are not contained in any other target rectangle are found among the target rectangles corresponding to the multiple target rectangle identifiers, that is, multiple outermost rectangles are found, and the outermost rectangle is determined as the clipping region. Based on the vertex coordinates of the outermost rectangle, the boundary information of the outermost rectangle is determined, that is, the boundary information of the clipping region.
[0101] When the user's cutting instruction is a first type of cutting instruction, based on the vertex coordinates of the target rectangles corresponding to the multiple target rectangle identifiers, at least one target rectangle that is not contained in any other target rectangle is found among the target rectangles corresponding to the multiple target rectangle identifiers, that is, at least one outermost rectangle is found, and the outermost rectangle is determined as the clipping region. Based on the vertex coordinates of the outermost rectangle, the boundary information of the outermost rectangle, that is, the boundary information of the clipping region, is determined.
[0102] When the user's cutting instruction is a second type of cutting instruction, based on the vertex coordinates of the target rectangles corresponding to multiple first target rectangle identifiers, at least one target rectangle that is not contained within any other target rectangle is found among the target rectangles corresponding to the multiple first target rectangle identifiers; that is, at least one outermost rectangle is found, and the outermost rectangle is determined as the first clipping region. Based on the vertex coordinates of the outermost rectangle and its boundary information (i.e., the boundary information of the first clipping region), and based on the vertex coordinates of the target rectangles corresponding to the second target rectangle identifiers, the boundary information of the target rectangles corresponding to the second target rectangle identifiers is determined.
[0103] S105: Based on the user's cutting instructions and the boundary information of the cutting area, the CAD drawing is cut to obtain the target sub-drawing.
[0104] For example, multiple complex entity structures in a CAD drawing include line segments, polylines, text, and fills. Although these complex entity structures are logically a whole, they are structurally composed of basic entities such as lines, circles, and arcs. Therefore, the entity structures in the CAD drawing can be decomposed into basic entities first.
[0105] Then, when the user's cutting instruction is a general cutting instruction or a first-type cutting instruction, based on the boundary information of the clipping region, it is determined whether the basic entity corresponding to each of the multiple entity structures is located inside the clipping region, thus determining whether each entity structure is located inside the clipping region. For example, if all the basic entities corresponding to an entity structure are located inside the clipping region, then it is determined that the entity structure is located inside the clipping region.
[0106] When the user's cutting instruction is a second type of cutting instruction, based on the boundary information of the first trimming region, it is determined whether the basic entity corresponding to each of the multiple entity structures is located inside the first trimming region, thus determining whether each entity structure is located inside the first trimming region. For example, if all the basic entities corresponding to an entity structure are located inside the first trimming region, then it is determined that the entity structure is located inside the first trimming region.
[0107] Based on the boundary information of the second clipping region, it is determined whether the basic entity corresponding to each of the multiple entity structures is located inside the second clipping region. For example, if all the basic entities corresponding to an entity structure are located inside the second clipping region, then the entity structure is determined to be inside the second clipping region.
[0108] Finally, when the user's cutting instruction is a general cutting instruction or a first-type cutting instruction, all solid structures inside the cutting area are extracted, and all solid structures inside the cutting area are saved as a new drawing to obtain the target sub-drawing.
[0109] For example, if there is only one clipping region, extract all solid structures within that region and save them as a new drawing to obtain a target sub-drawing, such as... Figure 7 As shown, Figure 7 This is a schematic diagram of a target sub-drawing provided in an embodiment of this disclosure. If there are multiple clipping regions, all entity structures within each clipping region are extracted, and all entity structures within each clipping region are saved as a new drawing to obtain multiple target sub-drawings.
[0110] When the user's cutting instruction is a second type of cutting instruction, extract all entity structures located outside the second cutting area within the first cutting area, and save all entity structures located outside the second cutting area within the first cutting area as a new drawing to obtain the target sub-drawing.
[0111] For example, if there is only one first clipping region, all solid structures located outside the second clipping region within the first clipping region are extracted, and these solid structures are saved as a new drawing to obtain a target sub-drawing, such as... Figure 8 and Figure 9 As shown, Figure 8 This is a schematic diagram of another target sub-drawing provided in an embodiment of this disclosure. Figure 8 This is a schematic diagram of yet another target sub-drawing provided in an embodiment of the present disclosure.
[0112] For example, if the specified area information is to remove the description area, list box, and title box, the result is as follows: Figure 8 The target sub-map is shown below. If the specified area information is a topology map, the result is as follows: Figure 9 The target sub-drawing shown.
[0113] If there are multiple first clipping regions, extract all entity structures located outside the second clipping region within each of the multiple first clipping regions, and save all entity structures located outside the second clipping region within each of the first clipping regions as a new drawing to obtain multiple target sub-drawings.
[0114] In this embodiment of the disclosure, multiple target rectangles are determined based on the vertex coordinates of each line segment entity among multiple line segment entities. Since the area enclosed by each target rectangle covers part of the line segment entities among multiple line segment entities, and the area enclosed by multiple target rectangles covers multiple line segment entities, the feature information in the CAD drawing can be accurately preserved, thereby improving the accuracy of cutting.
[0115] By storing the vertex coordinates of multiple target rectangles and displaying multiple target rectangles, with each target rectangle corresponding to a rectangle identifier, feature information can be saved as structured data, ensuring seamless integration of cross-platform and cross-regional operations, rapid response to changes, and improving the flexibility and sharing efficiency of data management.
[0116] By responding to user cutting commands, the vertex coordinates of the target rectangle corresponding to the target rectangle identifier are read. Based on the vertex coordinates of the target rectangle corresponding to the target rectangle identifier, the cutting area is determined. The CAD drawing is then cut based on the user cutting command and the boundary information of the cutting area to obtain the target sub-drawing. Specific areas can be cut according to user needs to obtain sub-drawings with coordinates consistent with the CAD drawing. This ensures the integrity and accuracy of the drawing information, thereby improving cutting precision. It can also meet personalized needs in different scenarios, thereby improving cutting flexibility.
[0117] This disclosure also provides an automatic cutting device for CAD drawings. Figure 10This is a schematic diagram of the structure of an automatic cutting device for CAD drawings provided in an embodiment of this disclosure, as shown below. Figure 10 As shown, the automatic cutting device for CAD drawings includes: The determination module 110 is used to determine multiple target rectangles based on the vertex coordinates of each line segment entity in the multiple line segment entities. The CAD drawing includes multiple line segment entities, and the area enclosed by each target rectangle covers part of the line segment entities in the multiple line segment entities. The area enclosed by the multiple target rectangles covers multiple line segment entities.
[0118] The storage module 120 is used to store the vertex coordinates of multiple target rectangles and display the multiple target rectangles, with each target rectangle corresponding to a rectangle identifier.
[0119] The cutting module 130 is used to respond to a user cutting command by reading the vertex coordinates of the target rectangle corresponding to the target rectangle identifier, wherein the target rectangle identifier is at least a part of multiple rectangle identifiers; determining the clipping area based on the vertex coordinates of the target rectangle corresponding to the target rectangle identifier; and clipping the CAD drawing based on the user cutting command and the boundary information of the clipping area to obtain the target sub-drawing.
[0120] In some embodiments, the cutting module 130 is further configured to, in response to a user cutting instruction, determine a plurality of target rectangle identifiers from a plurality of rectangle identifiers; and read the vertex coordinates of the target rectangle corresponding to each target rectangle identifier in the plurality of target rectangle identifiers.
[0121] In some embodiments, the cutting module 130 is further configured to: when the user cutting instruction is a general cutting instruction, determine all the rectangle identifiers among the multiple rectangle identifiers as target rectangle identifiers; when the user cutting instruction is a first type of cutting instruction, determine the sub-drawing that matches the specified sub-drawing information from the multiple sub-drawings, wherein the first type of cutting instruction includes the specified sub-drawing information and the CAD drawing includes multiple sub-drawings; and determine multiple target rectangle identifiers from the multiple rectangle identifiers based on the sub-drawing that matches the specified sub-drawing information.
[0122] In some embodiments, the cutting module 130 is further configured to, when the user cutting instruction is a second type of cutting instruction, determine a sub-drawing that matches the specified sub-drawing information from a plurality of sub-drawings, the second type of cutting instruction including the specified sub-drawing information and the specified area information, the CAD drawing including a plurality of sub-drawings; determine a plurality of first target rectangle identifiers from a plurality of rectangle identifiers based on the sub-drawing that matches the specified sub-drawing information; determine an area that matches the specified area information from the sub-drawing that matches the specified sub-drawing information; and determine at least one second target rectangle identifier from a plurality of first target rectangle identifiers based on the area that matches the specified area information.
[0123] In some embodiments, the cutting module 130 is further configured to determine the outermost rectangle from the target rectangles corresponding to the multiple target rectangle identifiers based on the vertex coordinates of the target rectangles corresponding to the multiple target rectangle identifiers, wherein the outermost rectangle is a target rectangle among the target rectangles corresponding to the multiple target rectangle identifiers that is not contained by other target rectangles; and to determine the boundary information of the clipping region based on the vertex coordinates of the outermost rectangle.
[0124] In some embodiments, the cutting module 130 is further configured to determine whether each of the multiple entity structures is located inside the cutting area based on the boundary information of the cutting area, wherein the CAD drawing includes multiple entity structures and the boundary information of the cutting area is the boundary information of the outermost rectangle; extract all entity structures inside the cutting area and save all entity structures inside the cutting area as a new drawing to obtain the target sub-drawing.
[0125] In some embodiments, the cutting module 130 is further configured to determine whether each of the multiple entity structures is located inside the first cutting area based on the boundary information of the first cutting area, wherein the CAD drawing includes multiple entity structures and the boundary information of the first cutting area is the boundary information of the outermost rectangle; determine whether each of the multiple entity structures is located inside the second cutting area based on the boundary information of the second cutting area, wherein the boundary information of the second cutting area is the boundary information of the target rectangle corresponding to the second target rectangle identifier; extract all entity structures located outside the second cutting area but inside the first cutting area, and save all entity structures located outside the second cutting area but inside the first cutting area as a new drawing to obtain a target sub-drawing.
[0126] In some embodiments, the determining module 110 is further configured to determine multiple class-box structures based on the vertex coordinates of each of the multiple line segment entities, each class-box structure being composed of a portion of the multiple line segment entities; and to determine multiple target rectangles based on the vertex set corresponding to each class-box structure, each vertex set including the vertices of all line segment entities contained in a class-box structure, and the area enclosed by each target rectangle covering all vertices in a vertex set.
[0127] In some embodiments, the determining module 110 is further configured to determine multiple convex polygons based on the vertex set corresponding to each of the multiple class-box structures, wherein the region enclosed by each convex polygon covers all vertices in a vertex set; and to determine multiple target rectangles based on the vertex coordinates of each of the multiple convex polygons, wherein the region enclosed by each target rectangle covers the region enclosed by a convex polygon.
[0128] In some embodiments, the determining module 110 is further configured to determine the convex hull of the vertex set corresponding to each class of box structure based on the convex hull algorithm.
[0129] In some embodiments, the determining module 110 is further configured to determine the side length, side direction vector, and distance to all vertices of each edge of the convex polygon based on the vertex coordinates of each convex polygon; determine multiple rectangles based on the side direction vector, vertical direction vector, and distance to all vertices of each edge of the convex polygon; and determine the rectangle with the largest area among the multiple rectangles corresponding to each convex polygon as the target rectangle. In some embodiments, the determining module 110 is further configured to determine the length of each line segment entity based on the vertex coordinates of each line segment entity among the multiple line segment entities; and to filter out multiple target line segment entities from the multiple line segment entities based on the length and color matrix of each line segment entity, wherein each class box structure is composed of a portion of the multiple target line segment entities.
[0130] In some embodiments, the determining module 110 is further configured to determine the length of a single line segment entity based on the Euclidean algorithm, according to the starting coordinates and ending coordinates of the single line segment entity; and to determine the length between all adjacent vertices in a multi-line segment entity based on the Euclidean algorithm, according to the vertex coordinates of all adjacent vertices in the multi-line segment entity, and to sum the lengths between all adjacent vertices in the multi-line segment entity to obtain the length of the multi-line segment entity.
[0131] In some embodiments, the determining module 110 is further configured to determine the line segment entity with a length greater than a preset length among the multiple line segment entities as the target line segment entity; and to display the target line segment entity based on the color matrix corresponding to the target line segment entity.
[0132] The apparatus provided in this disclosure is used to perform the steps provided in any of the above method embodiments, has the functional modules corresponding to the method embodiments, and has the beneficial effects of the method embodiments, which will not be repeated here.
[0133] This disclosure also provides an electronic device, including: a processor, the processor being configured to execute a computer program stored in a memory, the computer program being executed by the processor to implement the steps of the method embodiments of this disclosure.
[0134] Figure 11 This is a schematic diagram of the structure of an electronic device provided in this disclosure. Figure 11 A block diagram is shown that is suitable for implementing embodiments of the present disclosure. Figure 11 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.
[0135] like Figure 11 As shown, the electronic device 12 is represented in the form of a general-purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors 16, system memory 28, and bus 18 connecting different system components (including system memory 28 and processor 16).
[0136] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0137] Electronic device 12 typically includes a variety of computer system readable media. These media can be any media that can be accessed by electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0138] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (commonly referred to as "hard disk drives"). Disk drives for reading and writing to removable non-volatile disks (e.g., "floppy disks") and optical disk drives for reading and writing to removable non-volatile optical disks (e.g., CD-ROMs, DVD-ROMs, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of various embodiments of this disclosure.
[0139] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of this disclosure.
[0140] The processor 16 performs various functional applications and data processing by running at least one of a plurality of programs stored in the system memory 28, such as implementing the method embodiments provided in this disclosure.
[0141] This disclosure also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method embodiments.
[0142] Any combination of one or more computer-readable media may be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.
[0143] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0144] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0145] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or wide area network (WAN) domain—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0146] This disclosure also provides a computer program product that, when run on a computer, causes the computer to perform the steps of the above-described method embodiments.
[0147] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatuses and methods according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0148] Unless otherwise expressly indicated by the context, the singular form of words used herein and in the appended claims includes the plural form, and vice versa. Thus, when referring to the singular, the plural form of the corresponding term is generally included. Similarly, the terms “comprising” and “including” shall be interpreted as including rather than exclusively. Likewise, the terms “including” and “or” shall be interpreted as including unless such interpretation is expressly prohibited herein. Where the term “example” is used herein, particularly when it follows a set of terms, the “example” is merely exemplary and illustrative and should not be considered exclusive or extensive.
[0149] Further aspects and scope of adaptation become apparent from the description provided herein. It should be understood that various aspects of this disclosure may be implemented individually or in combination with one or more other aspects. It should also be understood that the descriptions and specific embodiments herein are for illustrative purposes only and are not intended to limit the scope of this disclosure.
[0150] Several embodiments of this disclosure have been described in detail above. However, it is obvious that those skilled in the art can make various modifications and variations to the embodiments of this disclosure without departing from the spirit and scope of this disclosure. The scope of protection of this disclosure is defined by the appended claims.
Claims
1. An automatic cutting method for CAD drawings, characterized in that, include: Multiple target rectangles are determined based on the vertex coordinates of each line segment entity in the multiple line segment entities. The CAD drawing includes the multiple line segment entities. Some of the line segment entities in the multiple line segment entities form multiple box-like structures. The multiple box-like structures include overlapping line segment entities, shared line segment entities, and non-closed structures formed by the partial line segment entities. The area enclosed by each target rectangle covers a box-like structure formed by the partial line segment entities in the multiple line segment entities. The area enclosed by the multiple target rectangles covers the multiple line segment entities. The vertex coordinates of the multiple target rectangles are stored and the multiple target rectangles are displayed. Each target rectangle corresponds to a rectangle identifier, and the relationship between different target rectangles includes an inclusion relationship. In response to a user cutting command, the vertex coordinates of the target rectangle corresponding to the target rectangle identifier are read, wherein the target rectangle identifier is at least a portion of a plurality of rectangle identifiers; The clipping region is determined based on the vertex coordinates of the target rectangle corresponding to the target rectangle identifier; The CAD drawing is cut based on the user cutting command and the boundary information of the cutting area to obtain the target sub-drawing. The step of reading the vertex coordinates of the target rectangle corresponding to the target rectangle identifier in response to the user's cutting command includes: In response to the user cutting command, a plurality of target rectangle identifiers are determined from the plurality of rectangle identifiers; Read the vertex coordinates of the target rectangle corresponding to each of the plurality of target rectangle identifiers. The step of determining multiple target rectangle identifiers from the multiple rectangle identifiers in response to the user cutting command includes: When the user cutting instruction is a second type of cutting instruction, a sub-drawing that matches the specified sub-drawing information is determined from multiple sub-drawings. The second type of cutting instruction includes the specified sub-drawing information and the specified area information. The CAD drawing includes the multiple sub-drawings. Based on the sub-drawing that matches the specified sub-drawing information, determine a plurality of first target rectangle identifiers from the plurality of rectangle identifiers; Determine the region that matches the specified region information from the sub-drawings that match the specified sub-drawing information; Based on the region that matches the specified region information, at least one second target rectangle identifier is determined from the plurality of first target rectangle identifiers.
2. The method according to claim 1, characterized in that, The step of determining multiple target rectangle identifiers from the multiple rectangle identifiers in response to the user cutting command includes: When the user cutting instruction is a general cutting instruction, all of the multiple rectangle identifiers are determined as the target rectangle identifier; When the user cutting instruction is a first type of cutting instruction, a sub-drawing that matches the specified sub-drawing information is determined from multiple sub-drawings. The first type of cutting instruction includes the specified sub-drawing information, and the CAD drawing includes the multiple sub-drawings. Based on the sub-drawing that matches the specified sub-drawing information, determine the plurality of target rectangle identifiers from the plurality of rectangle identifiers.
3. The method according to claim 1, characterized in that, Determining the clipping region based on the vertex coordinates of the target rectangle corresponding to the target rectangle identifier includes: Based on the vertex coordinates of the target rectangles corresponding to the plurality of target rectangle identifiers, the outermost rectangle is determined from the target rectangles corresponding to the plurality of target rectangle identifiers. The outermost rectangle is the target rectangle among the target rectangles corresponding to the plurality of target rectangle identifiers that is not contained by other target rectangles. The boundary information of the clipping region is determined based on the vertex coordinates of the outermost rectangle.
4. The method according to claim 2, characterized in that, The step of cutting the CAD drawing based on the user cutting command and the boundary information of the cutting area to obtain the target sub-drawing includes: Based on the boundary information of the clipping area, it is determined whether each of the multiple entity structures is located inside the clipping area. The CAD drawing includes the multiple entity structures, and the boundary information of the clipping area is the boundary information of the outermost rectangle. Extract all entity structures within the clipping region and save all entity structures within the clipping region as a new drawing to obtain the target sub-drawing.
5. The method according to claim 1, characterized in that, The step of cutting the CAD drawing based on the user cutting command and the boundary information of the cutting area to obtain the target sub-drawing includes: Based on the boundary information of the first trimming area, it is determined whether each of the multiple entity structures is located inside the first trimming area. The CAD drawing includes the multiple entity structures, and the boundary information of the first trimming area is the boundary information of the outermost rectangle. Based on the boundary information of the second clipping region, it is determined whether each of the plurality of entity structures is located inside the second clipping region, where the boundary information of the second clipping region is the boundary information of the target rectangle corresponding to the second target rectangle identifier; Extract all entity structures located outside the second clipping area within the first clipping area, and save all entity structures located outside the second clipping area within the first clipping area as a new drawing to obtain the target sub-drawing.
6. An automatic cutting device for CAD drawings, characterized in that, include: A determination module is used to determine multiple target rectangles based on the vertex coordinates of each line segment entity in a plurality of line segment entities. The CAD drawing includes the plurality of line segment entities, some of which form multiple box-like structures. The multiple box-like structures include overlapping line segment entities, shared line segment entities, and non-closed structures formed by the partial line segment entities. The area enclosed by each target rectangle covers a box-like structure formed by the partial line segment entities in the plurality of line segment entities. The area enclosed by the multiple target rectangles covers the plurality of line segment entities. The relationship between different target rectangles includes an inclusion relationship. A storage module is used to store the vertex coordinates of the plurality of target rectangles and display the plurality of target rectangles, wherein each target rectangle corresponds to a rectangle identifier; A cutting module is used to read the vertex coordinates of a target rectangle corresponding to a target rectangle identifier in response to a user cutting command, wherein the target rectangle identifier is at least a portion of a plurality of rectangle identifiers; The clipping region is determined based on the vertex coordinates of the target rectangle corresponding to the target rectangle identifier; The CAD drawing is cut based on the user cutting command and the boundary information of the cutting area to obtain the target sub-drawing. The cutting module is further configured to, in response to the user cutting command, determine a plurality of target rectangle identifiers from the plurality of rectangle identifiers; and read the vertex coordinates of the target rectangle corresponding to each target rectangle identifier in the plurality of target rectangle identifiers; The cutting module is further configured to, when the user cutting instruction is a second type of cutting instruction, determine a sub-drawing that matches the specified sub-drawing information from a plurality of sub-drawings, wherein the second type of cutting instruction includes the specified sub-drawing information and specified area information, and the CAD drawing includes the plurality of sub-drawings; determine a plurality of first target rectangle identifiers from the plurality of rectangle identifiers based on the sub-drawing that matches the specified sub-drawing information; determine an area that matches the specified area information from the sub-drawing that matches the specified sub-drawing information; and determine at least one second target rectangle identifier from the plurality of first target rectangle identifiers based on the area that matches the specified area information.
7. An electronic device, characterized in that, include: A processor for executing a computer program stored in a memory, wherein the computer program, when executed by the processor, implements the steps of the method according to any one of claims 1-5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-5.
Citation Information
Patent Citations
Universal DWG drawing quick splitting method
CN108121867A