Coarse and fine step-by-step screening method for defect coordinates of three-axis numerical control machining G code

文档序号:85250 发布日期:2021-10-08 浏览:30次 中文

阅读说明:本技术 一种三轴数控加工g代码缺陷坐标的粗精分步筛选方法 (Coarse and fine step-by-step screening method for defect coordinates of three-axis numerical control machining G code ) 是由 吕盾 宋彦宏 刘辉 赵万华 于 2021-07-05 设计创作,主要内容包括:一种三轴数控加工G代码缺陷坐标的粗精分步筛选方法,首先要对G代码文件进行坐标数值提取,进行基于几何特征求解的粗筛选过程,计算曲率、弓高、拐角、线段长度、相邻线段差等几何特征,并对求解结果进行排序,选取曲率、弓高、拐角及线段差的极大值的前10%的坐标位置,线段长的极小值的前10%的坐标位置,形成粗筛选结果;根据粗筛选结果利用三次样条插值对粗筛选缺陷坐标点构建趋势轨迹,基于该轨迹求解粗筛选嫌疑坐标对应的理想坐标点,并求出理想坐标点到粗筛选缺陷坐标点的误差,通过箱型图的方式找到误差值异常大的坐标位置,作为精筛选结果,完成精筛选过程;本发明避免筛选出正确坐标,实现G代码缺陷坐标位置的智能诊断。(A coarse and fine step-by-step screening method for G code defect coordinates through triaxial numerical control machining comprises the steps of firstly, extracting coordinate values of a G code file, carrying out a coarse screening process based on geometric feature solving, calculating geometric features such as curvature, arch height, corners, line segment lengths, adjacent line segment differences and the like, sequencing solving results, selecting coordinate positions of the first 10% of the maximum value of the curvature, arch height, corner and line segment differences and coordinate positions of the first 10% of the minimum value of the line segment lengths, and forming a coarse screening result; constructing a trend track for the roughly screened defect coordinate points by utilizing cubic spline interpolation according to the roughly screening result, solving ideal coordinate points corresponding to the roughly screened suspect coordinates based on the trend track, solving errors from the ideal coordinate points to the roughly screened defect coordinate points, finding coordinate positions with abnormally large error values in a box-type graph mode to serve as a fine screening result, and finishing a fine screening process; the invention avoids screening out correct coordinates and realizes intelligent diagnosis of G code defect coordinate positions.)

1. A coarse and fine step-by-step screening method for defect coordinates of a three-axis numerical control machining G code is characterized by comprising the following steps:

1) extracting coordinate data of an X axis, a Y axis and a Z axis from the G code: removing address characters in the size characters from the file with the G code nc format, and separating and extracting coordinate data of an X axis, a Y axis and a Z axis;

2) calculating five geometric characteristics of curvature, arch height, corner, micro-segment length and adjacent segment difference: connecting the extracted coordinate data into tracks, and then respectively calculating five geometric characteristics; let the nth point in the G code be Pn(xn,yn,zn) The previous point, i.e. the n-1 point is Pn-1(xn-1,yn-1,zn-1) The latter point, i.e. the n +1 th point, is Pn+1(xn+1,yn+1,zn+1) The three points form a space circle, the curvature is calculated according to a formula (1), the arch height is calculated according to a formula (2), the corner is calculated according to a formula (3), the length of the line segment is calculated according to a formula (4), and the difference between adjacent line segments is calculated according to a formula (5);

di=dn+1-dn (5)

in the formula, an,bn,cnRespectively representing the lengths, k, of the three sides constituting the triangle in spacenRepresenting curvature of the nth point;gnThe arch height of the nth point is shown,is a convolution symbol; alpha is alphanA corner representing an nth point; dnIndicating a length of the second segment; di represents a segment length difference;

3) selecting a coarse screening result: sorting the calculation results of the step 2), and setting a coarse screening proportion to form a coarse screening result;

4) and (3) performing trend construction based on the coarse screening result, and solving an ideal coordinate corresponding to the defect coordinate: let the coarse screening result be Q1(X1,Y1),Q2(X2,Y2)……Qn(Xn,Yn) For each coordinate Qi(Xi,Yi) Respectively tracing 10 correct point locations forwards and backwards, skipping if meeting the point locations of the coarse screening result, and setting the coordinates of the 10 correct point locations forwards as t1(x1,y1),t2(x2,y2),……t10(x10,y10) The coordinates of the backward 10 correct point positions are respectively u1(x1,y1),u2(x2,y2),……u10(x10,y10) Respectively carrying out 3 times of spline interpolation by using the point positions to obtain a trend tool position track expression which is shown in a formula (6); then roughly screening the horizontal coordinate X of the defect pointiSubstituting into formula (6), solving to obtain ideal coordinates I under the trend tracks of the front and the back tool positionsFront i(mi,ni),IAfter i(mi,ni);

In the formula, xiThe horizontal coordinate of the starting point of the last section of the interpolation is taken; t and U are coefficients to be solved respectively;

5) and (3) carrying out error solving from the defect coordinate point of the coarse screening result to the ideal coordinate point of the tool position trend track: the solving method follows equation (7):

in the formula, h is the distance from the coordinate of the roughly screened defect point to the coordinate of the ideal point, and L is the distance between two adjacent points before and after the roughly screened defect point;

6) selecting a fine screening result: screening the abnormal large values of the error solving results by using the box diagram to complete the fine screening process; the box diagram is a diagram for describing data through a lower quartile, a median, an upper quartile, an upper limit and a lower limit, and the specific construction method of the box diagram is as follows: let a set of sequence numbers contain n items, arrange them from small to large, and solve the lower quartile Q1Median Q2Upper quartile Q3Wherein Q isiIs located at position PQiI (n +1)/4, i 1,2,., n; solve the upper term N againmax,Nmax=Q3+1.5(Q3-Q1) The following item Nmin,Nmin=Q1-1.5(Q3-Q1) Wherein, the value larger than the above item is an abnormal value and is also a value to be screened out.

2. The coarse and fine step-by-step screening method for the defect coordinates of the three-axis numerical control machining G code according to claim 1, which is characterized in that: the method for solving the curvature in the step 2) comprises the following steps: the nth point P in the G coden(xn,yn,zn) N-1 point Pn-1(xn-1,yn-1,zn-1) N +1 th point Pn+1(xn+1,yn+1,zn+1) The three points form a space circle, the curvature of the circle is calculated according to the formula (1), the curvature is the curvature of the nth point, when the circle formed by the three points is clockwise, the curvature takes a negative value, and when the circle formed by the three points is anticlockwise, the curvature takes a positive value;

the bow height solving method comprises the following steps: sequentially connecting the n-1 point Pn-1(xn-1,yn-1,zn-1) N point Pn(xn,yn,zn) N +1 th point Pn+1(xn+1,yn+1,zn+1) Three points, passing PnMaking a vertical line segment of a connecting line of the front point and the rear point, wherein the length of the vertical line segment is the arch height value, and solving according to a formula (2);

the solving method of the corner comprises the following steps: connecting the n-1 st point Pn-1And the nth point Pn(xn,yn,zn) (ii) a The nth point Pn(xn,yn,zn) And n +1 point Pn+1And is extended, the extension line and PnPn+1The included angle alpha is the corner, and the solution is specifically carried out according to the formula (3);

the line length calculation method is to calculate the distance d between adjacent coordinate points, and the distance d is solved according to the formula (4);

and calculating the length difference of the line segments based on the length of the line segments, namely the length difference of two adjacent micro-line segments according to a formula (5).

3. The coarse and fine step-by-step screening method for the defect coordinates of the three-axis numerical control machining G code according to claim 1, which is characterized in that: the coarse screening proportion in the step 3) is set to be 10 percent.

Technical Field

The invention belongs to the technical field of numerical control machine tools, and particularly relates to a coarse and fine step-by-step screening method for defect coordinates of a three-axis numerical control machining G code.

Technical Field

The numerical control processing needs CAD three-dimensional modeling, CAM post-processing generates G codes, and then the G codes are input into a numerical control system for processing and other processes. In the CAM, a complex curved surface model is discretized into a huge number of tiny straight line segments to approximate an original curve, and a G code consisting of the tiny straight line segments in the form of G1, namely a tool machining path, is formed. In actual machining, due to the problem of CAD or CAM post-processing, defects or wrong coordinate points which are inconsistent with the original model contour often appear on the tool path, so that the error between the tool path and the original model contour is increased, and the machining precision is influenced; the feeding speed is also slowed, and the processing efficiency is influenced; sometimes, the defect code line segment can cause the acceleration and the jerk to change violently, and the mechanical structure of the machine tool is excited to vibrate.

At present, a plurality of mature researches are carried out on the aspects of fitting a cutter path micro line segment and smoothing a G code track, but an effective and accurate method for screening defect coordinates of the G code is still lacked in the early stage of fitting and smoothing the G code track, the defect coordinates are classified in some researches, a search method is provided for each type, however, the type of the G code defect coordinates is complex in reality, the classification of the existing method is not comprehensive, all defect coordinates cannot be found, the search method only considers geometric features, correct coordinates are easy to screen out as the defect coordinates, and the purpose of effective preprocessing of the G code micro line segment spline in the early stage of fitting cannot be met.

Disclosure of Invention

In order to overcome the defects of the prior art, the invention aims to provide a coarse and fine step-by-step screening method for G code defect coordinates through three-axis numerical control machining, which can effectively solve the problem of multiple defect types, simultaneously avoid screening correct coordinates and realize intelligent diagnosis of G code defect coordinate positions.

In order to achieve the purpose, the invention adopts the technical scheme that:

a coarse and fine step-by-step screening method for defect coordinates of a three-axis numerical control machining G code comprises the following steps:

1) extracting coordinate data of an X axis, a Y axis and a Z axis from the G code: removing address characters in the size characters from the file with the G code nc format, and separating and extracting coordinate data of an X axis, a Y axis and a Z axis;

2) calculating five geometric characteristics of curvature, arch height, corner, micro-segment length and adjacent segment difference: connecting the extracted coordinate data into tracks, and then respectively calculating five geometric characteristics; let the nth point in the G code be Pn(xn,yn,zn) The previous point, i.e. the n-1 point is Pn-1(xn-1,yn-1,zn-1) The latter point, i.e. the n +1 th point, is Pn+1(xn+1,yn+1,zn+1) The three points form a space circle, the curvature is calculated according to a formula (1), the arch height is calculated according to a formula (2), the corner is calculated according to a formula (3), the length of the line segment is calculated according to a formula (4), and the difference between adjacent line segments is calculated according to a formula (5);

di=dn+1-dn (5)

in the formula, an,bn,cnRespectively representing the lengths, k, of the three sides constituting the triangle in spacenRepresents the curvature of the nth point; gnThe arch height of the nth point is shown,is a convolution symbol; alpha is alphanA corner representing an nth point; dnIndicating a length of the second segment; di represents a segment length difference;

3) selecting a coarse screening result: sorting the calculation results of the step 2), and setting a coarse screening proportion to form a coarse screening result;

4) and (3) performing trend construction based on the coarse screening result, and solving an ideal coordinate corresponding to the defect coordinate: let the coarse screening result be Q1(X1,Y1),Q2(X2,Y2)……Qn(Xn,Yn) For each coordinate Qi(Xi,Yi) Respectively tracing 10 correct point locations forwards and backwards, skipping if meeting the point locations of the coarse screening result, and setting the coordinates of the 10 correct point locations forwards as t1(x1,y1),t2(x2,y2),……t10(x10,y10) The coordinates of the backward 10 correct point positions are respectively u1(x1,y1),u2(x2,y2),……u10(x10,y10) Respectively carrying out 3 times of spline interpolation by using the point positions to obtain a trend tool position track expression which is shown in a formula (6); then roughly screening the horizontal coordinate X of the defect pointiSubstituting into formula (6), solving to obtain ideal coordinates I under the trend tracks of the front and the back tool positionsFront i(mi,ni),IAfter i(mi,ni);

In the formula, xiThe horizontal coordinate of the starting point of the last section of the interpolation is taken; t and U are coefficients to be solved respectively;

5) and (3) solving the error e from the defect coordinate point of the coarse screening result to the ideal coordinate point of the tool position trend track: the solving method follows equation (7):

in the formula, h is the distance from the coordinate of the roughly screened defect point to the coordinate of the ideal point, and L is the distance between two adjacent points before and after the roughly screened defect point;

6) selecting a fine screening result: screening the abnormal large values of the error solving results by using the box diagram to complete the fine screening process; the box diagram is a diagram for describing data through a lower quartile, a median, an upper quartile, an upper limit and a lower limit, and the specific construction method of the box diagram is as follows: let a set of sequence numbers contain n items, arrange them from small to large, and solve the lower quartile Q1Median Q2Upper quartile Q3Wherein Q isiIs located at position PQiI (n +1)/4, i 1,2,., n; solve the upper term N againmax,Nmax=Q3+1.5(Q3-Q1) The following item Nmin,Nmin=Q1-1.5(Q3-Q1) Wherein, the value larger than the above item is an abnormal value and is also a value to be screened out.

The method for solving the curvature in the step 2) comprises the following steps: the nth point P in the G coden(xn,yn,zn) N-1 point Pn-1(xn-1,yn-1,zn-1) N +1 th point Pn+1(xn+1,yn+1,zn+1) The three points form a space circle, the curvature of the circle is calculated according to the formula (1), the curvature is the curvature of the nth point, when the circle formed by the three points is clockwise, the curvature takes a negative value, and when the circle formed by the three points is anticlockwise, the curvature takes a positive value;

