CN113362352B - Method for fusing overlapping profiles based on PLT (product markup language) file - Google Patents
Method for fusing overlapping profiles based on PLT (product markup language) file Download PDFInfo
- Publication number
- CN113362352B CN113362352B CN202110624848.1A CN202110624848A CN113362352B CN 113362352 B CN113362352 B CN 113362352B CN 202110624848 A CN202110624848 A CN 202110624848A CN 113362352 B CN113362352 B CN 113362352B
- Authority
- CN
- China
- Prior art keywords
- line segment
- point
- contour
- outlines
- outline
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 46
- 239000013598 vector Substances 0.000 claims description 29
- 238000005520 cutting process Methods 0.000 claims description 28
- 230000004927 fusion Effects 0.000 claims description 11
- 238000007499 fusion processing Methods 0.000 claims description 4
- 238000001914 filtration Methods 0.000 claims description 3
- 230000001502 supplementing effect Effects 0.000 claims 1
- 230000008439 repair process Effects 0.000 abstract description 3
- 230000010354 integration Effects 0.000 abstract description 2
- 238000011112 process operation Methods 0.000 abstract description 2
- 238000012545 processing Methods 0.000 description 6
- PCTMTFRHKVHKIS-BMFZQQSSSA-N (1s,3r,4e,6e,8e,10e,12e,14e,16e,18s,19r,20r,21s,25r,27r,30r,31r,33s,35r,37s,38r)-3-[(2r,3s,4s,5s,6r)-4-amino-3,5-dihydroxy-6-methyloxan-2-yl]oxy-19,25,27,30,31,33,35,37-octahydroxy-18,20,21-trimethyl-23-oxo-22,39-dioxabicyclo[33.3.1]nonatriaconta-4,6,8,10 Chemical compound C1C=C2C[C@@H](OS(O)(=O)=O)CC[C@]2(C)[C@@H]2[C@@H]1[C@@H]1CC[C@H]([C@H](C)CCCC(C)C)[C@@]1(C)CC2.O[C@H]1[C@@H](N)[C@H](O)[C@@H](C)O[C@H]1O[C@H]1/C=C/C=C/C=C/C=C/C=C/C=C/C=C/[C@H](C)[C@@H](O)[C@@H](C)[C@H](C)OC(=O)C[C@H](O)C[C@H](O)CC[C@@H](O)[C@H](O)C[C@H](O)C[C@](O)(C[C@H](O)[C@H]2C(O)=O)O[C@H]2C1 PCTMTFRHKVHKIS-BMFZQQSSSA-N 0.000 description 3
- 239000013256 coordination polymer Substances 0.000 description 3
- 238000007500 overflow downdraw method Methods 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 125000004122 cyclic group Chemical group 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005304 joining Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000002156 mixing Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000009469 supplementation Effects 0.000 description 1
- 238000009966 trimming Methods 0.000 description 1
- 238000003466 welding Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/12—Edge-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/20—Drawing from basic elements, e.g. lines or circles
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/50—Image enhancement or restoration using two or more images, e.g. averaging or subtraction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/181—Segmentation; Edge detection involving edge growing; involving edge linking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20212—Image combination
- G06T2207/20221—Image fusion; Image merging
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a method for fusing overlapping outlines based on a PLT file, which comprises the following steps: acquiring PLT files of the two cutter-supplemented graph outlines; judging whether the two graphic outlines have an overlapping part or not by utilizing the relation between the line segment and the outlines according to the PLT file, and ending if the two graphic outlines do not have the overlapping part; otherwise, the two graphic outlines are fused. The invention is based on operating the contour composed of points, realizes the integration of two contours with overlapped areas, finally forms a fused contour, and well solves the problem of fusing the overlapped contours after finishing the knife repair process operation.
Description
Technical Field
The application belongs to the technical field of cutting beds, and particularly relates to a method for fusing overlapping profiles based on PLT files. The method is mainly applied to the contour welding process which avoids graph cutting loss caused by a cutting path at an overlapped part when the closed contour has the overlapped part and combines the overlapped closed contour into one or more contours.
Background
With the rapid development of the machine manufacturing industry and the automation industry, the application of the machine is more and more applied in various industries. As an automatic cutting machine, the cutting machine of the cutting machine brings the benefits of high efficiency and low cost under the condition of ensuring the technological requirements.
The PLT file is a main cutting file of the cutting machine, and the cutting path is stored as point information in the cutting file. Before the cutting machine performs cutting, some pretreatment processes are usually performed to achieve the desired cutting effect, wherein the most common pretreatment process is knife repairing.
The cutter compensation in the pretreatment process of the cutting machine is actually the outward expansion of the cutting path (namely the profile) so as to conform to the thickness of the cutting cutter of the actual cutting machine and ensure the accuracy of the cutting profile. However, after the trimming process is performed on the contour, the cutting paths may overlap, and if the overlapping cutting paths are not processed, the overlapped contour may be cut by the cutting machine.
In the prior art, the problem of processing contour overlapping is basically based on processing of overlapping contours by image pixels, but data points in a PLT file are not pixels, and after the graph in the PLT file is subjected to knife-repairing processing, the overlapped or fused contours in the PLT file cannot be processed by using a processing method of the pixel points.
Disclosure of Invention
The application aims to provide a method for fusing overlapping contours based on PLT files, and efficient and accurate fusion of the overlapping contours is realized.
In order to achieve the purpose, the technical scheme adopted by the application is as follows:
a method for fusing overlapped contours based on PLT files comprises the following steps:
step 1, acquiring two PLT files of the graph contour after tool supplementation;
step 2, judging whether the two graphic outlines have an overlapping part according to the relationship between the line segments and the outlines of the PLT file, and finishing if the two graphic outlines do not have the overlapping part; otherwise, executing the next step;
step 3, carrying out fusion processing on the two graphic outlines, which comprises the following steps:
step 3.1, acquiring all effective intersection points and coincidence outlines contained in the overlapping part of the two graphic outlines;
3.2, respectively inserting all the effective intersection points into corresponding positions of the graphic outlines, and respectively dividing the two graphic outlines into a plurality of small outlines by taking the inserted effective intersection points as dividing points;
3.3, taking the area surrounded by the two graphic outlines as two internal areas, and filtering out small outlines in any internal area;
and 3.4, removing the superposed contour on any one of the two graphic contours on the basis of the two graphic contours after the small contours are filtered out, and obtaining the final cutting contour after fusion and superposition.
Several alternatives are provided below, but not as an additional limitation to the above general solution, but merely as a further addition or preference, each alternative may be combined individually for the above general solution or between several alternatives without technical or logical contradictions.
Preferably, the determining whether there is an overlapping portion between two graphic outlines according to the relationship between the line segment and the outline in the PLT file includes:
step 2.1, two closed graph outlines are obtained based on two PLT files, one of the two graph outlines with a small number of line segments is taken as an outline 1, the other graph outline is taken as an outline 2, the outline 1 is split into independent line segments, and end points of the outline 2 are taken to form a point set;
step 2.2, judging the relation between the line segment and the outline 2 according to the position relation between each point in the point set and each line segment:
step 2.2.1, one line segment in the outline 1 is taken as the current line segment to be judged and is recorded as a line segment l1And line segment l1The linear equation of (a) is y-kx + c, and the point set of the contour 2 is taken as { P }n(xn,yn) N is 1 to N, and N is the total number of endpoints of the profile 2;
step 2.2.2, Point P of Point setn(xn,yn) Respectively substituted into line segments l1To dn=kxn+c-yn;
Step 2.2.3 according to N dnJudging the line segment l1The relationship to the profile 2 is as follows:
1) when N arednAll satisfy dn> 0 or dnIf < 0, it represents the line segment l1There is no effective intersection with the contour 2;
2) when N is present and 1 < i.ltoreq.N such thatThen represents the line segment l1The straight line has an intersection point with the contour 2, and the line segment P in the contour 2 is calculatediPi-1And line segment l1The intersection point T of the straight linesiJudging the intersection point T according to the vector mode methodiWhether or not it is located on line segment l1If there is an intersection point T corresponding to i satisfying the conditioniIs located on line segment l1Upper and not being a line segment l1The end points of (b) represent line segments l1There is an effective intersection with the contour 2; otherwise, it represents the line segment l1No effective intersection point with the contour 2;
3) when N ═ i and 1 < i ≦ N, such that diIs equal to 0, and di+1,di-1All are not 0, and P is judged firstiWhether or not it is on line segment l1If not, then PiIs not an intersection point, if at line segment l1In above, d is determinedi+1/di-1If d is greater than 0i+1/di-1Point P if greater than 0iNot as line segments l1Valid intersection point with the contour 2, if di+1/di-1Point P less than 0iAs a line segment l1The effective intersection with the contour 2;
4) when N is present and 1 < i ≦ N, such that diIs equal to 0 and di+10 or so that diIs equal to 0 and di-1When 0, it represents the point PiAnd point Pi+1Or represents a point PiAnd point Pi-1Are all located on line segment l1On the straight line, the point P is judged according to the vector mode methodiAnd point Pi+1Or a determination point PiAnd point Pi-1Whether or not it is located on line segment l1If there is a point Pi、Pi+1Or Pi-1Is located on line segment l1Upper, then, represents the line segment l1Overlapping with the contour 2, and taking the overlapped part as an overlapping contour; otherwise, it represents the line segment l1No coincidence with the contour 2;
step 2.2.4, another line segment in the outline 1 is taken as the current line segment to be judged, namely, the current line segment is marked as a new line segment l1Repeating the steps 2.2.2-2.2.4 until all line segments in the outline 1 are judged;
and 2.3, if the line segment in the outline 1 is effectively intersected or overlapped with the outline 2, overlapping parts exist in the two graphic outlines, otherwise, the overlapping parts do not exist in the two graphic outlines.
Preferably, the intersection point T is determined by a vector modulo methodiWhether or not it lies on line segment l1The method comprises the following steps:
line segment l is taken1Two end points Q ofj(xj,yj) And Qj-1(xj-1,yj-1) And an intersection point Ti(xti,yti);
Calculating line segment l1Vector of (2)Line segment Qj-1TiVector of (2)Line segment PiPi_1Vector of (2)And a line segment PiTiVector of (2)The following were used:
if it isAnd isThen the point of intersection TiIs located on line segment l1Upper, else intersection point TiNot located on line segment l1The above.
According to the method for fusing the overlapped contours based on the PLT file, the two contours can be integrated into one contour or a plurality of non-intersected contours, so that the cutter compensation requirement is met, and the overlapped contours cannot be cut and damaged. The method is based on operating the contour consisting of points, and realizes the integration of two contours with overlapped areas, and finally forms a fused contour. Because the outline in the current cut file is composed of points, the prior art fuses the outline based on an image recognition mode, and the image cannot be subjected to processing operation before the image is actually printed to form the PLT cut file, and only can be exported according to the outline of the original image. Therefore, the subsequent knife repair process can only operate on the point file, and the contour fusion after the knife repair is also the operation on the point file, so the existing method is not suitable any more. The method can well solve the problem that the coincident outline is fused after the knife repairing process operation is finished.
Drawings
FIG. 1 is a flow chart of a method for fusing overlapping profiles based on PLT files according to the present application;
FIG. 2 is a schematic view of the front and back of two profile complement cutters in one embodiment of the present application;
FIG. 3 is a schematic representation of two contours prior to blending in one embodiment of the present application;
FIG. 4 is a schematic diagram of two contours after being fused in one embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
In one embodiment, a method for fusing overlapping contours based on a PLT file is provided, which solves the problem that a contour fusion method in the prior art cannot be applied to the fusion of graphic contours based on the PLT file.
As shown in fig. 1, the method for fusing overlapping outlines based on PLT files of this embodiment includes:
step 1, obtaining the PLT files of the two cutter-compensated graph outlines.
The PLT file contains points and coordinates in the graph contour (i.e., the cutting path) after the tool is supplemented, and the method of the embodiment completes the fusion based on each point in the two graph contours.
Step 2, judging whether the two graphic outlines have an overlapping part according to the relationship between the line segments and the outlines of the PLT file, and finishing if the two graphic outlines do not have the overlapping part; otherwise, the next step is executed.
When judging whether the two figure outlines have the overlapped part, the method divides one of the two figure outlines into line segments, and judges whether the two figure outlines have the overlapped part by utilizing the relation between each line segment and the other figure outline so as to accelerate the judgment speed.
When calculating the relationship between the line segment and the contour, the method generally adopted in the prior art is to split the contour into line segments, and then to determine whether the intersection point exists between the target line segment and the line segment set of the target contour. The existing judging method not only needs to calculate the linear equation of each line segment in the outline, but also needs to repeatedly take the line segment for judgment, so that the judging efficiency is extremely low. In order to improve the efficiency of judging the relationship between the line segment and the contour, the embodiment provides a method for quickly and effectively determining whether the line segment intersects with the contour by using the relationship between the point and the line segment and finding the intersection point.
In this embodiment, it is defined that if there is an effective intersection point between a line segment and a contour or the line segment and the contour are overlapped, it means that there is an overlapping portion between two graphic contours, where the effective intersection point between the line segment and the contour is understood that the line segment is intersected with but not overlapped with the line segment in the contour, and the intersection point is not an end point of the line segment, and the line segment and the contour are overlapped with each other is understood that the line segment is parallel to and partially or completely overlapped with the line segment in the contour.
Specifically, in this embodiment, determining whether there is an overlapping portion between two graphic outlines according to a relationship between a line segment and an outline in a PLT file includes the following steps:
and 2.1, obtaining two closed graph outlines based on the two PLT files, taking one of the two graph outlines with a small number of line segments as an outline 1, taking the other graph outline as an outline 2, splitting the outline 1 into independent line segments, and taking the end points of the outline 2 to form a point set.
Step 2.2, judging the relation between the line segment and the outline 2 according to the position relation between each point in the point set and each line segment:
step 2.2.1, one line segment in the outline 1 is taken as the current line segment to be judged and is recorded as a line segment l1And line segment l1The linear equation of (a) is y-kx + c, and the point set of the contour 2 is taken as { P }n(xn,yn) N is 1 to N, and N is the total number of endpoints of the contour 2.
Step 2.2.2, Point P of Point setn(xn,yn) Respectively substituted into line segments l1To dn=kxn+c-yn。
Step 2.2.3 according to N dnJudging the line segment l1The relationship to the profile 2 is as follows:
1) when N is dnAll satisfy dn> 0 or dnIf < 0, it indicates line segment l1There is no valid intersection with the contour 2.
2) When N is present and 1 < i.ltoreq.N such thatThen represents the line segment l1The straight line has an intersection point with the contour 2, and the line segment P in the contour 2 is calculatediPi-1And line segment l1The intersection point T of the straight linesiJudging the intersection point T according to the vector mode methodiWhether or not it lies on line segment l1If there is an intersection T corresponding to i meeting the conditioniIs located on line segment l1Upper and not being a line segment l1The end points of (b) represent line segments l1There is an effective intersection with the contour 2; otherwise, it represents the line segment l1There is no valid intersection with the contour 2.
3) When N ═ i and 1 < i ≦ N are present, such that di is 0, and di+1,di-1If both are not 0, P is judged firstiWhether or not it is on line segment l1If not, then PiIf it is not an intersection (or a valid intersection), i.e. a line segment l1If it is above, d is determinedi+1/di-1Whether or not it is greater than 0, if di+1/di-1Point P if greater than 0iNot as line segments l1Valid intersection point with the contour 2, if di+1/di-1Point P less than 0iAs a line segment l1The effective intersection point with the contour 2.
4) When N ═ i and 1 < i ≦ N, such that diIs equal to 0 and di+10 or such that diIs equal to 0 and di-1When equal to 0, it represents a point PiAnd point Pi+1Or represents a point PiAnd point Pi-1Are all located on line segment l1On the straight line, the point P is judged according to the method of vector modeiAnd point Pi+1Or a determination point PiAnd point Pi-1Whether or not it lies on line segment l1If there is a point Pi、Pi+1Or Pi-1Is located on line segment l1Upper, then, represents the line segment l1Coincides with the contour 2 and takes the weightThe combined part is used as a superposition contour; otherwise, it represents a line segment l1No coincidence with the contour 2.
Since the two ends of the same line segment are taken from front to back when i sequentially takes points, there exists a repeated judgment, and a unidirectional (forward or backward) cyclic judgment mode is recommended to avoid the repeated judgment, for example, if i in the embodiment takes a value of 1 < i ≦ N, the embodiment is implied to be a backward unidirectional judgment mode, for example, if i is 2, that is, a line segment P is taken2P1Judging that the line segment P is taken when i is 33P2Judgment was made, and thus although d is listed in case 4)i、di+1And di、di-1Two cases, but only one case exists in actual operation (e.g., d of the present embodiment)i、di-1The case).
And at the line taking section l1Taking the line segment l when the contour is overlapped with the contour 21And line segment PiPi-1The end point of the other line segment is taken, and the line segment between the two end points is taken as a coincidence outline.
It should be noted that, regarding the relationship between a line segment and an outline, only one of the above 1) to 4) occurs, that is, 1) to 4) are not sequentially required to be executed, but which condition is satisfied to execute which judgment is performed, so that a unique relationship between the line segment and the outline is obtained.
Step 2.2.4, another line segment in the outline 1 is taken as the current line segment to be judged, namely, the current line segment is marked as a new line segment l1And repeating the steps 2.2.2-2.2.4 until all line segments in the outline 1 are judged.
And 2.3, if the line segment in the outline 1 and the outline 2 have effective intersection points or are overlapped, overlapping parts exist in the two graphic outlines, otherwise, the two graphic outlines do not have the overlapping parts.
It is easily understood that the overlapping part referred to in this application includes intersection and coincidence, and the intersection is that there must be an effective intersection point, so in practical application, if there is intersection and coincidence at the same time, it is necessary to merge the two cases, and if there is only one of the cases, it is only necessary to merge the existing cases.
Wherein, the intersection point T is judged according to the vector mode methodiWhether or not it lies on line segment l1The method comprises the following steps:
line segment l is taken1Two end points Q ofj(xj,yj) And Qj-1(xj-1,yj-1) And the intersection point Ti(xti,yti);
Calculating line segment l1Vector of (2)Line segment Qj-1TiVector of (2)Line segment PiPi-1Vector of (2)And a line segment PiTiVector of (2)The following:
if it isAnd isThen the point of intersection TiIs located on line segment l1Upper, else intersection point TiNot located on line segment l1The above.
It should be noted that the intersection point T is determined according to the determinationiWhether or not it is located on line segment l1The vector modulo approach described above can be analogized to accomplish point PiAnd point Pi+1Or a decision point PiAnd point Pi-1Whether or not it is located on line segment l1The above judgment will not be described herein.
Step 3, carrying out fusion processing on the two graphic outlines, which comprises the following steps:
and 3.1, acquiring all effective intersection points and coincident outlines contained in the overlapped part of the two graphic outlines.
And 3.2, respectively inserting all the effective intersection points into corresponding positions of the graph outlines, and respectively dividing the two graph outlines into a plurality of small outlines by taking the inserted intersection points as dividing points.
And 3.3, taking the area surrounded by the two graphic outlines as two internal areas, and filtering out the small outline in any internal area.
And 3.4, removing the superposed contour on any one of the two figure contours on the basis of the two figure contours with the small contours filtered out to obtain the final cutting contour after fusion and superposition.
To enhance the understanding of the fusion method of the present application, the following is further illustrated by a specific example:
as shown in fig. 2, the left side of fig. 2 shows the position relationship before the knife compensation of the two graphic outlines, and it can be seen from the figure that there is no overlapping portion between the two graphic outlines, and according to the position relationship after the knife compensation of the two graphic outlines on the right side of fig. 2, it can be seen that there is an overlapping portion between the two graphic outlines after the knife compensation, so that it is necessary to perform the fusion processing on the two graphic outlines.
As shown in fig. 3, in order to facilitate description of adding corresponding letters to each point of two graphic outlines to be fused in the present embodiment, the method for fusing overlapping outlines based on a PLT file in the present embodiment includes:
and step S1, after carrying out tool compensation, acquiring coordinate information of the outlines of the two graphs, and judging whether the two closed graphs have an overlapped part or not by utilizing the relation between the line segment and the outlines.
In step S2, if there is an overlapping portion, the two contours need to be fused. The following provides a specific solution for determining the contour overlap and the contour fusion:
A. judging whether the outlines are overlapped and determining an effective intersection point and an overlapped outline, wherein the specific calculation is as follows:
selecting an outline ABCD (as an outline 1) with fewer line segments, splitting the outline ABCD into four line segments of AB, BC, CD and DA, and sequentially calculating the line segments and the outline P1P2P3P4P5P6P7P8P9(as the intersection of the contours 2). In this example, P is9And P1The same end point in the outline 2 can be identified as P when making a decision1P2P3P4P5P6P7P8I.e. P can be omitted when computing the subsequent set of points9And (4) calculating points.
Taking one of the four line segments AB, BC, CD and DA as a line segment l1Let line segment l1The equation of the straight line is as follows:
y=kx+c
contour P1P2P3P4P5P6P7P8P9The point set of endpoints (i.e., N ═ 9) is:
{Pn(xn,yn)},n=1,2,3,4,5,6,7,8,9
substituting points on the contour into line segment l1Equation of the line:
dn=kxn+c-yn
when d isn0, indicates that the point is on the line segment, when dn> 0 or dn< 0 indicates that the point is on one of the two sides of the straight line. Record all dnValue of canAccording to d recordednAnd judging the relation between the line segment and the contour according to the following four conditions:
1) when all dnAll satisfy dn> 0 or dn<0
Indicating that all points on the contour 2 are on line segment l1On the same side of the straight line, i.e. line segment l1The straight line does not have a valid intersection with the contour 2. As shown by line segments AB and DA in FIG. 3, the point sets of the contour are all on the same side of the line on which line segments AB and DA lie, and there is no effective intersection with contour 2, i.e., they do not intersect.
Then the line segment l is represented1The straight line has an intersection with the contour 2, and the line segment BC in FIG. 3 is taken as the line segment l1I is 2, calculatedThe straight line of the line segment BC has an intersection with the contour 2. Calculating point (x)i-1,yi-1) And point (x)i,yi) Line segment l of the composition2(i.e., line segment P)iPi-1) The equation of the straight line is as follows:
(xi-xi-1)*y-(yi-yi-1)*x+xi-1*yi-xi*yi-1=0
according to l2The equation of the straight line and the line segment l1The equation of the straight line can calculate the intersection point E (x)e,ye) (i.e. T)i(xti,yti) ) is:
finally, judging whether the intersection point is on the line segment l according to a vector mode method1Above, here l1Representing the segment BC, set the segment l1Two end points Q ofj(xj,yj) And Qj-1(xj-1,yj-1) Corresponds to line BC and then is B (x)b,yb) And C (x)c,yc) Where j is a distinguishing parameter in the expression for distinguishing line segments l1Two different end points, at line segment l1After the segment BC is corresponded, j is corresponded to b, and j-1 is corresponded to c. Understanding the intersection point T by the same principlei(xti,yti) Coordinate subscript ti in.
The vectors are calculated as follows:
wherein the vectorAndare respectively line segments l1And vectors of line segments CE, vectorsAndare respectively line segments l2And a line segment PiThe vector of E.
If it isAnd isThe intersection E is at the line segment l1And a line segment l2And the intersection E is not the line segment l1End points of, i.e. line segments l1Intersecting the contour 2. If there are a plurality of i such thatThen it is necessary to take each i in turn to perform the above calculation until the line segment l is determined1All valid intersections with the contour 2, so that if there is a match condition i (i.e. so thatI) corresponding to the intersection point TiIs located on line segment l1Upper and not being a line segment l1The end points of (1) represent line segments l1There is an effective intersection with the contour 2; if all I meeting the conditions correspond to the intersection point TiAre not located on line segment l1Upper represents line segment l1There is no valid intersection with the contour 2.
By analogy, the line segment BC and the contour P can be calculated1P2P3P4P5P6P7P8P9The intersection points of (A) and (B) are E and F.
3) When N ═ i and 1 < i ≦ N, such that diIs equal to 0, and di+1,di-1Are all different from 0
In this case, P should be judged firstiWhether or not it is on line segment l1(Note here that it is judged whether or not there is a line segment l1Instead of determining whether it is on line segment l1On a straight line), if PiOut of line segment l1Upper, then PiNot of line segment l1The point of intersection with the contour 2, let alone the effective point of intersection, if PiOn line segment l1Upper then remove diDirectly determine di+1/di-1Whether P is greater than 0 or not is judgediIs a line segment l1The intersection with the contour 2. Such as line CD and line P in FIG. 34P5And P5P6Corresponding to d5=0,P5On line segment l1And d is4,d6In the case where the ratio is not 0,so P5Is an invalid intersection, not taken as a line segment l1The effective intersection point with the contour 2.
4) When N is present and 1 < i ≦ N, such that diIs equal to 0 and di+10 or such that di0 and di-1=0
Represents point PiAnd point Pi+1Or represents a point PiAnd point Pi-1Are all located on line segment l1On the straight line, the above-mentioned vector mode judging method is used to judge that said line segment formed from two adjacent points and line segment l are not identical1There is an overlap; when any one of the two adjacent points is on the line segment l1Upper, shows line segment PiPi+1Or PiPi-1There is an overlap. Dividing the overlapped line segment into overlapped part and non-overlapped part to form 1-3 small line segments, such as side P in FIG. 36P7Overlap with the edge BC, then divide the two edges into BPs7、P7C and CP6Three line segments. When cutting is ensured, the segment P is overlapped7C cutting once.
It should be noted that, regarding the relationship between a line segment and an outline, only one of the above 1) to 4) occurs, that is, 1) to 4) are not sequentially required to be executed, but which condition is satisfied to execute which judgment is performed, so that a unique relationship between the line segment and the outline is obtained.
B. When the contour fusion is carried out, the contours are recombined according to the effective intersection points and the coincident contours.
The embodiment mainly processes the overlapped contour after the cutter compensation and prevents the contour from being cut. Therefore, at the time of processing, portions included in each other are to be removed.
B1, taking out the overlapped contours separately, and dividing the contours into multiple segments (i.e. multiple small contours) by taking the intersection points as the dividing points. As shown in fig. 3, the overlapping portion is P7C, then according to the intersection point E, F, the contour CD ABEFP7Segmentation into CDABE, EF and FP7A third stage; contour P1EP2P3P4P5P6CP7P8FP9Segmentation into EP1F,EP2P3P4P5P6C and P7P8And F, three sections.
When the contours are recombined, the overlapped contours may be taken out separately for fusion according to this embodiment, or the overlapped contours may be deleted after the overlapped contours are taken out separately according to a method provided in another embodiment.
B2, judging the inner segment and deleting
By the original contour P1P2P3P4P5P6P7P8P9Determine contours CDABE, EF and FP for the region7Three segments. Judging the position of the segment relative to the region, taking the points which are not end points in any segment to judge whether the segment is in the region, if only two end points exist in the segment, taking the middle points of the two end points to judge whether the middle points are in the region. Taking a judgment point as a starting point, taking rays along the direction of an x positive axis, calculating the intersection point of the straight line and the contour, wherein when the number of the intersection points is an even number, the point is outside the contour, and when the number of the intersection points is an odd number, the point is inside the contour; taking the segment CDABE as an example, taking a non-end point D as a ray DC, and calculating to obtain an intersection point P5C and the line segment P2P3Due to P at the intersection of5Are on one side of the ray, so P5A non-valid intersection point. There are only two valid intersection points of the ray with the contour and therefore point D is not inside the contour.
The method can calculate according to the method, and the EF can be judged in the internal segment. Again with the outline ABCD as the area,judging the profile P1EP2P3P4P5P6CP7P8FP9The internal segment of the three segments of (2) is EP1F。
B3, joining external segments
According to the judgment of B2, the outer part has CDABE, FP7,EP2P3P4P5P6C and P7P8F. Since the end points of the segments are all the intersection points of the original target contour, the outer segments can be recombined according to whether the end points are the same or not. After the outer contour is recombined, the outer contour CDABEP can be obtained2P3P4P5P6And an inner profile P7P8F, finally adding the overlapped line segment P7C. Overlapping the contours after the cutter compensation processing, and obtaining an outer contour, an inner contour and a line segment P connecting the two contours after fusion7C. The resulting profile, as shown in fig. 4, is the final effective cutting wheel diameter.
This embodiment is mainly directed to the case where the contours overlap after the point pattern contour is trimmed. The fusion of the overlapped contours of the two contours can be quickly and effectively solved.
It should be understood that, although the steps in the flowchart of fig. 1 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not limited to being performed in the exact order illustrated and, unless explicitly stated herein, may be performed in other orders. Moreover, at least a portion of the steps in fig. 1 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is specific and detailed, but not to be understood as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, and these are all within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (2)
1. A method for fusing overlapped contours based on PLT files is characterized in that the method for fusing overlapped contours based on PLT files comprises the following steps:
step 1, acquiring two PLT files of the graph outline after knife supplementing;
step 2, judging whether the two graphic outlines have an overlapping part according to the relationship between the line segments and the outlines of the PLT file, and finishing if the two graphic outlines do not have the overlapping part; otherwise, executing the next step;
step 3, carrying out fusion processing on the two graphic outlines, which comprises the following steps:
step 3.1, acquiring all effective intersection points and coincidence outlines contained in the overlapping part of the two graphic outlines;
3.2, respectively inserting all the effective intersection points into corresponding positions of the graph outlines, and respectively dividing the two graph outlines into a plurality of small outlines by taking the inserted effective intersection points as dividing points;
3.3, taking the area surrounded by the two graphic outlines as two internal areas, and filtering out small outlines in any internal area;
3.4, removing the superposed contour on any one of the two graphic contours on the basis of the two graphic contours with the small contours filtered out to obtain a final cutting contour after fusion and superposition;
wherein, the judging whether the two graphic outlines have an overlapping part according to the relationship between the line segment and the outline of the PLT file comprises the following steps:
step 2.1, two closed graph outlines are obtained based on two PLT files, one of the two graph outlines with a small number of line segments is taken as an outline 1, the other graph outline is taken as an outline 2, the outline 1 is split into independent line segments, and end points of the outline 2 are taken to form a point set;
step 2.2, judging the relation between the line segment and the outline 2 according to the position relation between each point in the point set and each line segment:
step 2.2.1, one line segment in the outline 1 is taken as the current line segment to be judged and is recorded as a line segment l1And line segment l1The linear equation of (a) is y-kx + c, and the point set of the contour 2 is taken as { P }n(xn,yn) N is 1 to N, and N is the total number of endpoints of the profile 2;
step 2.2.2, Point P of Point setn(xn,yn) Respectively substituted into line segments l1To dn=kxn+c-yn;
Step 2.2.3 according to N dnJudging the line segment l1The relationship to the profile 2 is as follows:
1) when N is dnAll satisfy dn>0 or dn<0 represents a line segment l1No effective intersection point with the contour 2;
2) when n ═ i and 1 are present<i is less than or equal to N such thatThen the line segment l is represented1The straight line has an intersection point with the contour 2, and the line segment P in the contour 2 is calculatediPi-1And line segment l1The intersection point T of the straight linesiJudging the intersection point T according to the vector mode methodiWhether or not it lies on line segment l1If there is an intersection T corresponding to i meeting the conditioniIs located on line segment l1Upper and not being a line segment l1The end points of (b) represent line segments l1There is an effective intersection with the contour 2; otherwise, it represents a line segment l1No effective intersection point with the contour 2;
3) when n is present, i and 1<i is less than or equal to N, such that diIs equal to 0, and di+1,di-1If both are not 0, P is judged firstiWhether or not it is on line segment l1If not, then PiNot the intersection point, if at line segment l1If it is above, d is determinedi+1/di-1Whether or not it is greater than 0, if di+1/di-1Point P if greater than 0iNot as line segment l1Valid intersection point with the contour 2, if di+1/di-1Point P less than 0iAs a line segment l1The effective intersection with the contour 2;
4) when n is present, i and 1<i is less than or equal to N, so that diIs equal to 0 and di+10 or so that di0 and di-1When 0, it represents the point PiAnd point Pi+1Or represents a point PiAnd point Pi-1Are all located on line segment l1On the straight line, the point P is judged according to the method of vector modeiAnd point Pi+1Or a determination point PiAnd point Pi-1Whether or not it is located on line segment l1If there is a point Pi、Pi+1Or Pi-1Is located on line segment l1Upper, then, represents the line segment l1Overlapping with the outline 2, and taking the overlapped part as an overlapping outline; otherwise, it represents the line segment l1No overlap with the contour 2;
step 2.2.4, another line segment in the outline 1 is taken as the current line segment to be judged, namely, the current line segment is marked as a new line segment l1Repeating the steps 2.2.2-2.2.4 until all line segments in the outline 1 are judged;
and 2.3, if the line segment in the outline 1 is effectively intersected or overlapped with the outline 2, overlapping parts exist in the two graphic outlines, otherwise, the overlapping parts do not exist in the two graphic outlines.
2. The method for fusing overlapped contours based on PLT files of claim 1, wherein the intersection point T is determined according to a vector modulo methodiWhether or not it is located on line segment l1The method comprises the following steps:
line segment l is taken1Two end points Q ofj(xj,yj) And Qj-1(xj-1,yj-1) And an intersection point Ti(xti,yti);
Calculating line segment l1Vector of (2)Line segment Qj-1TiVector of (2)Line segment PiPi-1Vector of (2)And a line segment PiTiVector of (2)The following were used:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110624848.1A CN113362352B (en) | 2021-06-04 | 2021-06-04 | Method for fusing overlapping profiles based on PLT (product markup language) file |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110624848.1A CN113362352B (en) | 2021-06-04 | 2021-06-04 | Method for fusing overlapping profiles based on PLT (product markup language) file |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113362352A CN113362352A (en) | 2021-09-07 |
CN113362352B true CN113362352B (en) | 2022-07-22 |
Family
ID=77532257
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110624848.1A Active CN113362352B (en) | 2021-06-04 | 2021-06-04 | Method for fusing overlapping profiles based on PLT (product markup language) file |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113362352B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4819529A (en) * | 1985-11-13 | 1989-04-11 | Loriot Jean Marc | Method of cutting out sheet or plate material |
JPH06124076A (en) * | 1992-10-13 | 1994-05-06 | Brother Ind Ltd | Outline data processor |
CN108665470A (en) * | 2018-05-14 | 2018-10-16 | 华南理工大学 | A kind of interactive mode contour extraction method |
CN111274654A (en) * | 2020-01-13 | 2020-06-12 | 浙江工业大学 | Cutting optimization method based on circular knife tool compensation |
CN111783260A (en) * | 2020-08-14 | 2020-10-16 | 广东科学技术职业学院 | STL file-oriented section contour line segment connection method |
-
2021
- 2021-06-04 CN CN202110624848.1A patent/CN113362352B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4819529A (en) * | 1985-11-13 | 1989-04-11 | Loriot Jean Marc | Method of cutting out sheet or plate material |
JPH06124076A (en) * | 1992-10-13 | 1994-05-06 | Brother Ind Ltd | Outline data processor |
CN108665470A (en) * | 2018-05-14 | 2018-10-16 | 华南理工大学 | A kind of interactive mode contour extraction method |
CN111274654A (en) * | 2020-01-13 | 2020-06-12 | 浙江工业大学 | Cutting optimization method based on circular knife tool compensation |
CN111783260A (en) * | 2020-08-14 | 2020-10-16 | 广东科学技术职业学院 | STL file-oriented section contour line segment connection method |
Non-Patent Citations (1)
Title |
---|
基于计算机视觉的刀具在机检测;徐露艳;《中国优秀硕士学位论文全文数据库 (工程科技Ⅰ辑)》;20171115;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN113362352A (en) | 2021-09-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7613539B2 (en) | System and method for mesh and body hybrid modeling using 3D scan data | |
DE112016007478B4 (en) | Numerical control device, program conversion device, numerical control method, and program conversion method | |
JPH0883296A (en) | Method and device for preparing three-dimensional shape preparing | |
CN114545863B (en) | Trajectory smoothing method for numerical control machining based on B spline curve fitting | |
JP2008305372A (en) | System and method for calculating loft surface using 3d scan data | |
Pupyrev et al. | Improving layered graph layouts with edge bundling | |
CN102436217B (en) | Method for reconstructing web processing drive geometry of slot characteristic of aircraft structure | |
CN111310106B (en) | Cutting contour fitting optimization method based on successive approximation of original contour | |
US20240029348A1 (en) | Method and system for automatically constructing editable model of isogeometric topology optimization result | |
CN114819559A (en) | Manufacturing process planning method for increasing and decreasing materials of complex structural part | |
CN113362352B (en) | Method for fusing overlapping profiles based on PLT (product markup language) file | |
JPH10134209A (en) | Method for incorporating fusing and chamfering surface to solid model | |
CN118313066B (en) | Automatic bridging method and system for vehicle body target part and part | |
CN105447284A (en) | Technical allowance adding method | |
Lee et al. | 2D curve offset algorithm for pockets with islands using a vertex offset | |
JP2752787B2 (en) | Numerical control information creation device | |
CN114372392A (en) | Finite element modeling method and computer storage medium | |
CN113962511A (en) | Process data structured representation method fusing process design intents | |
US20230066024A1 (en) | Curve Fitting Method, Apparatus and Device Based on A Drawing Tool | |
CN104808588A (en) | Broken surface automatic combination and fitting method based on features | |
CN116049986A (en) | Design method and system of trimming cutter block in automobile stamping die | |
CN106094732B (en) | A kind of teeth processing route generating method of What You See Is What You Get | |
CN112026752B (en) | Automatic parking path following processing method and system, vehicle and storage medium | |
US10703004B2 (en) | Method for modifying the cutting trajectory for parts intended to be cut from a flexible material | |
JPH04114204A (en) | Rounding deformation operating method for three-dimensional shape |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |