Disclosure of Invention
The invention aims to provide a scanning path planning method which can eliminate a large vacant area in the existing zigzag spiral scanning path and improve the forming quality in parts during laser deposition printing.
In order to achieve the above purpose, the invention provides the following technical scheme: a scan path planning method, comprising:
acquiring a set of scanning path points for constructing an original spiral zigzag scanning line, wherein each scanning path point has a coordinate and an index position, and the original spiral zigzag scanning line is formed by sequentially connecting the scanning path points according to the sequence of the index positions;
judging each scanning path point in the second to last index positions, and setting Pi+1For the determined scan path point, PiIs Pi+1Scanning path point, P, of the previous index positioni+2Is Pi+1Firstly, acquiring and judging an included angle P at a scanning path point of the latter index positioniPi+1Pi+2Comparing the angle value of the judgment included angle with a preset value, and if the angle value of the judgment included angle is smaller than or equal to the preset value, judging that the scanning path point is an extension starting point and a vacant area exists around the scanning path point;
matching an extension end point for each extension starting point, wherein the coordinate position of each extension end point is positioned in a vacant area on the inner side or the outer side of the judgment included angle with the extension starting point matched with the extension end point as a vertex;
adding two index positions between the index position of each extension starting point and the index position of the next scanning path point, and sequentially inserting the coordinate of the extension end point and the coordinate of the extension starting point matched with the two index positions;
a new spiral scan line is constructed by a new set of scan path points.
Alternatively, if Pi+1If the scanning path point is not judged as the extension starting point, judging other scanning path points; if Pi+1Is judged as an extension starting point, is Pi+1Matching an extension end point ep at Pi+1Pi+1And Pi+2By adding two index positions and inserting ep and P in sequencei+1And then judging other scanning path points.
Optionally, the step of judging one by one from the scan path point of the second index position is as follows:
a1, let i equal to 0, and P0 be the scan path point of the first index position;
a2, taking three points Pi、Pi+1And Pi+2,
A3, acquiring and judging included angle PiPi+1Pi+2Comparing the angle value with a preset value;
a4, if the angle value of the included angle is judged to be larger than the preset value, the step (i +1) is carried out to the step D2; if the angle value of the included angle is judged to be less than or equal to the preset value, the value is Pi+1Matching an extension end point ep at Pi+1Pi+1And Pi+2By adding two index positions and inserting ep and P in sequencei+1Recalculating the index position, i +3, and then performing step a 2.
Optionally, the method for obtaining the angle value of the judgment included angle includes the following steps:
b1, according to Pi、Pi+1And Pi+2Calculates the coordinates of vector v1 and vector v 2;
b2, calculating an angle value of θ by a formula θ ═ arccos ((v1 · v2)/(| v1| | v2|)), wherein the angle value of θ is the angle value of the judgment included angle;
wherein v1 is a vector
v2 is a vector
Theta is the angle between vector v1 and
vector v 2.
Optionally, when the coordinate position of each extension end point is located in a vacant region inside the judgment included angle with the extension start point matched with the extension end point as the vertex, the extension end point is a point on an angle bisector of the judgment included angle; and when the coordinate position of each extension end point is positioned in a vacant area outside the judgment included angle by taking the extension starting point matched with the extension end point as a vertex, the extension end point is a point on a reverse extension line of the angle bisector of the judgment included angle.
The method for determining the coordinates of the extension end points comprises the following steps of:
c1, obtaining Pi、Pi+1And Pi+2According to the formula v1 ═ (P)i.X-Pi+1.X,Pi.Y-Pi+1Y) and v2 ═ P (P)i+2.X-Pi+1.X,Pi+2.Y-Pi+1Y) calculating the coordinates of vectors v1 and v 2;
c2, calculating the coordinates of the unit vector a of v1 and the coordinates of the unit vector b of v 2;
c3, calculating the coordinates of v0 as (a.X + b.X, a.Y + b.Y);
c4, calculating the coordinate of bp as (P)i+1.X+v0.X,Pi+1.Y+v0.Y);
C5, calculating epsilon-atan 2((bp. y-P)i+1.Y),(bp.X-Pi+1.X))*180/PI;
C6, calculating the coordinate of the extension end point ep as ((P)i+1.X-cos(δ)*d*w),(Pi+1.Y-sin(δ)*d*w));
Where ep is the end point of the extension for which the coordinates need to be determined, P
i+1Is a scan path point determined as an extension start point, P
iIs P
i+1Scanning path point, P, of the previous index position
i+2Is P
i+1The scan path point of the latter index position, bp is
At a point on the angular bisector of (c), v0 being at ≈ P
iP
i+1P
i+2V1 is a vector
v2 is a vector
v3 is a vector
a isThe unit vector b of v1 is the unit vector of v2, d is the scan pitch, w is the extension factor, and ε is the angle between vector v3 and the X-axis.
Optionally, the preset value is greater than 0 degree and less than 90 degrees.
The invention also provides a laser deposition metal printing method, and the scanning path of the laser deposition metal printing is a spiral scanning path in a shape of Chinese character hui adopting any one of the scanning path planning methods.
The invention has the following beneficial effects: when the scanning path is planned, the extension line is added in the vacant area of the original spiral scanning path, so that the large vacant area of the original spiral scanning path is eliminated, and the forming quality in the part can be improved when laser deposition metal printing is carried out.
Detailed Description
In order to make the technical problems, technical solutions and advantageous effects to be solved by the present invention more clearly apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1 to 5, a scan path planning method provided by the present invention is described.
As shown in fig. 1 and 2, in the original zigzag spiral scanning path, a vacant region 1 is formed at some position, and when printing is performed according to the path, the spraying amount of the vacant region 1 is small, the area density at this position is low, and the stress coefficient of the part at this position after molding is lower than that at other positions, thereby affecting the molding quality inside the part. The invention adds an extension line 2 in the vacant area 1, fills the vacant area 1, and sprays along the extension line 2 during printing, thereby increasing the spraying amount and improving the stress coefficient. First, a vacant region 1 needs to be found, taking a spiral line at the lower right corner in fig. 1 as an example, through observation and analysis, a vacant region 1 is generated at the position of the sharp corner of the spiral line, because of the zigzag spiral scanning, in one spiral line, a circle of spiral line forms the sharp corner at a certain position, other circles of spiral lines also form the sharp corner at the corresponding position, and the region between two corresponding sharp corners forms the vacant region 1. The free area 1 at the location of the sharp corner where the line intersects the arc is more pronounced. The invention searches the vacant area 1 by judging the scanning path point. Firstly, acquiring a set of scanning path points for constructing an original spiral scan line in a shape of Chinese character hui, wherein each scanning path point has a coordinate and an index position, and the original spiral scan line in a shape of Chinese character hui is formed by sequentially connecting the scanning path points according to the sequence of the index positions. Then, using the scanning path point as a vertex, using two connecting lines of the scanning path point and the scanning path point at the previous index position and the next index position as two edges to form a judgment included angle, and setting the judged scanning path point as Pi+1,PiIs Pi+1Scanning path point, P, of the previous index positioni+2Is Pi+1Scanning path point of the latter index position, angle PiPi+1Pi+2Namely judging the included angle, comparing the angle value of the judged included angle with a preset value, and if the judgment is madeIf the angle value of the included angle is smaller than or equal to the preset value, the included angle is a sharp angle, and then a vacant area is judged to exist around the scanning path point and the scanning path point is marked as an extension starting point, so that all the scanning path points from the second index position to the last index position are judged completely. Wherein the preset value can be determined according to actual conditions. (the smaller the angle value of the sharp corner, the larger the free area 1, the larger the angle value of the sharp corner, the smaller the free area 1, and the free area 1 is not generated when the angle value of the sharp corner is larger than a certain value). After the spare area 1 exists around the judged scanning path point and is marked as an extension starting point, an extension end point is matched for the extension starting point in the spare area 1, and the coordinate positions of the extension end points can be both located in the spare area 1 on the inner side of the judged included angle or both located in the spare area 1 on the outer side of the judged included angle. The inner and outer sides of the judgment angle are orientations, and as described with reference to fig. 2 and 3, the second free region 12 is a free region 1 on the inner side of the judgment angle with P1 as a vertex, and is also a free region 1 on the outer side of the judgment angle with P2 as a vertex. In fig. 3, when the extension end points are determined, the extension start points P1, P2, P3, and P4 are respectively provided in the first vacant region 11, the second vacant region 12, the third vacant region 13, and the fourth vacant region 14 outside the determination angle with the determination angle as a vertex. And then adding two index positions after the index position of the extension starting point and the index position of the next scanning path point, sequentially inserting the coordinates of the extension end point and the coordinates of the extension starting point into the two index positions, and constructing a new zigzag spiral scanning line by a new scanning path point set. As shown in figure 4 of the drawings,
the original scanning path is: pi, Pi +1, Pi +2,
the newly formed scan paths are: pi, Pi +1, ep, Pi +1, Pi + 2.
When the scanning path planned according to the invention is used for printing, compared with the original scanning path, the light-break frequency is not increased, the spraying head is sprayed to the position of the extension starting point along the extension line 2 after deviating from the original path and then is sprayed to the extension end point along the extension line 2, and then returns to the extension starting point along the extension line 2, and then the spraying is continued according to the original path, because the extension line 2 is added in the vacant area 1, the spraying amount at the position is increased, the stress coefficient at the position is improved, and the internal quality of the part is increased. (although the extension line 2 is sprayed twice, the thickness of the extension line 2 may not be greater than the thickness of other positions by a specific arrangement of the spraying process, or the extension line 2 is polished after being formed to eliminate the thickness difference with other positions).
Wherein, when judging the scanning path point, if P isi+1If the scanning path point is not judged as the extension starting point, judging other scanning path points; if Pi+1Is judged as an extension starting point, is Pi+1Matching an extension end point ep at Pi+1And Pi+2By adding two index positions and inserting ep and P in sequencei+1And then judging other scanning path points.
Of course, after the scan path points are all determined, the extension end point is matched for each extension start point, two index positions are added between the extension start point and the index position of the next scan path point, and ep and P are inserted in sequencei+1The coordinates of (a).
Specifically, the step of judging one by one from the scanning path point of the second index position includes:
a1, let i equal to 0, and P0 be the scan path point of the first index position;
a2, taking three points Pi、Pi+1And Pi+2,
A3, acquiring and judging included angle PiPi+1Pi+2Comparing the angle value with a preset value;
a4, if the angle value of the included angle is judged to be larger than the preset value, the step (i +1) is carried out to the step D2; if the angle value of the included angle is judged to be less than or equal to the preset value, the value is Pi+1Matching an extension end point ep at Pi+1And Pi+2By adding two index positions and inserting ep and P in sequencei+1Recalculating the index position, i +3, and then performing step a 2.
In this method, P is introducedi+1Is inserted into Pi+2Is in pair Pi+2When the judgment is carried out, the judgment included angle is equal to the angle Pi+1Pi+2Pi+3This determines P in the anglei+1For newly inserted Pi+1Due to its interaction with the original Pi+1Are the same, so, no matter Pi+1The two judging included angles which are the original included angle or the newly inserted included angle are actually the same included angle.
The method for acquiring the angle value of the judgment included angle comprises the following steps:
b1 according to Pi、Pi+1And Pi+2Calculates the coordinates of vector v1 and vector v 2;
b2 calculates an angle value of θ, which is an angle value for determining an included angle, by a formula θ ═ arccos ((v1 · v2)/(| v1| | v2 |).
Wherein v1 is a vector
v2 is a vector
Theta is the angle between vector v1 and
vector v 2.
The other acquisition method for judging the angle value of the included angle comprises the following steps: first pass through Pi、Pi+1And Pi+2Calculating the line segment PiPi+1、Pi+1Pi+2And PiPi+2Length of (d); then calculating the angle P through the cosine theoremiPi+1Pi+2The angle value of (c).
The coordinate position of the extension end point can be set by various methods as long as the extension end points all fall in the vacant area 1 on the inner side of the judgment included angle or all fall in the vacant area 1 on the outer side of the judgment included angle. One preferred coordinate position is set as: when the coordinate position of each extension end point is positioned in a vacant area on the inner side of the judgment included angle with the extension starting point matched with the extension end point as the vertex, the extension end point is a point on an angular bisector of the judgment included angle; when the coordinate position of each extension end point is located in a vacant area outside the judgment included angle taking the extension starting point matched with the extension end point as the vertex, the extension end point is a point on the reverse extension line of the angle bisector of the judgment included angle.
Such position selection may be such that the extension line 2 formed by the extension starting point and the extension ending point is located at the middle position of the vacant region 1 as much as possible, so that the vacant region 1 is uniformly filled; secondly, the coordinate position is convenient according to Pi、Pi+1And Pi+2Is calculated.
The most preferred coordinate positions of the extension end point in the present invention are: and setting the coordinate position of the extension end point in a vacant area outside the judgment included angle with the extension starting point matched with the extension end point as the vertex, wherein the extension end point is a point on the reverse extension line of the angle bisector of the judgment included angle. So, when printing, the shower nozzle can outwards extend and turn with a great angle and deviate from former route after reaching the extension starting point, returns along extension line 2 afterwards, turns with a great angle again and returns to former route and continue the spraying for the shower nozzle is comparatively smooth when turning, and spraying effect is good. (the larger angle is relative to the case when the extension end point is located inside the judgment angle)
The method for determining the coordinates of the extension end point comprises the following steps:
c1 acquisition of Pi、Pi+1And Pi+2V1 ═ P (P)i.X-Pi+1.X,Pi.Y-Pi+1.Y),v2=(Pi+2.X-Pi+1.X,Pi+2.Y-Pi+1.Y)
C2 calculates the coordinates of unit vector a of v1 and the coordinates of unit vector b of v 2;
c3 calculates the coordinates of v0 as (a.X + b.X, a.Y + b.Y);
c4 calculates the coordinates of bp as (P)i+1.X+v0.X,Pi+1.Y+v0.Y);
C5 calculated δ ═ atan2((bp. y-P)i+1.Y),(bp.X-Pi+1X)) 180/PI, calculating δ by an arctangent function;
c6 calculates the coordinate of the extension end point ep as ((P)i+1.X-cos(ε)*d*w),(Pi+1.Y-sin(δ)*d*w))。
Wherein, Pi+1X is Pi+1Coordinate in the X axis, Pi+1Y is Pi+1Coordinates on the Y-axis. In actual operation, a worker inputs the distances d and w according to actual conditions, and the original scanning path can be optimized. Wherein d x w is a line segment Pi+1The length of ep. d is the scanning distance, w is the extension coefficient, a worker can simulate after inputting w, observe a newly formed path and see whether the extension end point ep falls on an ideal position, if the w deviates from the ideal position, the worker can input w again for simulation until the extension end point ep falls on the ideal position, and in general, the extension end point ep can fall on the ideal position by taking a proper natural number from 1 to 10.
The preset value is preferably a value larger than 0 degree and smaller than 90 degrees, when the included angle is judged to be larger than 90 degrees, the generated vacant area 1 is small, the influence on the stress coefficient is small, the extension line can not be filled, and the preset value can be specifically determined according to the requirements of different parts on the stress coefficient. When the requirement on the stress coefficient of the part is higher, the preset value can be set to be higher, and when the requirement on the stress coefficient is lower, the preset value can be set to be lower.
The first embodiment will be described with reference to fig. 5.
Pi、Pi+1And Pi+2Three continuous points on a certain spiral line;
v 1: vector quantity
From P
i-P
i+1Calculation acquisition, P
icoordinate-P of
i+1The coordinates of (a);
v 2: vector quantity
From P
i+2-P
i+1Calculation acquisition, P
i+2coordinate-P of
i+1The coordinates of (a);
v 0: in that
The vector on the bisector of the angle of (a);
bp: a point on vector v 0;
Pi+1ep: calculating an extension line segment;
0: the included angle of v1 and v 2;
acquiring a scanning spiral line group, and storing the scanning spiral line group in a PathList, wherein the PathList comprises PathList0, PathList1, PathList2.. PathListN, and corresponds to N +1 spiral lines;
polling the points on each scan spiral, starting with PathList0, PathList0 includes P0、P1、P2。。。Pi。。。PnN +1 points in total, and three points P are taken at a time from i ═ 0i、Pi+1And Pi+2Forming two vectors v1 and v2, and calculating an included angle theta between the vectors v1 and v 2;
judging whether theta is smaller than or equal to a preset value, if theta is larger than the preset value, continuing to take points by i + 1; if theta is less than or equal to the preset value, then P is addedi+1Calculating an extension line, and adding the extension line into the spiral scanning line;
calculating an extension line:
unit vectors a and b of v1 and v2 are calculated, and v0(a.X + b.X, a.Y + b.Y) is calculated according to the unit vectors a and b.
Selecting a point on v0 and marking as bp (P)i+1.X+v0.X,Pi+1.Y+v0.Y)。
Calculating the included angle delta between v3 and the X axis: atan2((bp. Y-P)i+1.Y),(bp.X-Pi+1.X))*180/PI;
Calculating an epitaxy point ep: based on the preset epitaxial coefficient w, the scanning line spacing d and the included angle delta, ep ((P) is calculated by using the following formulai+1.X-cos(δ)*d*w),(Pi+1.Y-sin(δ)*d*w));
Insert ep points into the helix:
acquisition Point Pi+1At index position i +2 in the spiral, ep is inserted at the i +3 position,then P is addedi+1Inserting the position of i +4, and recalculating the total number of points on the spiral line; and adding 1 after i +2, and continuously taking points.
Until all points on the spiral have been polled. And then polling other spirals until all the spirals are polled.
For example, as a spiral PathList [0 ]]10 points inside, P0、P1、P2...P9The index positions corresponding to the index positions are s1, s2 and s3... s10, and the index position corresponding to pi is s (i + 1). First, starting from i-0, P at three index positions s1, s2 and s3 is taken0、P1、P2If with P1If the included angle theta of the vertexes is smaller than or equal to a preset value, calculating the corresponding ep at P1After the index position s2, add two index positions and insert ep and P1At this time, the helix PathList [0 ]]Is changed into P0、P1、ep、P1、P2...P9And their corresponding index positions become s1, s2, s3... s10, s11, s 12. Continuing to fetch the point with +1 after i +2, taking the point P at the index positions of s4, s5 and s6 when i is equal to 31(newly inserted P1)、P2、P3If with P2If the theta of the vertex is larger than the preset value, i +1 continues to take the point, at the moment, i is 4, and the point P at the index positions of s5, s6 and s7 is taken2、P3、P4Until all the points are taken out.
The invention also provides a laser deposition metal printing method, and the scanning path of the laser deposition metal printing is a spiral scanning path which is in a shape of Chinese character hui and generated by adopting any one of the scanning path planning methods.
It should be noted that the present invention is not limited to be applied to the field of laser deposition metal printing, and is also applicable to other fields of 3D printing involving a circular spiral scanning path.
While the invention has been described in connection with various embodiments, other variations to the disclosed embodiments can be understood and effected by those skilled in the art in practicing the claimed invention, from a review of the drawings, the disclosure, and the appended claims.
While the invention has been described in conjunction with specific features and embodiments thereof, it will be evident that various modifications and combinations can be made thereto without departing from the spirit and scope of the invention. Accordingly, the specification and figures are merely exemplary of the invention as defined in the appended claims and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of the invention. It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.