the bow height solving method comprises the following steps: sequentially connecting the n-1 point Pn-1(xn-1,yn-1,zn-1) N point Pn(xn,yn,zn) N +1 th point Pn+1(xn+1,yn+1,zn+1) Three points, passing PnMaking a vertical line segment of a connecting line of the front point and the rear point, wherein the length of the vertical line segment is the arch height value, and solving according to a formula (2);

the solving method of the corner comprises the following steps: connecting the n-1 st point Pn-1And the nth point Pn(xn,yn,zn) (ii) a The nth point Pn(xn,yn,zn) And n +1 point Pn+1And is extended, the extension line and PnPn+1The included angle alpha is the corner, and the solution is carried out according to the formula (3);

the line length calculation method is to calculate the distance d between adjacent coordinate points, and the distance d is solved according to the formula (4);

and calculating the length difference of the line segments based on the length of the line segments, namely the length difference of two adjacent micro-line segments according to a formula (5).

The coarse screening proportion in the step 3) is set to be 10 percent.

The invention has the following beneficial effects:

the method realizes the screening of the defect coordinates of the numerical control machining triaxial G code track through the rough screening and the fine screening step screening methods, provides an effective and accurate method for the screening of the G code defect coordinates, can meet the requirement of effective pretreatment at the early stage of the fitting of G code micro line segment splines, and realizes the intelligent diagnosis of the G code defect coordinate position.

Drawings

FIG. 1 is a trace diagram of an example G code.

Fig. 2 is a schematic diagram of G code coordinate point curvature solution.

FIG. 3 is a schematic diagram of a G code coordinate point bow height solution.

Fig. 4 is a schematic diagram of G code coordinate point corner solution.

Fig. 5 is a schematic diagram of solving length of a minute line segment of a G code coordinate point.

FIG. 6 is a schematic diagram of the coarse screening process.

FIG. 7 is a graph showing the results of the coarse screening in the examples.

FIG. 8 is a schematic diagram of a cubic spline interpolation trend trajectory construction.

FIG. 9 is a schematic diagram of error solving from an ideal coordinate point to an actual rough-screened defect coordinate point.

Fig. 10 is a box diagram construction diagram.

FIG. 11 is the results of the example boxplot screening outliers.

FIG. 12 shows the results of the fine screening of the examples.

Detailed Description

The invention is described in detail below with reference to the figures and examples.

A coarse and fine step-by-step screening method for defect coordinates of a three-axis numerical control machining G code comprises the following steps:

1) extracting coordinate data of an X axis, a Y axis and a Z axis from the G code:

the nc-format G code comprises a size word, a preparation function word, an auxiliary function word, a main shaft rotating speed function word, a cutter function word and the like, and in order to extract coordinate information of a cutter path in the G code, address characters such as X, Y, Z and the like in the size word are removed from the nc-format file; eliminating a preparation function character G … …, an auxiliary function character M … …, a feeding function character F … …, a main shaft rotating speed function character S … …, a cutter function character T … … and the like in the file, and separating and extracting coordinate data of an X axis, a Y axis and a Z axis;

2) calculating five geometric characteristics of curvature, arch height, corner, micro-segment length and adjacent segment difference:

connecting the extracted coordinate data into tracks, wherein the G code track is shown as the attached drawing 1 in the embodiment, a local enlarged view shows that the defect of a folding back shape exists at a certain position of the code, and then calculating five geometric characteristics respectively; the curvature solving method is shown in FIG. 2, and the nth point in the G code is set as Pn(xn,yn,zn) The previous point, i.e. the n-1 point is Pn-1(xn-1,yn-1,zn-1) The latter point, i.e. the n +1 th point, is Pn+1(xn+1,yn+1,zn+1) The three points form a space circle, the curvature of the circle can be calculated according to the formula (1), the curvature is the curvature of the nth point, when the circle formed by the three points is clockwise, the curvature takes a negative value, and when the circle formed by the three points is anticlockwise, the curvature takes a positive value; the bow height solving method is shown in FIG. 3, and the nth point in the G code is set as PnThe previous point, i.e. the n-1 point is Pn-1The latter point, i.e. the n +1 th point, is Pn+1Sequentially connecting three points, passing through PnMaking a vertical line segment of a connecting line of the front point and the rear point, wherein the length of the vertical line segment is the height value of the bow, and the specific calculation is according to a formula (2); solving for the corner is as followsSimilarly, let the nth point in the G code be P as shown in FIG. 4nConnecting the previous point, i.e. the n-1 st point Pn-1And n +1 point Pn+1And is extended by the extension line and Pn Pn+1The included angle alpha is the corner, and the formula (3) is specifically utilized to solve; the line segment length calculating method is to calculate the distance d between adjacent coordinate points, as shown in fig. 5, the distance d is solved according to the formula (4); calculating the length difference of the line segments based on the length of the line segments, namely calculating the length difference of two adjacent micro-line segments according to a formula (5);

