DXF drawing extraction method and device and electronic equipment
By automatically identifying and processing closed contours in DXF drawings, and utilizing preset contour algorithms and geometric data structures, the problem of dependence on layer annotations is solved, improving the accuracy and reliability of DXF drawing parsing, adapting to different primitive shapes, and simplifying the data processing flow.
Patent Information
- Application Number
- CN202411183337.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-08-27
AI Technical Summary
Existing automatic parsing technology for DXF drawings relies too heavily on layer annotations, resulting in insufficient parsing accuracy and an inability to effectively handle errors in layer name annotations.
By automatically identifying and processing closed contours, a preset contour algorithm is used to identify closed contours in DXF drawings. The primitives are represented in the form of polylines using a preset geometric data structure, approximate polylines are generated and corresponding relationships are established, key attributes are determined, and valid closed contours are identified, avoiding dependence on layer names.
It improves the accuracy and reliability of DXF drawing parsing, simplifies the data structure processing flow, adapts to different types and shapes of primitives, and enhances versatility and recognition accuracy.
Smart Images

Figure CN119004706A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the CAD field, and in particular to a method, device and electronic equipment for extracting DXF drawings. Background Art
[0002] The DXF file format is a CAD data exchange file format. It is designed to ensure that drawing data can be exchanged between different drawing software. Due to its openness and easy parsing characteristics, DXF files have become one of the most widely used drawing exchange formats in engineering design, construction and manufacturing. It supports a variety of primitive types such as line segments, arcs and polygons, and can save information such as layers, colors and sizes, making the transmission of design data more efficient and accurate. With the development of computer technology, the automatic parsing technology of DXF drawings has received more and more attention. This technology allows users to automatically extract key data from drawings, thereby realizing automatic quotation, computer-aided design and automated operations in the production process. For example, on a custom processing website, by automatically parsing DXF files, the cost and processing time of the required materials can be calculated instantly, greatly improving work efficiency and customer response speed. In addition, automatic parsing technology also supports the rapid import and modification of drawings in computer-aided design software, as well as the direct reading and application of drawing data on the production line.
[0003] At present, the main defect of the existing DXF drawing automatic parsing technology is its over-reliance on layer annotation. Due to the differences in layer annotation habits and specifications among different users, and the difficulty in avoiding human errors, the existing technology can only automatically parse a small number of drawings that meet specific requirements, and will cause inaccurate extraction problems due to incorrect layer name annotation.
[0004] Therefore, there is an urgent need for a method, device and electronic equipment for extracting DXF drawings. Summary of the invention
[0005] The present application provides a DXF drawing extraction method, device and electronic device, which solves the problem of excessive reliance on layer annotation in related technologies by automatically identifying and processing closed contours, and improves the accuracy of DXF drawing parsing.
[0006] In a first aspect of the present application, a method for extracting a DXF drawing is provided, the method comprising: reading primitives included in a DXF drawing, the primitives comprising line segments and arcs; preprocessing the primitives to determine key attributes of the primitives, the key attributes comprising start point coordinates and end point coordinates; determining closed contours in the DXF drawing according to the key attributes; identifying the closed contours using a preset contour algorithm to obtain the number, layout and relative position of the closed contours; determining a valid closed contour from a plurality of the closed contours according to the number, the layout and the relative position; and outputting the valid closed contour as a standard DXF format.
[0007] By adopting the above technical solution, the key attributes of the primitives, including the starting point coordinates and the end point coordinates, are determined by reading the primitives included in the DXF drawing and preprocessing the primitives, and then the closed contours in the DXF drawing are determined based on the key attributes. Then, the closed contours are identified using a preset contour algorithm to obtain the number, layout and relative position of the closed contours, and valid closed contours are determined from multiple closed contours based on this information, and finally the valid closed contours are output as a standard DXF format. This method can automatically identify and extract valid closed contours in DXF drawings, does not rely on layer names, avoids problems caused by incorrect layer name labeling, and improves the accuracy and reliability of contour extraction.
[0008] Optionally, the preprocessing of the primitives to determine the key attributes of the primitives specifically includes: obtaining a preset geometric data structure, which represents each primitive in the form of a polyline; when reading each primitive of the DXF drawing, generating a polyline corresponding to each primitive according to the preset geometric data structure, and approximating the polyline to the corresponding primitive to generate an approximated polyline; establishing a correspondence between the approximated polyline and the primitive, and determining the key attributes of the primitive based on the correspondence.
[0009] By adopting the above technical solution, a preset geometric data structure is introduced when preprocessing the primitives and determining the key attributes, and each primitive is represented in the form of a polyline. When reading each primitive of a DXF drawing, a polyline corresponding to each primitive is generated according to the preset geometric data structure, and the polyline is approximated to the corresponding primitive to generate an approximated polyline. Then, a corresponding relationship between the approximated polyline and the primitive is established, and the key attributes of the primitive are determined according to the corresponding relationship. This method uses polylines to approximate and represent primitives, simplifies the data structure and processing flow of the primitives, and improves the efficiency and accuracy of key attribute extraction. By establishing a corresponding relationship between the approximated polyline and the primitive, the key attributes of the starting point coordinates and the end point coordinates of the primitive can be easily obtained, providing an accurate data basis for subsequent closed contour recognition and analysis. At the same time, the use of polyline approximation can adapt to primitives of different types and shapes, and has better versatility.
[0010] Optionally, when reading each primitive of the DXF drawing, a polyline corresponding to each primitive is generated according to the preset geometric data structure, and the polyline is approximated to the corresponding primitive. After the approximated polyline is generated, the method further includes: if it is determined that the primitive is an arc, then judging whether the arc is a component of the outer contour of the part or a component of the inner contour of the part; if it is determined that the arc is a component of the outer contour of the part, then the polyline corresponding to the arc is a polyline circumscribed to the arc; if it is determined that the arc is a component of the inner contour of the part, then the polyline corresponding to the arc is a polyline inscribed to the arc.
[0011] By adopting the above technical solution, in the process of generating polylines corresponding to primitives and approximating primitives, special processing is performed on primitives of arc type. First, it is determined whether the arc is a component of the outer contour of the part or a component of the inner contour of the part, and then different approximation polylines are generated according to the judgment result. If the arc is a component of the outer contour of the part, a polyline tangent to the arc is generated; if the arc is a component of the inner contour of the part, a polyline inscribed to the arc is generated. This method takes into account the different functions and positions of the arc in the part contour, and by generating tangent or inscribed polylines, the topological relationship and geometric constraints between the arc and the adjacent primitives are more accurately represented. The tangent polyline can fit the outer boundary of the arc tightly, indicating the connection relationship between the arc and the external primitive; the inscribed polyline can fit the inner boundary of the arc, indicating the inclusion relationship between the arc and the internal primitive. In this way, the shape characteristics of the arc can be better preserved, the errors and distortions caused by polyline approximation can be avoided, and the accuracy and reliability of closed contour recognition can be improved.
[0012] Optionally, determining the closed contour in the DXF drawing based on the key attributes specifically includes: constructing a topological relationship of the primitives based on the starting point coordinates and the end point coordinates; identifying target primitives based on the topological relationship, wherein the target primitives are interconnected primitives among the primitives; judging whether the target primitives constitute a closed path; if it is determined that the target primitives constitute a closed path, determining that the target primitives constitute a closed contour.
[0013] By adopting the above technical solution, when determining the closed contour in the DXF drawing, the topological relationship of the primitives is first constructed according to the starting point coordinates and the end point coordinates of the primitives, and then the interconnected target primitives are identified according to the topological relationship. Then, it is determined whether the target primitives constitute a closed path. If a closed path is formed, it is determined that the target primitives constitute a closed contour. This method uses the starting point coordinates and the end point coordinates of the primitives to establish the topological relationship between the primitives, and can accurately determine the interconnectivity between the primitives. By identifying the interconnected target primitives, potential closed contour candidate areas can be quickly found, reducing the complexity of search and calculation. At the same time, by judging whether the target primitives constitute a closed path, the true closed contour can be effectively identified, and incomplete or open contour fragments can be excluded. This method based on topological relationship and closure judgment improves the efficiency and accuracy of closed contour recognition and avoids the occurrence of missed detection or misjudgment.
[0014] Optionally, determining a valid closed contour from the multiple closed contours based on the number, the layout and the relative position specifically includes: calculating the geometric center of each closed contour based on the number, the layout and the relative position; calculating the distance matrix between each closed contour based on the geometric center; according to the distance matrix, grouping the closed contours whose relative distance is less than a preset first distance threshold into a group to form a plurality of closed contour groups; analyzing the inclusion relationship of each closed contour group, marking and identifying the outer contour and the inner contour; and according to the outer contour and the inner contour, identifying the valid closed contour representing the main shape of the part.
[0015] By adopting the above technical solution, when determining a valid closed contour from multiple closed contours, the geometric center of each closed contour is first calculated according to the number, layout and relative position of the closed contours, and then the distance matrix between the closed contours is calculated according to the geometric center. Then, according to the distance matrix, the closed contours whose relative distance is less than the preset first distance threshold are grouped together to form multiple closed contour groups. Then, the inclusion relationship of each closed contour group is analyzed, and the outer contour and the inner contour are marked and identified. Finally, according to the outer contour and the inner contour, the valid closed contour representing the main shape of the part is identified. This method comprehensively considers multiple factors such as the number, layout and relative position of closed contours. By calculating the geometric center and the distance matrix, the spatial relationship and distribution characteristics between closed contours can be quantitatively evaluated. Closed contours with close distances are grouped together to form a closed contour group, and different contour areas can be preliminarily divided. By analyzing the inclusion relationship of the closed contour group, the outer contour and the inner contour can be further identified, and the hierarchy and nesting relationship of the contour can be determined. Finally, according to the information of the outer contour and the inner contour, the valid closed contour representing the main shape of the part can be accurately identified, and interfering contours and irrelevant details can be excluded. This multi-level, multi-angle analysis method improves the intelligence level and recognition accuracy of effective closed contour recognition, and can adapt to the contour extraction needs of complex parts.
[0016] Optionally, before determining a valid closed contour from the multiple closed contours according to the number, the layout and the relative position, the method further includes: judging whether there is a situation in which the first endpoint and the second endpoint do not intersect exactly in the DXF drawing, the first endpoint is the endpoint of a first line segment, the second endpoint is the endpoint of a second line segment, the distance between the first endpoint and the second endpoint is less than a preset second distance threshold, the first line segment is any line segment in the primitive, and the second line segment is any line segment in the primitive except the first line segment; if it is determined that there is a situation in which the first endpoint and the second endpoint do not intersect exactly in the DXF drawing, adjusting the first endpoint so that the first endpoint intersects with the second endpoint.
[0017] By adopting the above technical solution, before determining the effective closed contour, the judgment and processing steps for the inaccurate intersection are introduced. First, it is judged whether there is an inaccurate intersection between the first endpoint and the second endpoint in the DXF drawing, that is, the distance between the endpoint of the first line segment and the endpoint of the second line segment is less than the preset second distance threshold. If this situation exists, the first endpoint is adjusted so that the first endpoint intersects with the second endpoint. This method solves the problem of inaccurate intersection between the endpoints of the primitives due to precision errors. By judging whether the distance between the endpoints is less than the threshold, potential intersection points can be identified. Then, by adjusting the position of the endpoints to make them intersect accurately, tiny gaps or overlaps are eliminated, and the correct connection relationship between the primitives is ensured. This can improve the accuracy of closed contour recognition and avoid contour breaks or misjudgments caused by endpoint errors.
[0018] Optionally, after determining whether the first endpoint and the second endpoint in the DXF drawing do not intersect exactly, the method further includes: determining whether the first line segment and the second line segment completely overlap; if it is determined that the first line segment and the second line segment completely overlap, deleting the first line segment.
[0019] By adopting the above technical solution, after judging the inexact intersection, a step of judging and processing all overlapping line segments is further introduced. First, it is judged whether the first line segment and the second line segment completely overlap. If they do, the first line segment is deleted. This method solves the redundancy of completely overlapping between primitives. By judging whether the first line segment and the second line segment completely overlap, the redundant line segments can be identified. Then, by deleting one of the overlapping line segments, the redundant representation of the primitive is eliminated, the graphic structure is simplified, and the complexity of subsequent processing is reduced. In this way, the efficiency and accuracy of closed contour recognition can be improved, and contour confusion or misjudgment caused by overlapping line segments can be avoided.
[0020] In a second aspect of the present application, a DXF drawing extraction device is provided, the device comprising: an acquisition module and a processing module, wherein: the acquisition module is used to read the primitives included in the DXF drawing, the primitives including line segments and arcs; the processing module is used to pre-process the primitives to determine the key attributes of the primitives, the key attributes including the starting point coordinates and the end point coordinates; the processing module is also used to determine the closed contours in the DXF drawing according to the key attributes; the processing module is also used to identify the closed contours using a preset contour algorithm to obtain the number, layout and relative position of the closed contours; the processing module is also used to determine a valid closed contour from a plurality of the closed contours according to the number, the layout and the relative position; the processing module is also used to output the valid closed contour as a standard DXF format.
[0021] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes any one of the methods described above.
[0022] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed, any of the methods described above is executed.
[0023] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. By reading the primitives included in the DXF drawing and preprocessing the primitives, the key attributes of the primitives, including the starting point coordinates and the end point coordinates, are determined, and then the closed contours in the DXF drawing are determined based on the key attributes. Then, the closed contours are identified using a preset contour algorithm to obtain the number, layout, and relative position of the closed contours, and valid closed contours are determined from multiple closed contours based on this information, and finally the valid closed contours are output as standard DXF format. This method can automatically identify and extract valid closed contours in DXF drawings, does not rely on layer names, avoids problems caused by incorrect layer name labeling, and improves the accuracy and reliability of contour extraction.
[0024] 2. When preprocessing the primitives and determining the key attributes, a preset geometric data structure is introduced to represent each primitive in the form of a polyline. When reading each primitive in the DXF drawing, the polyline corresponding to each primitive is generated according to the preset geometric data structure, and the polyline is approximated to the corresponding primitive to generate an approximated polyline. Then the correspondence between the approximated polyline and the primitive is established, and the key attributes of the primitive are determined based on the correspondence. This method uses polylines to approximate and represent primitives, simplifies the data structure and processing flow of the primitives, and improves the efficiency and accuracy of key attribute extraction. By establishing the correspondence between the approximated polyline and the primitive, the key attributes of the starting point coordinates and the end point coordinates of the primitive can be easily obtained, providing an accurate data basis for subsequent closed contour recognition and analysis. At the same time, the use of polyline approximation can adapt to primitives of different types and shapes, and has better versatility.
[0025] 3. In the process of generating polylines corresponding to primitives and approximating primitives, special processing is performed on primitives of arc type. First, determine whether the arc is a component of the outer contour of the part or a component of the inner contour of the part, and then generate different approximation polylines according to the judgment result. If the arc is a component of the outer contour of the part, a polyline tangent to the arc is generated; if the arc is a component of the inner contour of the part, a polyline intangent to the arc is generated. This method takes into account the different functions and positions of the arc in the part contour, and by generating tangent or intangent polylines, the topological relationship and geometric constraints between the arc and the adjacent primitives are more accurately represented. The tangent polyline can fit the outer boundary of the arc tightly, indicating the connection relationship between the arc and the external primitive; the intangent polyline can fit the inner boundary of the arc, indicating the inclusion relationship between the arc and the internal primitive. This can better preserve the shape characteristics of the arc, avoid errors and distortions caused by polyline approximation, and improve the accuracy and reliability of closed contour recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a flow chart of a method for extracting DXF drawings disclosed in an embodiment of the present application; Figure 2 It is a module schematic diagram of a DXF drawing extraction device disclosed in an embodiment of the present application; Figure 3 It is a structural schematic diagram of an electronic device disclosed in an embodiment of the present application.
[0027] Explanation of the reference numerals: 201, acquisition module; 202, processing module; 300, electronic device; 301, processor; 302, communication bus; 303, user interface; 304, network interface; 305, memory. DETAILED DESCRIPTION
[0028] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0029] In the description of the embodiments of the present application, words such as "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "for example" or "for example" is intended to present related concepts in a specific way.
[0030] In the description of the embodiments of the present application, the meaning of the term "multiple" refers to two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0031] This application provides a method for extracting DXF drawings. Figure 1 , Figure 1 1 is a flow chart of a method for extracting a DXF drawing provided in an embodiment of the present application. The method is applied to a server and includes steps S101 to S106, which are as follows: Step S101: Reading primitives included in a DXF drawing, where the primitives include line segments and arcs.
[0032] In step S101, the server reads the primitive information contained in the DXF drawing. DXF is a CAD drawing format used to exchange graphic data between different CAD software. DXF files store graphic information in ASCII text format, including the definitions and attributes of various primitives in the drawings. The server extracts the primitive data by parsing the content of the DXF file. Primitive types include line segments, arcs, polylines, circles, text, etc. Each primitive has a corresponding data block in the DXF file, which describes the type, geometric parameters, and style attribute information of the primitive.
[0033] Taking the line segment as an example, in the DXF file, the line segment data block contains the following content: entity type identifier, starting point coordinates, end point coordinates and layer information; among them, the entity type indicates that the entity is a line segment, represented by the code "LINE", the starting point coordinates are the X, Y, and Z coordinate values of the starting point of the line segment, the end point coordinates are the X, Y, and Z coordinate values of the end point of the line segment, and the layer information is the name of the layer to which the line segment belongs.
[0034] Take an arc as an example. In a DXF file, the arc data block contains the following contents: entity type identifier, center coordinates, radius, start angle, end angle, and layer information; where the entity type identifier indicates that the entity is an arc, represented by the code "ARC", the center coordinates are the X, Y, and Z coordinates of the circle where the arc is located, the radius is the radius of the circle where the arc is located, the start angle is the start angle of the arc, expressed in radians, and the end angle is the end angle of the arc, expressed in radians. The layer information is the name of the layer to which the arc belongs.
[0035] In addition to line segments and arcs, the server can also read other primitive types in DXF files, such as polylines, circles, text, etc. Each primitive has its own specific data block structure and attribute definition. The server correctly parses and extracts the data of various primitives according to the format specifications of the DXF file.
[0036] Step S102: pre-processing the primitives to determine key attributes of the primitives, where the key attributes include the starting point coordinates and the end point coordinates.
[0037] In step S102, a preset geometric data structure is obtained, and the preset geometric data structure represents each primitive in the form of a polyline; when reading each primitive of the DXF drawing, a polyline corresponding to each primitive is generated according to the preset geometric data structure, and the polyline is approximated to the corresponding primitive to generate an approximated polyline; a correspondence between the approximated polyline and the primitive is established, and the key attributes of the primitive are determined according to the correspondence.
[0038] Specifically, the server needs to define and obtain a preset geometric data structure. The preset geometric data structure uses a series of connected line segments (i.e., polylines) to represent the shape of a primitive. A polyline consists of a series of ordered vertices, each of which contains its coordinate information. By adjusting the number and position of the vertices of a polyline, various curve primitives, such as arcs, can be approximated.
[0039] When reading each primitive in a DXF drawing, the server converts each primitive into a corresponding polyline representation according to the preset geometric data structure. This process is called polyline approximation. Specifically, the server generates a series of polyline vertices according to the type and geometric parameters of the primitive, so that the polyline can be as close to the shape of the original primitive as possible.
[0040] Taking an arc as an example, the server calculates the coordinates of the starting point and the ending point of the arc based on the coordinates of the arc's center, radius, starting angle, and ending angle. The server divides the arc into multiple small segments based on the arc's angle range and the preset angle step. For each small segment, the coordinates of the corresponding point on the circumference are calculated as the vertices of the polyline. The server connects all the polyline vertices in sequence to form a polyline that approximates the arc.
[0041] For simple primitives such as line segments, polyline approximation is relatively simple. Line segments can be directly represented by the coordinates of the start and end points without the need for additional discretization.
[0042] In the process of generating the approximate polyline, the server also needs to establish a correspondence between the polyline and the original primitive. This correspondence records the primitive to which each polyline vertex belongs, as well as the position or parameter information of the vertex in the primitive. Through this correspondence, the server can easily map and convert between the polyline and the original primitive.
[0043] After establishing the correspondence between the polyline and the primitive, the server can determine the key attributes of the primitive based on the vertex information of the polyline. For a straight line segment, the key attributes are the start point coordinates and the end point coordinates, which can be directly obtained from the first and last vertices of the polyline. For an arc, the key attributes include the center coordinates, radius, start angle, and end angle, which can be calculated by analyzing the distribution of the polyline vertices and the correspondence between the arc.
[0044] In a possible implementation, when reading each primitive of a DXF drawing, a polyline corresponding to each primitive is generated according to a preset geometric data structure, and the polyline is approximated to the corresponding primitive. After the approximated polyline is generated, the method further includes: if it is determined that the primitive is an arc, then the arc is judged to be a component of the outer contour of the part or a component of the inner contour of the part; if it is determined that the arc is a component of the outer contour of the part, then the polyline corresponding to the arc is a polyline tangent to the arc; if it is determined that the arc is a component of the inner contour of the part, then the polyline corresponding to the arc is a polyline tangent to the arc.
[0045] Specifically, the server first determines whether each arc primitive belongs to the outer contour or the inner contour of the part. The server does this by analyzing the spatial position and contextual relationship of the primitives in the drawing. For example, the server can check the connection relationship between the arc and other primitives (such as a straight line segment) to determine whether the arc forms a closed contour. If the arc is part of a closed contour and the closed contour contains other primitives, then the arc can be regarded as the outer contour of the part. On the contrary, if the arc is part of a closed contour, but the closed contour is completely inside another larger closed contour, then the arc can be regarded as the inner contour of the part. After determining the contour type to which the arc belongs, the server adjusts the polyline corresponding to the arc to ensure that the polyline can correctly approximate the inner and outer contours of the part.
[0046] For arcs belonging to the outer contour of the part, the server will generate a polyline that is tangent to the arc. A tangent polyline means that all the vertices of the polyline are outside the arc and are tangent to the arc. The steps to generate a tangent polyline are as follows: According to the coordinates of the center of the arc, the radius, the starting angle, and the ending angle, the coordinates of a series of points on the arc are calculated as the initial polyline vertices. For each polyline vertex, a certain distance is offset outward along the normal direction of the arc to generate new vertex coordinates. The offset distance can be determined based on the approximation accuracy and the drawing scale. Connect all the offset vertices in the direction of the arc to form a tangent polyline. By generating a tangent polyline, the server can ensure that the polyline completely contains the arc and maintains a certain distance from the boundary of the arc, avoiding the intersection or overlap of the polyline and the arc. This can more accurately represent the outer contour of the part.
[0047] For arcs that belong to the inner contour of a part, the server will generate a polyline that is inscribed in the arc. An inscribed polyline is one in which all vertices are inside the arc and tangent to the arc. The steps for generating an inscribed polyline are similar to those for generating an extrinsic polyline, except that during the vertex offset process, the vertices are offset inward a certain distance along the normal direction of the arc.
[0048] Step S103: Determine the closed contour in the DXF drawing according to the key attributes.
[0049] In step S103, the topological relationship of the primitives is constructed according to the starting point coordinates and the end point coordinates; the target primitives are identified according to the topological relationship, and the target primitives are the interconnected primitives among the primitives; it is determined whether the target primitives constitute a closed path; if it is determined that the target primitives constitute a closed path, it is determined that the target primitives constitute a closed contour.
[0050] Specifically, the server constructs the topological relationship between the primitives according to the starting coordinates and the end coordinates of each primitive. The topological relationship reflects the connectivity and adjacency between the primitives. The steps of constructing the topological relationship are as follows: The server creates an empty topological relationship graph to store the connection information between the primitives. The server traverses all the primitives, and for each primitive, adds its starting coordinates and end coordinates as nodes to the topological relationship graph. Traverse all the primitives again, and for each primitive, add a directed edge to the topological relationship graph to connect the starting node and the end node of the primitive. For each node in the topological relationship graph, check the edges connected to it. If there are multiple primitives sharing the same starting point or end point, add additional edges between these primitives to indicate the connectivity relationship between them. By constructing the topological relationship graph, the server can clearly indicate the connectivity relationship between the primitives. Next, the server identifies the interconnected target primitives according to the topological relationship graph. The target primitive refers to a set of primitives that can reach each other through a series of continuous edges in the topological relationship graph. The steps of identifying the target primitives are as follows: The server selects any node in the topological relationship graph as the starting node and creates an empty set of target primitives. The server starts from the starting node and traverses all nodes and edges connected to the starting node through depth-first search, and adds all primitives passed during the traversal process to the target primitive set. The server repeats the above steps until all nodes in the topological relationship graph have been visited. By identifying the target primitives, the server can divide the interconnected primitives (target primitives) in the drawing into the same target primitive set, and each target primitive set represents an independent geometric feature or contour. The server determines whether each target primitive set constitutes a closed path to determine whether it is a closed contour. The steps for determining a closed path are as follows: For each target primitive set, select any primitive as the starting primitive. Starting from the starting primitive, traverse all primitives in the target primitive set in turn according to the direction of the edge in the topological relationship graph. During the traversal process, the server records the visited primitives and nodes, and checks whether there is a path back to the starting primitive. If there is a path back to the starting primitive after traversing all primitives, and the path passes through all nodes in the target primitive set, then the target primitive set is considered to constitute a closed path, that is, a closed contour. If there is no path back to the starting primitive, or there are unvisited nodes, the target primitive set is considered not to constitute a closed contour.
[0051] Step S104: using a preset contour algorithm to identify closed contours, and obtaining the number, layout and relative positions of closed contours.
[0052] In step S104, the server needs to select a suitable preset contour algorithm to process the closed contour. In an embodiment of the present application, the server uses a boundary tracking algorithm to process the closed contour, which extracts the geometric information of the contour by tracking the boundary of the closed contour. The specific steps are as follows: For each closed contour, select any starting point as the starting point for tracking. Starting from the starting point, move counterclockwise along the boundary of the closed contour, and visit each node on the contour in turn. During the tracking process, the coordinates of the visited nodes are recorded, and the distance and direction between adjacent nodes are calculated. When returning to the starting point, the tracking of a closed contour is completed, and the recorded node coordinates are stored as the geometric information of the contour. The server repeats the above steps until all closed contours are tracked. Through the boundary tracking algorithm, the server can accurately extract the geometric information of each closed contour, including the shape, size, and position of the contour. Next, the server needs to count the number of closed contours to understand the number of independent geometric features contained in the drawing. The server achieves this by simply counting the number of closed contours identified. After obtaining the number of closed contours, the server also needs to analyze the layout and relative position of the closed contours to understand the spatial relationship and structure of the geometric features in the drawing. The steps for the server to analyze the layout and relative position are as follows: The server establishes a coordinate system, with the lower left corner of the drawing as the origin, the right side as the positive direction of the X axis, and the top side as the positive direction of the Y axis. For each closed contour, calculate the position and size of its circumscribed rectangle. The circumscribed rectangle refers to the smallest rectangle that can completely contain the closed contour. According to the position and size of the circumscribed rectangle, determine the relative position and occupied space range of each closed contour in the coordinate system. Analyze the relative position relationship between different closed contours, such as adjacent, contained, and overlapping. Through the above steps, the server can obtain the number, layout, and relative position of closed contours.
[0053] Step S105: determining a valid closed contour from a plurality of closed contours according to the quantity, layout and relative position.
[0054] In step S105, the geometric center of each closed contour is calculated according to the number, layout and relative position; the distance matrix between each closed contour is calculated according to the geometric center; according to the distance matrix, the closed contours whose relative distance is less than a preset first distance threshold are grouped together to form a plurality of closed contour groups; the inclusion relationship of each closed contour group is analyzed, and the outer contour and the inner contour are marked and identified; according to the outer contour and the inner contour, the valid closed contour representing the main shape of the part is identified.
[0055] Specifically, the server calculates the geometric center of each closed contour based on the number, layout, and relative position of the closed contours. For each closed contour, the server averages the coordinates of all nodes on its boundary to obtain the coordinates of the center point of the contour (x, y). Next, the server calculates the distance matrix between them based on the geometric centers of each closed contour. The distance matrix is a symmetric matrix used to store the distance values between any two closed contours. The steps to calculate the distance matrix are as follows: The server creates an N×N distance matrix D, where N is the number of closed contours. For each element D[i][j] in the matrix D, the Euclidean distance between the geometric centers of the i-th and j-th closed contours is calculated, and the distance value is stored in D[i][j]. Since the distance matrix is symmetrical, only the elements of the upper triangle or the lower triangle need to be calculated, and then the elements of the other part are set to the same value. Through the distance matrix, the server can quantify the spatial relationship between closed contours and provide a basis for subsequent contour grouping. According to the distance matrix, the server groups closed contours whose relative distance is less than a preset first distance threshold into one group to form multiple closed contour groups. The server sets a preset first distance threshold internally to determine whether two closed contours belong to the same group. The selection of the preset first distance threshold is determined in advance according to the scale of the drawing and the size of the geometric features, and this application does not limit this. The server traverses the distance matrix, and for each element D[i][j], if its value is less than or equal to the preset first distance threshold, the i-th and j-th closed contours are grouped into the same group. The server uses a union-find algorithm to merge closed contours belonging to the same group to form multiple independent closed contour groups. For each closed contour group, the server calculates the number of closed contours it contains and the position of the geometric center. The server analyzes the inclusion relationship within each closed contour group, marks and identifies the outer contour and inner contour. The outer contour refers to the outermost contour that contains other contours and represents the overall shape of the part; the inner contour refers to the contour contained within the outer contour and represents the internal features of the part, such as holes, slots, etc. The steps to identify the outer contour and inner contour are as follows: For each contour group, the server analyzes the inclusion relationship between the closed contours it contains. The server determines the inclusion relationship by comparing the positions of the circumscribed rectangles or geometric centers of the contours. If a closed contour is not contained by any other contours, it is marked as an outer contour. There may be multiple outer contours in a contour group. For each outer contour, traverse the other closed contours inside it and mark them as inner contours. Inner contours can be further classified into different types such as holes and slots. If there is only one closed contour in a contour group, it is directly marked as an outer contour, and there is no inner contour. The server determines the valid closed contour representing the main shape of the part based on the identified outer contours and inner contours. Usually, the main shape of a part is determined by one or more outer contours in the outermost layer, while the inner contours inside represent additional features of the part. Therefore, the server can select the outer contour with the largest area or the one that contains the most other contours as a valid closed contour to represent the main shape of the part.
[0056] In a possible implementation, before step S105, the method further includes: determining whether there is a situation in which the first endpoint and the second endpoint do not intersect precisely in the DXF drawing, the first endpoint is the endpoint of the first line segment, the second endpoint is the endpoint of the second line segment, the distance between the first endpoint and the second endpoint is less than a preset second distance threshold, the first line segment is any line segment in the primitive, and the second line segment is any line segment in the primitive except the first line segment; if it is determined that there is a situation in which the first endpoint and the second endpoint do not intersect precisely in the DXF drawing, adjusting the first endpoint so that the first endpoint intersects with the second endpoint.
[0057] Specifically, the server determines whether there is a situation in which the first endpoint and the second endpoint do not intersect accurately in the DXF drawing. The first endpoint refers to the endpoint of the first line segment, and the second endpoint refers to the endpoint of the second line segment, wherein the first line segment and the second line segment are any two different line segments in the drawing. The server determines whether the two endpoints do not intersect accurately by calculating the distance between the first endpoint and the second endpoint and comparing it with the preset second distance threshold. The judgment steps are as follows: the server sets a preset second distance threshold internally to determine whether the two endpoints do not intersect accurately. The selection of the preset second distance threshold needs to be determined according to the scale and drawing accuracy of the drawing, and can usually be set to one ten-thousandth or less of the unit length of the drawing, which is not limited in this application. For each line segment in the drawing, extract its starting point coordinates and end point coordinates, respectively as the first endpoint and the second endpoint. For each first endpoint, traverse all line segments in the drawing except the line segment where it is located, and extract their starting point coordinates and end point coordinates as the second endpoint. The server uses the Euclidean distance formula to calculate the distance between the first endpoint and each second endpoint, and compares the distance value with the second distance threshold. If there is any pair of first endpoints and second endpoints whose distance is less than the second distance threshold but do not completely overlap, it is considered that there is an imprecise intersection of endpoints in the drawing. If the server determines that there is an imprecise intersection of the first endpoint and the second endpoint in the DXF drawing, the position of the first endpoint needs to be adjusted so that it intersects with the second endpoint accurately. For each pair of imprecisely intersecting first endpoints and second endpoints, the server updates the coordinates of the first endpoint to the coordinates of the second endpoint to maintain the integrity of the line segment. For all pairs of imprecisely intersecting endpoints, the server repeats the above steps until there is no imprecise intersection of endpoints in the drawing.
[0058] In a possible implementation, after determining whether the first endpoint and the second endpoint in the DXF drawing do not precisely intersect, the method further includes: determining whether the first line segment and the second line segment completely overlap; if it is determined that the first line segment and the second line segment completely overlap, deleting the first line segment.
[0059] Specifically, for each pair of the first line segment and the second line segment, their starting point coordinates and end point coordinates are extracted. The server compares the starting point coordinates of the first line segment with the starting point coordinates of the second line segment to determine whether they are exactly the same. The server compares the end point coordinates of the first line segment with the end point coordinates of the second line segment to determine whether they are exactly the same. If the starting point coordinates and the end point coordinates of the first line segment and the second line segment are exactly the same, the server determines that the two line segments are completely overlapped. If the server determines that the first line segment and the second line segment are completely overlapped, one of the line segments needs to be deleted to eliminate redundant primitives in the drawing. The deletion steps are as follows: the server selects any one of the first line segment and the second line segment as the object to be deleted, and the server finds the line segment data block of the deleted line segment in the drawing data and removes it from the data structure. For all pairs of completely overlapping line segments, the server repeats the above steps until there are no more completely overlapping line segments in the drawing.
[0060] Step S106: Output the valid closed contour in standard DXF format.
[0061] In step S106 , the server traverses each valid closed contour, converts it into graphic metadata in standard DXF format, and outputs it for subsequent use.
[0062] Reference Figure 2 The present application also provides a device for extracting DXF drawings, which is a server. The server includes an acquisition module 201 and a processing module 202, wherein: the acquisition module 201 is used to read the primitives included in the DXF drawing, and the primitives include line segments and arcs; the processing module 202 is used to pre-process the primitives and determine the key attributes of the primitives, and the key attributes include the starting point coordinates and the end point coordinates; the processing module 202 is also used to determine the closed contours in the DXF drawing according to the key attributes; the processing module 202 is also used to identify the closed contours using a preset contour algorithm to obtain the number, layout and relative position of the closed contours; the processing module 202 is also used to determine the valid closed contours from multiple closed contours according to the number, layout and relative position; the processing module 202 is also used to output the valid closed contours as a standard DXF format.
[0063] In a possible implementation, the processing module 202 preprocesses the primitives to determine the key attributes of the primitives, specifically including: the acquisition module 201 acquires a preset geometric data structure, which represents each primitive in the form of a polyline; when reading each primitive of the DXF drawing, the processing module 202 generates a polyline corresponding to each primitive according to the preset geometric data structure, and approximates the polyline to the corresponding primitive to generate an approximated polyline; the processing module 202 establishes a correspondence between the approximated polyline and the primitive, and determines the key attributes of the primitive based on the correspondence.
[0064] In a possible implementation, when the processing module 202 reads each primitive of a DXF drawing, the processing module 202 generates a polyline corresponding to each primitive according to a preset geometric data structure, and approximates the polyline to the corresponding primitive. After the approximated polyline is generated, the method further includes: if the processing module 202 determines that the primitive is an arc, then it is determined whether the arc is a component of the outer contour of the part or a component of the inner contour of the part; if the processing module 202 determines that the arc is a component of the outer contour of the part, then the polyline corresponding to the arc is a polyline tangent to the arc; if the processing module 202 determines that the arc is a component of the inner contour of the part, then the polyline corresponding to the arc is a polyline tangent to the arc.
[0065] In a possible implementation, the processing module 202 determines the closed contour in the DXF drawing based on the key attributes, specifically including: the processing module 202 constructs the topological relationship of the primitives based on the starting point coordinates and the end point coordinates; the processing module 202 identifies the target primitives based on the topological relationship, and the target primitives are the primitives that are interconnected among the primitives; the processing module 202 determines whether the target primitives constitute a closed path; if the processing module 202 determines that the target primitives constitute a closed path, then it determines that the target primitives constitute a closed contour.
[0066] In a possible implementation, the processing module 202 determines a valid closed contour from a plurality of closed contours according to the quantity, layout and relative position, specifically including: the processing module 202 calculates the geometric center of each closed contour according to the quantity, layout and relative position; the processing module 202 calculates the distance matrix between each closed contour according to the geometric center; the processing module 202 groups the closed contours whose relative distance is less than a preset first distance threshold into a group according to the distance matrix to form a plurality of closed contour groups; the processing module 202 analyzes the inclusion relationship of each closed contour group, marks and identifies the outer contour and the inner contour; the processing module 202 identifies the valid closed contour representing the main shape of the part according to the outer contour and the inner contour.
[0067] In a possible implementation, before the processing module 202 determines a valid closed contour from a plurality of closed contours according to the quantity, layout and relative position, the method further includes: the processing module 202 determines whether there is a situation in which the first endpoint and the second endpoint do not intersect precisely in the DXF drawing, the first endpoint is the endpoint of the first line segment, the second endpoint is the endpoint of the second line segment, the distance between the first endpoint and the second endpoint is less than a preset second distance threshold, the first line segment is any line segment in the primitive, and the second line segment is any line segment in the primitive except the first line segment; if the processing module 202 determines that there is a situation in which the first endpoint and the second endpoint do not intersect precisely in the DXF drawing, the first endpoint is adjusted so that the first endpoint intersects with the second endpoint.
[0068] In a possible implementation, after the processing module 202 determines whether there is an inaccurate intersection between the first endpoint and the second endpoint in the DXF drawing, the method further includes: the processing module 202 determines whether the first line segment and the second line segment completely overlap; if the processing module 202 determines that the first line segment and the second line segment completely overlap, deleting the first line segment.
[0069] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0070] The present application also provides an electronic device. Figure 3 , Figure 3 The electronic device 300 may include: at least one processor 301 , at least one network interface 304 , a user interface 303 , a memory 305 , and at least one communication bus 302 .
[0071] The communication bus 302 is used to realize the connection and communication between these components.
[0072] The user interface 303 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.
[0073] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0074] Among them, the processor 301 may include one or more processing cores. The processor 301 uses various interfaces and lines to connect various parts in the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 305, and calling data stored in the memory 305. Optionally, the processor 301 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 301 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 301, and it can be implemented separately through a chip.
[0075] Among them, the memory 305 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 305 includes a non-transitory computer-readable storage medium. The memory 305 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 305 may optionally also be at least one storage device located away from the aforementioned processor 301. Refer to Figure 3 , the memory 305 as a computer storage medium may include an operating system, a network communication module, a user interface module and an application program of a DXF drawing extraction method.
[0076] exist Figure 3In the electronic device 300 shown, the user interface 303 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 301 can be used to call an application program for storing a method for extracting a DXF drawing in the memory 305. When executed by one or more processors 301, the electronic device 300 executes one or more of the methods described in the above embodiments. It should be noted that for the aforementioned method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application.
[0077] The present application also provides a computer-readable storage medium, which stores instructions. When executed by one or more processors 301, the electronic device 300 executes one or more of the methods described in the above embodiments.
[0078] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0079] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0080] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0081] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0082] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: various media that can store program codes, such as USB flash drives, mobile hard drives, magnetic disks or optical disks.
[0083] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, those skilled in the art will easily think of other embodiments of the present disclosure.
[0084] This application is intended to cover any variation, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the art not described in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. A method for extracting DXF drawings, characterized in that: The method comprises: Reading primitives included in a DXF drawing, wherein the primitives include line segments and arcs; Preprocessing the graphic element to determine key attributes of the graphic element, wherein the key attributes include a starting point coordinate and an end point coordinate; Determining a closed contour in the DXF drawing based on the key attributes; Using a preset contour algorithm to identify the closed contours, and obtain the number, layout and relative positions of the closed contours; determining a valid closed contour from the plurality of closed contours according to the number, the layout, and the relative position; The valid closed contour is exported in standard DXF format.
2. The method according to claim 1, characterized in that The pre-processing of the graphic element to determine the key attributes of the graphic element specifically includes: Acquire a preset geometric data structure, wherein the preset geometric data structure represents each of the graphic elements in the form of a polyline; When reading each primitive of the DXF drawing, generating a polyline corresponding to each primitive according to the preset geometric data structure, and approximating the polyline to the corresponding primitive to generate an approximated polyline; A correspondence between the approximation polyline and a graphic primitive is established, and a key attribute of the graphic primitive is determined according to the correspondence.
3. The method according to claim 2, characterized in that When reading each primitive of the DXF drawing, generating a polyline corresponding to each primitive according to the preset geometric data structure, and approximating the polyline to the corresponding primitive, after generating the approximated polyline, the method further includes: If it is determined that the graphic element is an arc, then determining whether the arc is a component of the outer contour of the part or a component of the inner contour of the part; If it is determined that the circular arc is a component of the outer contour of the part, then the broken line corresponding to the circular arc is a broken line circumscribing the circular arc; If it is determined that the circular arc is a component of the inner contour of the part, then the broken line corresponding to the circular arc is a broken line inscribed in the circular arc.
4. The method according to claim 1, wherein Determining the closed contour in the DXF drawing according to the key attributes specifically includes: Constructing a topological relationship of the graphic element according to the starting point coordinates and the end point coordinates; Identifying target primitives according to the topological relationship, wherein the target primitives are interconnected primitives among the primitives; Determining whether the target graphic element forms a closed path; If it is determined that the target graphic elements form a closed path, then it is determined that the target graphic elements form a closed contour.
5. The method according to claim 1, wherein Determining a valid closed contour from the plurality of closed contours according to the quantity, the layout, and the relative positions specifically includes: Calculating the geometric center of each of the closed contours according to the quantity, the layout, and the relative position; Calculate the distance matrix between each closed contour according to the geometric center; According to the distance matrix, closed contours whose relative distance is less than a preset first distance threshold are grouped together to form a plurality of closed contour groups; Analyzing the inclusion relationship of each closed contour group, marking and identifying the outer contour and the inner contour; A valid closed contour representing the main shape of the part is identified based on the outer contour and the inner contour.
6. The method according to claim 1, wherein Before determining a valid closed contour from the plurality of closed contours according to the quantity, the layout, and the relative positions, the method further includes: Determining whether a first endpoint and a second endpoint in the DXF drawing do not precisely intersect, where the first endpoint is an endpoint of a first line segment, the second endpoint is an endpoint of a second line segment, a distance between the first endpoint and the second endpoint is less than a preset second distance threshold, the first line segment is any line segment in the graphic primitive, and the second line segment is any line segment in the graphic primitive other than the first line segment; If it is determined that the first endpoint and the second endpoint in the DXF drawing do not intersect precisely, the first endpoint is adjusted so that the first endpoint intersects with the second endpoint.
7. The method according to claim 6, characterized in that After determining whether the first endpoint and the second endpoint in the DXF drawing do not intersect accurately, the method further includes: Determining whether the first line segment and the second line segment completely overlap; If it is determined that the first line segment and the second line segment completely overlap, the first line segment is deleted.
8. A DXF drawing extraction device, characterized in that: The device comprises an acquisition module (201) and a processing module (202), wherein: The acquisition module (201) is used to read the graphic elements included in the DXF drawing, wherein the graphic elements include line segments and arcs; The processing module (202) is used to pre-process the primitives and determine key attributes of the primitives, wherein the key attributes include starting point coordinates and end point coordinates; The processing module (202) is further configured to determine a closed contour in the DXF drawing based on the key attributes; The processing module (202) is further configured to identify the closed contours using a preset contour algorithm to obtain the number, layout, and relative positions of the closed contours; The processing module (202) is further configured to determine a valid closed contour from the plurality of closed contours according to the number, the layout, and the relative position; The processing module (202) is further configured to output the valid closed contour in a standard DXF format.
9. An electronic device, characterized in that: The electronic device (300) comprises a processor (301), a memory (305), a user interface (303) and a network interface (304), wherein the memory (305) is used to store instructions, the user interface (303) and the network interface (304) are used to communicate with other devices, and the processor (301) is used to execute the instructions stored in the memory (305) so that the electronic device (300) executes the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is executed.
Citation Information
Patent Citations
Recognition system and method for construction engineering drawing, and template arrangement system and method
CN105302931A
Bitmap contour coordinate extraction method for cutting bed
CN110020657A
Robot offline programming information processing system and method
CN110625615A
DXF format-based house type image information extraction and vectorization method and device
CN114092952A
Method for automatically identifying structure boundary and orderly arranging structure boundary
CN115048723A
Cited By
Cross section drawing method and system based on computer vision
CN119691876A
Automatic reconstruction method from two-dimensional engineering drawing to three-dimensional entity based on DXF
CN121234427A
