A method for automatically detecting and repairing cutting material pattern defects
By collecting and integrated graphics information in the DXF format drawing, the problem of graphic defects during the cutting of the cutting off -cutting is solved, and the graphic self -closure and no heavy lines are realized, and the production efficiency and equipment recognition rate is improved.
Patent Information
- Application Number
- CN202010841725.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-20
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2040-08-20
AI Technical Summary
During the cutting and unloading process, there are often repeated lines and unclosed graphics defects in the DXF format drawings, which leads to the unrecognition of the equipment and affects production.
By scanning DXF format documents, collecting single -line segments, arcs, composite line segments, and round graphics information, integrated intersection, remove invalid information, and form a closed and unsatrier line.
The self -closure and heavy lines of graphics are realized to ensure that the feeding equipment can be recognized, improve production efficiency, and reduce the intensity of artificial labor.
Smart Images

Figure CN111951256B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method for detecting and repairing defects in cutting and blanking graphics, and belongs to the technical field of automatic processing of graphics drawing. Background Art
[0002] Cutting is one of the important links in the entire machinery manufacturing, including laser cutting, plasma cutting and water jet cutting, and such equipment generally uses DXF format drawings for typesetting. The acquisition of DXF format drawings can be converted by 3D software after expansion, or it can be drawn directly, but in this process, some repeated lines or unclosed figures will be found. Unclosed points and overlapping lines are interference information, which directly causes the equipment to fail to recognize and cannot be used, affecting production.
[0003] According to the characteristic that the cutting graphics must be closed graphics, before cutting, it is necessary to carefully check whether the graphics are disconnected, whether there are overlapping lines, and whether there are breaks. However, in actual operation, most of the defects are very small and need to be magnified many times to be found. Therefore, manually checking the defects of the drawings is not only time-consuming and labor-intensive, but also difficult to succeed at one time, especially complex graphics often need to be checked repeatedly on the computer. The system built with C language has a simple structure and can extract graphic information through the DXF drawing code group format, integrate calculations, repair and redraw defects within the extreme value, and mark and output defects exceeding the extreme value. Summary of the invention
[0004] The technical problem to be solved by the present invention is: how to realize that the blanking figure is a complete closed figure without overlapping lines.
[0005] The working principle of the present invention is: according to the DXF format drawing, the graphic information of single line segment, compound line segment, arc and full circle is collected, and the intersection points between them are integrated, and the invalid information is removed to achieve the purpose of being identifiable by the blanking equipment.
[0006] In order to solve the above technical problems, the present invention is implemented through the following technical solutions.
[0007] A method for detecting and repairing cutting pattern defects, comprising the following steps:
[0008] 1) Scan all DXF format documents and read the specified graphic information according to the graphic group code keywords of the DXF format documents. The graphics include single line segments, arcs, compound line segments, and full circles;
[0009] 2) Integrate the intersections of single line segments, arcs, compound line segments, and full circles to form new graphic information;
[0010] 3) Check the graphic information obtained in step 2) to see if there are breakpoints at the endpoints. If so, mark the breakpoint coordinates as special marks and output the DXF document graphics. If not, proceed to step 4); 4) Output the final DXF document data stream.
[0011] The beneficial effects achieved by the present invention are as follows: the method for detecting and repairing defects in cutting and blanking graphics of the present invention uses C language as a framework, automatically identifies drawings in DXF format files in batches, collects valid graphic information of single line segments, arcs, compound line segments, and full circles, and then redraws the graphics output through an endpoint integration method, so as to achieve the purpose of having no overlapping lines and being self-closed. It can be operated in batches, effectively solve defects in cutting and blanking drawings, and realize self-closure of drawings. The method of the present invention realizes functions with one key, is simple to operate, has low hardware requirements, solves the problem of missing defects in manual search for drawings, has high accuracy, shortens the inspection time of cutting and blanking drawings, and not only improves production efficiency, but also reduces manual labor intensity. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 It is a flow chart of the method for detecting and repairing cutting pattern defects of the present invention;
[0013] Figure 2 A schematic diagram of the execution document location;
[0014] Figure 3 This is a schematic diagram of the system's self-running interface;
[0015] Figure 4 Comparison chart of intersection integration calculation results;
[0016] Figure 5 This is a comparison chart of the coincidence point inspection results;
[0017] Figure 6 This is a schematic diagram of the DXF output directory. DETAILED DESCRIPTION
[0018] The DXF format is an open 3D graphics software interface suitable for a wide range of computer environments. DXF is the standard data exchange format for CAD drawings. The system's feature data reading function is based on the DXF format drawings used for cutting and blanking. There are a large number of invalid codes in the drawing information, such as layers, point features, and various graphics with line widths less than 0. Through the established format and key characters of DXF, the code group and value pair are collected to determine whether the target is valid information.
[0019] Through multiple verifications, CAD drawing defects mainly include the following types: one is the overlapped segments that appear in the single line segment. This overlap often has a certain angle and is not completely 100% overlapped; the other is that the end points of the graphics do not overlap, that is, the graphics are not closed and there are breakpoints. This type of defect may occur during the process of converting 3D expansion to CAD drawings, or it may be a direct error during CAD drawing. Curved graphics are mostly directly converted from 3D software modeling, and CAD drawings convert curves into composite line segments. Therefore, collecting graphic information of single line segments, composite line segments, arcs and full circles can include the graphics required for cutting and blanking.
[0020] The single line segment overlap integration is based on the fact that single line segment graphics in CAD drawings often have overlapping problems, while arcs do not have similar problems. Single line segment overlap can be divided into two cases. One is that both endpoints overlap, and the start and end points of the overlapped single line segment are directly assigned nt=10. -13 ; Second, if the endpoints on one side overlap, the two single line segments need to be merged, and the invalid coordinates are assigned nt. The value assigned to the invalid endpoint is because the collected coordinate values are in the 12th decimal place, and the same coordinates will not occur.
[0021] The calculation of the arc endpoint is based on the collected arc start angle, end angle, radius and center coordinates. Due to the mathematical model calculation relationship, it cannot be accurate, and the result is a finite rounded number. Through experiments, it is found that when the arc endpoint is less than 0.00001 from the connection endpoint, it does not affect the recognition problem of the cutting and blanking equipment. Therefore, the system sets the overlap judgment of the arc endpoint to a distance less than 0.00001.
[0022] The information collection and integration of the composite line segment graphics only requires the calculation of endpoints. In the DXF format, multiple composite line segments are defined according to nodes, and the nodes must be connected. However, when calculating the intersection, only the starting point coordinates can be updated for the starting point of the composite line segment, and the intersection direction can only be toward the starting point; only the end point coordinates can be updated for the end point of the composite line segment, and the intersection direction can only be toward the end point.
[0023] Example 1
[0024] The present invention will be further described below in conjunction with the accompanying drawings.
[0025] like Figure 1 The flowchart of the method for detecting and repairing defects in cutting and blanking patterns of the present invention is shown. The method for detecting and repairing defects in cutting and blanking patterns of the present invention comprises the following steps:
[0026] 1) Scan all DXF format documents and read the specified graphic information according to the graphic group code keywords of the DXF format documents. The graphics include single line segments, arcs, compound line segments, and full circles;
[0027] 2) Integrate the intersections of single line segments, arcs, compound line segments, and full circles to form new graphic information;
[0028] 3) Check the graphic information obtained in step 2) to see if there are any overlapping endpoints. If so, mark the breakpoint coordinates as special marks and output the DXF document graphics. If not, proceed to step 4); 4) Output the final DXF document data stream.
[0029] In step 1), if Figure 2 As shown, after clicking the execution file, all DXF format documents in the same directory and subdirectories of the execution document storage location are automatically scanned, and valid information is collected through the DXF graphic format. The DXF graphic format is composed of group codes and associated value pairs. The group code indicates the type of the value pair that follows. When reading, first read the entity line width through the keyword AcDbEntity\n. The group code 370 value pair is less than 0 for invalid information, and only when the value pair is greater than or equal to 0 is it valid graphic information; then, only the specified graphic information is read according to the graphic group code keyword,
[0030] The keyword for the full circle is: AcDbCircle\n, which collects the coordinates of the center and radius of the circle;
[0031] The keyword for a single line segment is: AcDbLine\n, which collects the coordinates of both end points;
[0032] The keyword of the composite line segment is: AcDb2dVertex\n, which is composed of multiple line segments, controlled by endpoints and intermediate nodes, and collects the coordinates of each node and endpoint;
[0033] The keyword for the arc is: AcDbArc\n. The center coordinates, radius, start angle and end angle are collected. The start and end coordinates of the arc are calculated using a mathematical model based on the collected information. The code group format does not control the arc according to the start and end coordinates, but according to the arc angle. This conversion calculation process is actually a geometric calculation.
[0034] In step 2), the intersection points of each single line segment, arc, compound line segment, and full circle are integrated, including the following steps:
[0035] 21) Integration of intersections between single line segments:
[0036] a. First, delete the coincident endpoints and overlapping single line segments between single line segments. The specific process is as follows:
[0037] The function point Line_Repeat() is used to fuzzy calculate the overlapping single line segments and invalid single line segments. The overlapping single line segments are defined as the angle difference between the two single line segments is less than 1°, and the minimum distance from the endpoint of a single line segment to the other single line segment is less than 2. The invalid single line segment is defined as 10 -13;
[0038] b. Integrate the intersection points between single line segments: If there are no overlapping endpoints between any two single line segments, use the function point Get_Line_Line_Cross() to recalculate the endpoints of the two single line segments, that is, the connection point. The connection point is closest to the endpoints of the two single line segments and the distance is less than 3. Return the coordinates of the intersection point between the single line segments and assign them to the closer endpoints of the two single line segments, such as Figure 4 shown.
[0039] 22) Integration of intersection points between single line segments and arcs: After the arc information is collected, there are no start point coordinates and end point coordinates, but they are obtained through calculation, which has calculation errors. Therefore, point Get_Line_Arc_Cross() is used to fuzzily calculate that the distance between the end point of the single line segment and the end point of the arc is less than the set value (such as 0.00001) as the next connection target. Because the graphics want to be closed, the end point of a single line segment must be connected to the start point of another line, and the intersection point between the single line segment and the arc is returned (and assigned values respectively. After the arc updates the end point coordinates, the arc start point and end point angles required for outputting the DXF data stream are recalculated, such as Figure 4 shown.
[0040] 23) Integration calculation of intersections between arcs: The arc whose endpoint distance is less than the set value (such as 0.00001) is calculated as the next connection point. If there is no overlap between arc A and arc B, define the arc whose endpoint distance to arc A is less than the set value (such as 2) as the next connection target, and use the point Get_Arc_Arc_Cross() function to obtain the intersection between the arcs, recalculate and update the arc start and end angles to realize the output of DXF data stream.
[0041] 24) Integration calculation of intersection points of composite line segments: In DXF format files, the middle nodes of multiple composite line segments are interconnected. There is no need to consider whether there are breakpoints. It is only necessary to determine whether there are overlapping points between the starting endpoint and the single line segment or arc. For example, the starting point of a composite line segment and the second node of the composite line segment form a single line segment. The single line segment method is directly used to calculate whether there are overlapping points, and the starting point coordinates are updated based on the result.
[0042] 25) Integration of the whole circle. After the whole circle obtains information in the DXF format document, due to its self-closed nature, there is no need for integration calculation and it can be directly output as a DXF document data stream.
[0043] In step 3), coincidence check, also known as breakpoint check, is performed by traversing all single line segments, compound line segments, and arc endpoints to check whether there are breakpoints between the lines. When performing arc endpoint-related calculations, if the distance between endpoints is less than a set value (such as 0.00001), it is determined that an endpoint exists. Finally, the breakpoint coordinates are marked with a red circle with a radius of 5 and output in the final DXF document graphic, as shown in the figure below. Figure 5 shown.
[0044] In step 4), the integrated DXF data stream is output and the output results are counted. Blue indicates successful conversion, red indicates failure, and there are non-closed points, such as Figure 3 The execution results are stored in the newly created "OK!" folder according to this structure, as shown in Figure 6 shown.
[0045] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A method for detecting and repairing cutting pattern defects, characterized in that: The following steps are involved: 1) Scan all DXF format documents and read the specified graphic information according to the graphic group code keywords of the DXF format documents. The graphics include single line segments, arcs, compound line segments, and full circles; 2) Integrate the intersections of the single line segments, arcs, compound line segments, and full circles to form new graphic information, including the following steps: 21) Integration of intersections between single line segments: a. First, delete the coincident endpoints and overlapping single line segments between single line segments. The specific process is as follows: Use the function point Line_Repeat() to fuzzily calculate the overlapping single line segments and invalid single line segments; b. Integrate the intersection points between single line segments: If there are no coincident endpoints between any two single line segments, use the function point Get_Line_Line_Cross() to recalculate the endpoints of the two single line segments, i.e., the connection points. The minimum distance between the connection point and the two end points is calculated respectively. If it is less than 3, the coordinates of the intersection point between the single line segments are returned and assigned to the endpoints of the two single line segments that are closer in distance. 22) Integration of intersection points between single line segments and circular arcs: Use point Get_Line_Arc_Cross() to fuzzily calculate the distance between the endpoint of a single line segment and the endpoint of a circular arc that is less than the set value as the next connection target, return the intersection point between the single line segment and the circular arc, and assign the values to the endpoints of the single line segment and the circular arc that are closer to the connection point; 23) Integration calculation of the intersection between arcs: If there is no overlap between arc A and arc B, define the arc whose end point distance from arc A is less than the set value as the next connection target, and use the point Get_Arc_Arc_Cross() function to obtain the intersection between the arcs, and recalculate and update the arc start angle and end point angle; 24) Integration calculation of intersection points of composite line segments: only determine whether the starting endpoint has overlapping points with single line segments or arcs; 3) Check the graphic information obtained in step 2) to see if there are breakpoints at the endpoints. If yes, mark the breakpoint coordinates as special marks and output the DXF document graphics. If no, proceed to step 4); 4) Output the final DXF document data stream.
2. The method for detecting and repairing cutting pattern defects according to claim 1, characterized in that: In the step 1), The keyword for the full circle is: AcDbCircle\n, which collects the coordinates of the center and radius of the circle; The keyword for a single line segment is: AcDbLine\n, which collects the coordinates of both end points; The keyword of the composite line segment is: AcDb2dVertex\n, which is composed of multiple line segments, controlled by endpoints and intermediate nodes, and collects the coordinates of each node and endpoint; The keyword for the arc is: AcDbArc\n, which collects the center coordinates, radius, start angle and end angle.
3. The method for detecting and repairing cutting pattern defects according to claim 1, characterized in that: The overlapping single line segments are defined as those where the angle difference between the two single line segments is less than 1°, and the minimum distance from the endpoint of a single line segment to another single line segment is less than 2. Invalid single line segments are defined as 10 -13 .
4. The method for detecting and repairing cutting pattern defects according to claim 1, characterized in that: Also includes: In step 3), coincidence point check: traverse all single line segments, compound line segments and arc endpoints to check whether there are breakpoints between the lines. When performing arc endpoint-related calculations, if the distance between endpoints is less than the set value, it is determined that there is an endpoint; Finally, the breakpoint coordinates are marked as special marks and output in the final DXF document drawing.
Citation Information
Patent Citations
Image processing method for visual inspection system
CN107356232A
Method for numerical control processing feature automatic identification and path planning
CN107479504A