di=dn+1-dn (5)

in the formula, an,bn,cnRespectively representing the lengths, k, of the three sides constituting the triangle in spacenRepresents the curvature of the nth point; gnThe arch height of the nth point is shown,is a convolution symbol; alpha is alphanA corner representing an nth point; dnIndicating a length of the second segment; di represents a segment length difference;

3) selecting a coarse screening result:

sorting the calculation results of the step 2), setting the rough screening proportion as 10%, and respectively outputting the coordinate positions of the first 10% of the maximum value of the curvature, the first 10% of the maximum value of the arch height, the first 10% of the maximum value of the corner, the first 10% of the minimum value of the line segment length, and the first 10% of the maximum value of the line segment difference, wherein the rough screening process is shown in figure 6; the rough screening result of the code G of the embodiment is shown in the attached figure 7, and the position points are collected to form a rough screening result;

4) and (3) constructing a trend track of cubic spline interpolation according to the coarse screening result, and solving an ideal coordinate corresponding to the defect coordinate:

the cubic spline interpolation trend track construction method is shown in the attached figure 8; let the coarse screening result be Q1(X1,Y1),Q2(X2,Y2)……Qn(Xn,Yn) For each coordinate Qi(Xi,Yi) Respectively tracing 10 correct point locations forwards and backwards, skipping if meeting the point locations of the coarse screening result, and setting the coordinates of the 10 correct point locations forwards as t1(x1,y1),t2(x2,y2),……t10(x10,y10) The coordinates of the backward 10 correct point positions are respectively u1(x1,y1),u2(x2,y2),……u10(x10,y10) Respectively carrying out 3 times of spline interpolation by using the point positions to obtain a trend tool position track expression which is shown in a formula (6); then roughly screening the horizontal coordinate X of the defect pointiSubstituting into formula (6), solving to obtain ideal coordinates I under the trend tracks of the front and the back tool positionsFront i(mi,ni),IAfter i(mi,ni);

In the formula, xiThe horizontal coordinate of the starting point of the last section of the interpolation is taken; t and U are coefficients to be solved respectively;

5) and (3) carrying out error solving from the defect coordinate point of the coarse screening result to the ideal coordinate point of the tool position trend track:

as shown in fig. 9, the hollow points represent rough-screened defect coordinate points, the black points represent correct coordinate points, the five-pointed star represents two ideal coordinate points before and after being solved according to a cubic spline trajectory, the distance from the rough-screened defect point coordinate to the ideal point coordinate is set as h, the distance L between two adjacent points before and after the rough-screened defect point is set as L, and the solving method of the error e is according to the formula (7):

6) and (3) determining a fine screening result by using the box diagram:

screening the abnormal large values of the error solving results to complete the fine screening process; the screening method adopts a box diagram method, the box diagram is a graph for describing data through a lower quartile, a median, an upper quartile, an upper limit and a lower limit, and the specific construction method of the box diagram is as follows: let a set of sequence numbers contain n items, arrange them from small to large, and solve the lower quartile Q1Median Q2Upper quartile Q3Wherein Q isiIs located at position PQiI (n +1)/4, i 1,2,., n; solve the upper term N againmax,Nmax=Q3+1.5(Q3-Q1) The following item Nmin,Nmin=Q1-1.5(Q3-Q1) Then, a box chart is drawn as shown in fig. 10, in which the value larger than the above term is an abnormal value and is also a value to be screened out.

In this embodiment, a value of each coarse-screening G code defect coordinate with an abnormally large error to an ideal coordinate is found out as a fine screening result, and fig. 11 is a result of the screening by using a boxplot in the embodiment, where an error 1 is an error of tracing back 10 correct points to construct a trend track, and an error 2 is an error of the following, and the result is summarized as a fine screening result; FIG. 12 shows fine screening result marks for accurately screening the coordinate positions of the G code having the folding back defects in this embodiment.

12页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于Unity3D的机床动态切削模拟系统及模拟方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类