TWI524162B - Spatial Machining Path Trajectory Smoothing Algorithm - Google Patents
Spatial Machining Path Trajectory Smoothing Algorithm Download PDFInfo
- Publication number
- TWI524162B TWI524162B TW102137622A TW102137622A TWI524162B TW I524162 B TWI524162 B TW I524162B TW 102137622 A TW102137622 A TW 102137622A TW 102137622 A TW102137622 A TW 102137622A TW I524162 B TWI524162 B TW I524162B
- Authority
- TW
- Taiwan
- Prior art keywords
- point
- coordinate
- spatial filter
- processing path
- value
- Prior art date
Links
Landscapes
- Numerical Control (AREA)
Description
本發明有關於一工件加工的演算法,尤指一種能提高相鄰加工路徑的相似性,避免加工工件產生不均勻刀痕或降低工件表面光滑度不足的演算法。 The invention relates to an algorithm for processing a workpiece, in particular to an algorithm which can improve the similarity of adjacent machining paths, avoid uneven machining marks on the workpiece, or reduce the surface smoothness of the workpiece.
現代產業的競爭力越來越激烈,如何提高生產效率已成為各企業關注的焦點,而隨著科技的進步,電腦硬體性能越來越多元化以及價格的降低,因而各產業逐漸開始使用電腦輔助設計(CAD)於電腦軟體製作並模擬實物設計,展現出新開發產品的外型、結構、色彩、質感等特色的過程。 The competitiveness of modern industry is becoming more and more fierce. How to improve production efficiency has become the focus of attention of all enterprises. With the advancement of technology, the performance of computer hardware is becoming more diversified and the price is decreasing, so various industries gradually use computers. Auxiliary design (CAD) is a process of computer software production and simulation of physical design, showing the appearance, structure, color, texture and other characteristics of newly developed products.
而設計完成的產品,由電腦輔助設計(CAD)搭配電腦輔助製造(CAM),依照產品的輪廓曲線產生運用於電腦數值控制(Computer Numerical Control,CNC)工具機的CNC加工程式,藉此能縮短撰寫CNC加工程式碼的時間,並能提高產品的產量。 The designed product, computer-aided design (CAD) and computer-aided manufacturing (CAM), generates a CNC machining program for the computer numerical control (CNC) machine tool according to the contour curve of the product, thereby shortening Write the time of the CNC machining code and increase the output of the product.
雖然藉由電腦輔助設計(CAD)與電腦輔助製造(CAM)能快速產生CNC加工程式碼,但在加工後的成品上,表面會有明顯的刀痕產生,使成品的表面光滑度不符合市場的需求,因此,往往需要花費更多的時間與成本針對表面進行加工,來使產品的表面達到市場需求,造成製造者的不方便。 Although computer-aided design (CAD) and computer-aided manufacturing (CAM) can quickly generate CNC machining code, on the finished product, there will be obvious knife marks on the surface, making the surface smoothness of the finished product not in line with the market. The demand, therefore, often requires more time and cost to process the surface, so that the surface of the product meets market demand, causing inconvenience to the manufacturer.
有鑑於此,傳統藉由電腦輔助設計(CAD)與電腦輔助製造(CAM)所產生的CNC加工程式,在加工後的產品上仍有不足之處,實有必要改良創新一種演算法,藉以針對加工程式進行平滑化,以提高產品表面的光滑度。 In view of this, the traditional CNC machining programs generated by computer-aided design (CAD) and computer-aided manufacturing (CAM) still have shortcomings in the processed products. It is necessary to improve and innovate an algorithm to target The processing program is smoothed to improve the smoothness of the surface of the product.
本發明之主要目的在於由電腦輔助設計(CAD)與電腦輔助製造(CAM)所產生的加工程式之刀具路徑進行平滑化處理,提高相鄰加工路徑的相似性,避免加工後,使產品表面產生不均勻的刀痕或產品表面的平滑度不足。 The main purpose of the present invention is to smooth the tool path of the machining program generated by computer-aided design (CAD) and computer-aided manufacturing (CAM), improve the similarity of adjacent processing paths, and avoid the surface of the product after processing. Inhomogeneous tool marks or insufficient smoothness of the product surface.
為達上述目的,本發明空間加工路徑軌跡平滑化演算法,包含下列步驟:提供一空間濾波器讀取一加工程式碼,並移除上述加工程式碼中未進行切削的加工路徑;上述空間濾波器計算上述加工路徑之間的平均寬度;上述空間濾波器找出上述加工路徑的外圍輪廓;上述空間濾波器計算出上述外圍輪廓的長度與寬度,並由上述外圍輪廓的長度、寬度上述加工路徑的平均寬度計算出一由複數個網格節點組成的網格模型,再由上述網格節點的其中一點X軸座標值與另一點的Y軸座標值配合上述平均寬度與上述複數個網格節點之間的間距長度計算出所有上述網格節點的X軸座標值與Y軸座標值;上述空間濾波器將上述加工路徑中的圓弧部分經過計算後並以複數個短直線表示;上述空間濾波器利用上述平均寬度將上述加工程式碼中單節指令的長度等量分段,增加點座標資料的數量。上述空間濾波器由上述網格節點的X軸座標值與Y軸座標值計算出上述網格節點的Z軸座標值;上述空間濾波器對上述網格節點的Z軸座標值執行第一次平滑化處理,並求得一Z軸座標平滑數值;以及上述空間濾波器經由上述Z軸座標的平滑數值對上述加工路徑的座標資料進行第二次平滑化處理,求得平滑化後的上述加工程式碼。 To achieve the above objective, the spatial processing path trajectory smoothing algorithm of the present invention comprises the steps of: providing a spatial filter to read a processing code, and removing a processing path in the processing code that is not cut; the spatial filtering Calculating an average width between the processing paths; the spatial filter finding a peripheral contour of the processing path; wherein the spatial filter calculates a length and a width of the peripheral contour, and the processing path is determined by a length and a width of the peripheral contour The average width calculates a mesh model composed of a plurality of mesh nodes, and the one-axis X-axis coordinate value of the mesh node and the Y-axis coordinate value of the other point cooperate with the average width and the plurality of mesh nodes. Calculating the X-axis coordinate value and the Y-axis coordinate value of all the above-mentioned mesh nodes; the spatial filter calculates the arc portion in the above-mentioned processing path and represents it by a plurality of short straight lines; the above spatial filtering The above average width is used to segment the length of the single block instruction in the above processing code, and the point is increased. The amount of information. The spatial filter calculates a Z-axis coordinate value of the mesh node by using an X-axis coordinate value and a Y-axis coordinate value of the mesh node; and the spatial filter performs a first smoothing on a Z-axis coordinate value of the mesh node. And obtaining a Z-axis coordinate smoothing value; and the spatial filter performs a second smoothing process on the coordinate data of the processing path by using the smoothed value of the Z-axis coordinate to obtain the smoothed processing program code.
其中,上述空間濾波器係以內插法原則將上述加工路徑的圓弧部分轉換成上述複數個短直線。此外,在上述長度等量分段的過程中,上述單節指令的長度若小於上述平均寬度則不用分段。 The spatial filter converts the arc portion of the machining path into the plurality of short straight lines by the interpolation principle. In addition, in the process of the equal length segmentation described above, if the length of the single block command is less than the average width, no segmentation is required.
再者,上述空間濾波器係以凸包概念找出上述加工路徑的外圍輪廓。其中,上述凸包概念包含下列步驟:(a)上述空間濾波器利用上述凸包概念找出上述加工路徑點座標的左端點與右端點,並將上述加工路徑的所有點座標分成上半部與下半部;(b)上述空間濾波器建立一凸包點座標暫存器,而上述凸包點座標暫存器內部具有上述左端點或右端點其中一點的點座標資料;(c)依照輪廓方向依序找出未處理點座標資料,若上述凸包點座標暫存器內部只有一個點座標資料,則找到的點座標資料直接以堆疊方式存放在上述凸包點座標暫存器內,最後再重複步驟(c);(d)由步驟(c)找出的點座標資料與上述凸包點座標暫存器裡最後堆疊的倒數第二點座標資料計算出一第一向量,再由上述凸包點座標暫存器裡最後堆疊的倒數第一點座標資料與倒數第二點座標資料計算出一第二向量,而上述第二向量與第一向量進行外積運算,得到的外積值大於或等於零,則上述點座標資料以堆疊方式存放在上述凸包點座標暫存器內,最後回到步驟(c);若外積值小於零,則上述凸包點座標暫存器將最後一個點座標資料移除,移除後,上述凸包點座標暫存器若只有一個點座標資料,將找出的點座標資料以堆疊方式存放在上述凸包點座標暫存器最後,再回到步驟(c),反之,移除後,上述凸包點座標暫存器若有兩個點座標資料以上,則再回到步驟(d);(e)最後上述凸包點座標暫存器內的最後座標點資料若為上述左端點與右端點其中一點的座標點資料,則上半部或下半部的凸包輪廓找尋結束。 Furthermore, the spatial filter described above uses the convex hull concept to find the peripheral contour of the processing path. The convex hull concept includes the following steps: (a) the spatial filter uses the convex hull concept to find the left end point and the right end point of the processing path point coordinate, and divide all the coordinates of the processing path into the upper part and The lower half; (b) the spatial filter establishes a convex sag coordinate register, and the embossed coordinate coordinate register has a point coordinate data of one of the left end or the right end; (c) according to the contour The direction sequentially finds the unprocessed point coordinate data. If there is only one point coordinate data inside the convex sag coordinate register, the found coordinate data is directly stored in the stacking point coordinate register, and finally Repeating step (c); (d) calculating a first vector from the point coordinate data found in step (c) and the last stacked second coordinate point data in the convex sag coordinate register, and then The second vector is calculated by the last-numbered coordinate data of the last stack and the second-point coordinate data of the last stack in the convex sag coordinate register, and the second vector is subjected to an outer product operation with the first vector to obtain an outer product value. If the value is equal to or less than zero, the coordinate data of the above point is stored in the stacking manner in the convex point coordinate register, and finally returns to step (c); if the outer product value is less than zero, the convex point coordinate register will be the last one. The coordinate data of the point coordinate is removed. After the removal, the convex point coordinate register has only one coordinate data, and the found coordinate data is stored in the stack at the end of the convex point coordinate register, and then returned. Step (c), and vice versa, if the convex hull coordinate register has more than two coordinate coordinates, then return to step (d); (e) finally the convex sag coordinate register If the last coordinate point data is the coordinate point data of one of the left end point and the right end point, the convex contour of the upper half or the lower half is searched for completion.
本發明特點在於提供空間濾波器讀取加工程式碼,移除加工程式碼中未切削的加工路徑,並計算出加工路徑之間的平均寬度、外圍輪廓和外圍輪廓的寬度與長度,再經由外圍輪廓的寬度、長度與加工路徑的平均寬度計算出由複數個網格節點組成的網格模型,又進一步求得網格節點的X軸座標值、Y 軸座標值和Z軸座標值,最後對Z軸座標值進行第一次平滑化處理,而求得Z軸座標平滑數值,再藉由Z軸座標平滑數值對加工路徑的座標資料進行第二次平滑化處理,即可求得平滑化後的加工程式碼。藉此提高加工路徑的相似性,避免加工後,使產品表面產生不均勻的刀痕或產品表面的平滑度不足。 The invention is characterized in that the spatial filter is provided to read the processing code, the uncut machining path in the machining code is removed, and the average width, the peripheral contour and the width and length of the peripheral contour between the machining paths are calculated, and then the outer periphery is passed. The width and length of the contour and the average width of the machining path are calculated as a mesh model composed of a plurality of mesh nodes, and the X-axis coordinate value of the mesh node is further obtained. The coordinate value of the axis and the coordinate value of the Z axis. Finally, the Z-axis coordinate value is smoothed for the first time, and the smooth value of the Z-axis coordinate is obtained, and the coordinate data of the machining path is used for the second time by the Z-axis coordinate smoothing value. Smoothing process can be used to obtain the smoothed machining code. Thereby, the similarity of the processing paths is improved, and after processing, unevenness of the tool marks on the surface of the product or insufficient smoothness of the surface of the product is avoided.
10‧‧‧空間濾波器 10‧‧‧ Spatial Filter
11‧‧‧凸包點座標暫存器 11‧‧‧Convex point coordinate register
20‧‧‧加工程式碼 20‧‧‧Processing code
21‧‧‧加工路徑 21‧‧‧Processing path
22‧‧‧外圍輪廓 22‧‧‧Outer contour
30‧‧‧網格模型 30‧‧‧ mesh model
31‧‧‧網格節點 31‧‧‧ mesh nodes
第1圖為本發明空間加工路徑軌跡平滑化演算法之步驟流程圖;第2圖為本發明空間濾波器讀取加工程式碼之示意圖;第3圖為本發明加工路徑之示意圖;第4~5圖為本發明凸包概念之示意圖;第6圖為本發明空間濾波器運算出網格模型之示意圖;第7圖為本發明空間濾波器將圓弧以直線表示之示意圖;第8圖為本發明計算角度增量之示意圖;第9圖為本發明網格節點與加工座標之示意圖;第10圖為本發明遮罩常數設為1的網格節點;以及第11圖為本發明空間濾波器取得平滑化後的加工程式碼之示意圖。 1 is a flow chart of the steps of the spatial processing path trajectory smoothing algorithm of the present invention; FIG. 2 is a schematic diagram of the spatial filter reading processing code of the present invention; FIG. 3 is a schematic diagram of the processing path of the present invention; 5 is a schematic diagram of the concept of a convex hull according to the present invention; FIG. 6 is a schematic diagram of a mesh model calculated by the spatial filter of the present invention; FIG. 7 is a schematic diagram showing a circular arc represented by a straight line in the spatial filter of the present invention; The present invention calculates a schematic diagram of an angular increment; FIG. 9 is a schematic diagram of a mesh node and a processing coordinate of the present invention; FIG. 10 is a mesh node with a mask constant set to 1 according to the present invention; and FIG. 11 is a spatial filtering of the present invention. The schematic diagram of the smoothed processing code is obtained.
茲為便於更進一步對本發明之構造、使用及其特徵有更深一層明確、詳實的認識與瞭解,爰舉出較佳實施例,配合圖式詳細說明如下: In order to further clarify and understand the structure, the use and the features of the present invention, the preferred embodiment is described in detail with reference to the following drawings:
請參閱第1圖所示,本發明空間加工路徑軌跡平滑化演算法,提供一空間濾波器10來完成對一加工程式碼20的平滑化處理,包含下列步驟: Referring to FIG. 1 , the spatial processing path trajectory smoothing algorithm of the present invention provides a spatial filter 10 to complete smoothing of a processing code 20, including the following steps:
a.提供上述空間濾波器10讀取上述加工程式碼20,如圖所示, 上述加工程式碼20包含複數個程式行號(N00~N10)、加工指令(G01、G02、G03)以及加工路徑21的點座標資料(Xa0 Yb0 Zc0)。 a. providing the above spatial filter 10 to read the above processing code 20, as shown in the figure, The machining program code 20 includes a plurality of program line numbers (N00 to N10), machining commands (G01, G02, G03), and point coordinate data (Xa0 Yb0 Zc0) of the machining path 21.
請參閱第2圖及第3圖所示,上述空間濾波器10讀取後,上述空間濾波器10移除上述加工程式碼20中未進行切削的加工路徑21,於圖式較佳實施例中,上述空間濾波器10會將上述程式行號N00與N10移除,保留下上述程式行號N01至N09。 Referring to FIGS. 2 and 3, after the spatial filter 10 is read, the spatial filter 10 removes the processing path 21 of the processing code 20 that is not cut, in the preferred embodiment of the drawing. The spatial filter 10 removes the above program line numbers N00 and N10, and retains the above program line numbers N01 to N09.
b.上述空間濾波器10計算上述兩相鄰加工路徑21的寬度,並將所有上述兩相鄰加工路徑21的寬度加總在一起,再除以兩相鄰加工路徑21的總數,求得上述加工路徑21之間的平均寬度。 b. The spatial filter 10 calculates the width of the two adjacent processing paths 21, and adds the widths of all the two adjacent processing paths 21 together, and divides the total number of the two adjacent processing paths 21 to obtain the above. The average width between the processing paths 21.
c.上述空間濾波器10經由計算找出上述加工路徑21的外圍輪廓22。於此較佳實施例中,上述空間濾波器10係以凸包概念找出上述加工路徑21的外圍輪廓22,請參閱第4圖與第5圖所示,包含下列步驟: c. The spatial filter 10 described above finds the peripheral contour 22 of the processing path 21 via calculation. In the preferred embodiment, the spatial filter 10 finds the peripheral contour 22 of the processing path 21 by using the convex hull concept. Referring to FIG. 4 and FIG. 5, the following steps are included:
(a)上述空間濾波器10找出上述加工路徑21點座標的左端點與右端點,如圖所示中的點A與點G,再將上述左端點連接於右端點,使上述加工路徑21的所有點座標分成上半部與下半部。於此實施例中,先找尋下半部的外圍輪廓22。 (a) The spatial filter 10 finds the left end point and the right end point of the coordinate point 21 of the processing path 21, as shown in the figure, point A and point G, and then connects the left end point to the right end point to make the processing path 21 All point coordinates are divided into the upper half and the lower half. In this embodiment, the peripheral contour 22 of the lower half is first sought.
(b)上述空間濾波器10找尋下半部的外圍輪廓22之前,會先建立一凸包點座標暫存器11,其中,上述凸包點座標暫存器11內部具有上述左端點(點A)的點座標資料。 (b) Before the spatial filter 10 finds the peripheral contour 22 of the lower half, a convex point coordinate register 11 is first established, wherein the convex point coordinate register 11 has the left end (point A) Point coordinates information.
(c)上述空間濾波器10依照輪廓方向依序找出未處理的點座標資料(點B至點G),其中,若上述凸包點座標暫存器11內部若只有一個點座標資料,則下一個找到的點座標資料直接以堆疊方式存放於上述凸包點座標暫存器 11,再重複步驟(c)。 (c) The spatial filter 10 sequentially finds unprocessed point coordinate data (point B to point G) according to the contour direction, wherein if the convex sag coordinate register 11 has only one point coordinate data inside, The next found coordinate data is stored in the stack in the above convex point coordinate register. 11, repeat step (c).
(d)上述空間濾波器10由步驟(c)找到的點座標資料(點C)與上述凸包點座標暫存器11內部最後堆疊的倒數第二個點座標資料(點A)計算出第一向量(),而上述第一向量的向量方向由上述凸包點座標暫存器11內部最後堆疊的倒數第二個點座標資料(點A)指向找到的點座標資料(點C);再由上述凸包點座標暫存器11內部最後堆疊的倒數第一個點座標資料(點B)與倒數第二個點座標資料(點A)計算出第二向量(),而上述第二向量的向量方向由上述凸包點座標暫存器11內部最後堆疊的倒數第二個點座標資料(點A)指向倒數第一個點座標資料(點B),接著,上述空間濾波器10將上述第二向量與第一向量進行外積運算。 (d) The spatial filter 10 calculates the point coordinate data (point C) found in the step (c) and the last penultimate point coordinate data (point A) in the innermost stacking of the convex point coordinate register 11 a vector And the vector direction of the first vector is pointed to the found point coordinate data (point C) by the last penultimate point coordinate data (point A) of the last stacking inside the convex cryptographic coordinate register 11; The second point vector (the point B) and the second point coordinate data (point A) of the last stack of the last stack in the coordinate point register 11 calculate the second vector ( And the vector direction of the second vector is pointed to by the last penultimate coordinate data (point A) of the last stack of the convex point coordinate register 11 to point to the first point coordinate data (point B), and then The spatial filter 10 performs an outer product operation on the second vector and the first vector.
若得到的外積值大於零或等於零,上述空間濾波器10找到的點座標資料(點C)以堆疊方式存放於上述凸包點座標暫存器11,再回到步驟(c)。 If the obtained outer product value is greater than zero or equal to zero, the point coordinate data (point C) found by the spatial filter 10 is stored in the stacking manner in the convex sag coordinate register 11 and then returns to step (c).
若得到的外積值小於零,上述空間濾波器10會將上述凸包點座標暫存器11裡的最後一個點座標資料(點B)移除,移除後,上述空間濾波器10會將找到的點座標資料(點C)以堆疊方式存放在上述凸包點座標暫存器11內,再回到步驟(c)。反之,移除點座標資料(點B)後,上述凸包點座標暫存器11內部若有兩個點座標資料以上,則再回到步驟(d)。 If the obtained outer product value is less than zero, the spatial filter 10 removes the last point coordinate data (point B) in the convex sag coordinate register 11 and removes the spatial filter 10 after the spatial filter 10 is removed. The point coordinate data (point C) is stored in a stacked manner in the convex sag coordinate register 11 and returns to step (c). On the other hand, after the point coordinate data (point B) is removed, if there are two point coordinate data in the convex burr coordinate register 11 or more, the process returns to step (d).
(e)當上述空間濾波器10持續尋找未處理的點座標資料,直到上述凸包點座標暫存器11存取上述右端點(點G)的點座標資料時,上述空間濾波器10會停止找尋下半部外圍輪廓22的點座標資料。因此,當上述空間濾波器10會停止找尋下半部外圍輪廓22的點座標資料之後,上述凸包點座標暫存器11會依序將存取的點座標資料進行連線,完成下半部的外圍輪廓22。 (e) when the spatial filter 10 continuously searches for unprocessed point coordinate data until the convex sag coordinate register 11 accesses the point coordinate data of the right end point (point G), the spatial filter 10 stops. Find the point coordinates of the lower half contour 22 of the lower half. Therefore, after the spatial filter 10 stops searching for the point coordinates of the lower half contour 22, the convex point coordinate register 11 sequentially connects the accessed coordinate data to complete the lower half. Peripheral contour 22.
而依照相同步驟,找出上半部的外圍輪廓22,最後上述空間濾波器10會將找到下半部外圍輪廓22與上半部外圍輪廓22結合成完整的上述外圍輪廓22。 In accordance with the same steps, the peripheral contour 22 of the upper half is found. Finally, the spatial filter 10 will combine the lower peripheral contour 22 and the upper peripheral contour 22 to form the complete peripheral contour 22.
d.請參閱第6圖所示,上述空間濾波器10由上述外圍輪廓22的上端點與下端點計算出上述外圍輪廓22寬度,再由上述外圍輪廓22的右端點與左端點計算出外圍輪廓22的長度,並從長度與寬度中選擇一個最大值,而此值定義為輪廓最大值。 d. Referring to FIG. 6, the spatial filter 10 calculates the width of the peripheral contour 22 from the upper end point and the lower end point of the peripheral contour 22, and calculates the outer contour from the right end point and the left end point of the peripheral contour 22. The length of 22, and select a maximum from the length and width, and this value is defined as the maximum value of the contour.
由上述空間濾波器10將上述輪廓最大值乘以兩倍的邊界比率,再分別加上上述外圍輪廓22的長度與寬度,即可求得一網格模型30的長度與寬度。於此實施例中,上述邊界比率設為0.05,然而,上述邊界比率設為0.05僅方便說明之用,亦可藉由不同的使用狀況,將上述邊界比率設為不同的數值。 The length and width of a mesh model 30 can be obtained by multiplying the contour maximum value by a double boundary ratio by the spatial filter 10 and adding the length and width of the peripheral contour 22, respectively. In this embodiment, the boundary ratio is set to 0.05. However, the boundary ratio is set to 0.05 for convenience of explanation, and the boundary ratio may be set to a different value by different use conditions.
而上述空間濾波器10將上述網格模型30的長度與寬度除以上述平均寬度,並經過無條件進位程序再加上1,使上述網格模型30產生複數個網格節點31,再由上述網格模型30的長度與寬度分別除以上述網格節點31的橫向節點數量減1與縱向節點數量減1,即可求得上述複數個網格節點31之間的X軸方向與Y軸方向的長寬度。接著由上述網格節點31的其中一點X軸座標值與另一點的Y軸座標值配合上述複數個網格節點31之間的間距長度計算出所有上述網格節點31的X軸座標值與Y軸座標值。 The spatial filter 10 divides the length and the width of the mesh model 30 by the average width, and adds 1 to the unconditional carry program, so that the mesh model 30 generates a plurality of mesh nodes 31, and then the network The length and width of the lattice model 30 are respectively divided by the number of horizontal nodes of the mesh node 31 minus 1 and the number of longitudinal nodes is decreased by 1, so that the X-axis direction and the Y-axis direction between the plurality of mesh nodes 31 can be obtained. Long width. Then, the X-axis coordinate value and Y of all the above-mentioned mesh nodes 31 are calculated by the pitch length of one of the X-axis coordinate values of the mesh node 31 and the Y-axis coordinate value of the other point in cooperation with the pitch length between the plurality of mesh nodes 31. Shaft coordinate value.
於此實施例中,上述網格模型30的長度(或寬度)與上述相鄰加工路徑21的平均寬度分別為1mm與0.3mm,由上述網格模型30的長度(或寬度)除以上述平均寬度,在經過無條件進位程序再加上1,即可求得5×5的上述網格節點31,且上述複數個網格節點之間的間距長度為0.25mm,接著上述空間濾波 器10將上述外圍輪廓22左端點的X軸座標值與上述外圍輪廓22下端點的Y軸座標值分別減去上述外圍輪廓22的輪廓最大值乘於邊界比率,而得到的數值分別為上述網格模型30左端點的X軸座標值與下端點的Y軸座標值。而其他相鄰的網格節點31在X軸與Y軸方向相差上述複數個網格節點31之間的間距長度,因此,由上述網格模型30左端點的X軸座標值與下端點的Y軸座標值配合上述複數個網格節點31之間的間距長度即可算出所有網格節點31的X軸座標值與Y軸座標值。 In this embodiment, the length (or width) of the mesh model 30 and the average width of the adjacent processing path 21 are 1 mm and 0.3 mm, respectively, and the length (or width) of the mesh model 30 is divided by the average. Width, after adding 1 to the unconditional carry program, the above-mentioned mesh node 31 of 5×5 can be obtained, and the distance between the plurality of mesh nodes is 0.25 mm, and then the above spatial filtering is performed. 10 subtracts the X-axis coordinate value of the left end point of the peripheral contour 22 from the Y-axis coordinate value of the lower end point of the peripheral contour 22, respectively, and subtracts the contour maximum value of the peripheral contour 22 by the boundary ratio, and the obtained values are respectively The X-axis coordinate value of the left endpoint of the lattice model 30 and the Y-axis coordinate value of the lower endpoint. The other adjacent mesh nodes 31 differ in the X-axis and Y-axis directions by the pitch length between the plurality of mesh nodes 31. Therefore, the X-axis coordinate value of the left end point of the mesh model 30 and the Y of the lower end point are The X-axis coordinate value and the Y-axis coordinate value of all the mesh nodes 31 can be calculated by matching the axis coordinate value with the pitch length between the plurality of mesh nodes 31.
e.請參閱第7圖與第8圖所示,為了平滑化的計算方便,上述空間濾波器10利用規畫後的角度增量將上述加工路徑21中的圓弧部分經過計算後轉換成複數個短直線表示,於一較佳實施例中,上述空間濾波器10係以內插法原則配合角度增量將上述加工路徑21的圓弧部分轉換成上述複數個短直線。 e. Referring to FIGS. 7 and 8 , for the convenience of calculation of smoothing, the spatial filter 10 converts the arc portion of the machining path 21 into a complex number by using the angular increment after the calculation. The short straight lines indicate that, in a preferred embodiment, the spatial filter 10 converts the arc portion of the machining path 21 into the plurality of short straight lines by interpolation with the angular increment.
而上述內插法原則配合角度增量的關係表示式;如下所(DXi,DYi)=f(α,θ,Xi,Yi) The above interpolation principle is in accordance with the relational expression of the angle increment; as follows (DX i , DY i )=f(α, θ, X i , Y i )
其中,DXi、DYi:短直線的端點間距;α:角度增量;S、E:圓弧的起點與終點(請參閱第7圖所示);θ:圓弧角度Xi、Yi:為短直線的起始端點座標。 Endpoint short pitch line; α:: wherein, DXi, DYi angular increments; S, E: starting and ending points of the arc (see FIG section 7); θ: angle of the arc Xi, Yi: short The starting endpoint coordinate of the line.
利用上述內插法原則配合角度較度增量的關係表示式,上述空間濾波器10從圓弧的起點配合角度增量(α)並計算出上述加工路徑21圓弧部分的離散點資料。於此較佳實施例中,上述角度增量是由弦誤差的設定值(ε)與圓弧半徑來決定,其上述角度增量、弦誤差的設定值與圓弧半徑三者存在的關係式, 如下所示:α=f(ε,R) The spatial filter 10 is matched with the angle increment ( α ) from the starting point of the arc by the interpolation principle described above, and the discrete point data of the arc portion of the machining path 21 is calculated. In the preferred embodiment, the angle increment is determined by the set value ( ε ) of the chord error and the radius of the arc, and the relationship between the angle increment, the set value of the chord error, and the radius of the arc exists. , as shown below: α=f(ε,R)
其中,α:角度增量;ε:弦誤差的設定值;R:圓弧半徑。 Where α : angle increment; ε : set value of string error; R: arc radius.
由上述計算公式求得角度增量(α)後,上述空間濾波器10將上述圓弧角度(θ)除以角度增量得到倍數值,而倍數值若有小數點上述空間濾波器10會將倍數值的小數點無條件捨去,在以圓弧角度(θ)除以倍數值得到調整後的角度增量(α),而上述調整後的角度增量(α)為短直線近似於圓弧的數目。舉例說明,當圓弧角度為33度,而設定弦誤差計算求得的角度增量為10度,由圓弧角度除以角度增量所得到的倍數值經由無條件捨去所得到的數值為3倍,接著再由圓弧角度除以倍數值得到調整後的角度增量11度,再由圓弧角度除以調整後的角度增量,因此,近似圓弧的短直線數量為3段。 After the angle increment ( α ) is obtained by the above calculation formula, the spatial filter 10 divides the arc angle ( θ ) by the angle increment to obtain a multiple value, and if the multiple value has a decimal point, the spatial filter 10 will the decimal value is rounded down multiple, incremental angle ([alpha]) after the arc angle ([theta]) is divided by a multiple of the adjustment worth of the angle increment ([alpha]) after the adjustment is approximately linear short arc Number of. For example, when the arc angle is 33 degrees, and the angle increment obtained by setting the string error calculation is 10 degrees, the value obtained by dividing the arc angle by the angle increment is unconditionally discarded. Times, then divide the arc angle by the multiple value to get the adjusted angle increment by 11 degrees, and then divide the arc angle by the adjusted angle increment. Therefore, the number of short straight lines that approximate the arc is 3 segments.
f.為了使上述網格模型30能更近似於實際的加工輪廓,而需要大量的點座標資料,上述空間濾波器10利用上述平均寬度將上述加工程式碼20中單節指令的長度等量分段,增加點座標資料的數量。在等量分段的過程中,單節指令的長度若小於上述平均寬度則不用分段;反之,則使用上述平均寬度將單節指令的長度等量分段,若單節指令的長度不是上述平均寬度的倍數,則最後一段的長度會小於上述平均寬度,舉例來說,單節指令的長度與平均寬度為10.5mm與1mm,經過等量分段後,會產生11段線段,前10段長度為1mm,而最後一段為0.5mm,因此,單節長度的點座標資料會從2點變成12點。 f. In order to make the mesh model 30 more similar to the actual machining contour, a large amount of point coordinate data is required, and the spatial filter 10 uses the average width to equally divide the length of the single block command in the processing code 20 Segment, increase the number of coordinates of the point. In the process of equal segmentation, if the length of the block instruction is less than the average width, no segmentation is required; otherwise, the length of the block instruction is equally divided by the average width, if the length of the block instruction is not the above If the multiple is the multiple of the average width, the length of the last segment will be smaller than the average width. For example, the length and average width of the single-segment command are 10.5mm and 1mm. After equal segmentation, 11 segments will be generated, and the first 10 segments will be generated. The length is 1mm, and the last segment is 0.5mm. Therefore, the point coordinate data of the single length will change from 2 to 12 points.
g.上述空間濾波器10由上述網格節點31的X軸座標值與Y軸 座標值計算出上述網格節點31的Z軸座標值。請參閱第9圖所示,由步驟d得知的上述網格節點31的X軸座標值與Y軸座標值,而上述空間濾波器10利用上述網格節點31(第9圖的圓圈)座標值資料在上述加工路徑21(第9圖的粗實線)上找出距離最近於上述網格節點31的三個點座標資料(第9圖的三角形),在由三個點座標資料計算出一平面方程式(z=f(x,y)),假設上述網格節點31在此平面上,將上述網格節點31的X軸座標值與Y軸座標值輸入平面方程式,即可求出上述網格節點31的Z軸座標值。 g. The spatial filter 10 is represented by the X-axis coordinate value and the Y-axis of the mesh node 31 described above. The coordinate value calculates the Z-axis coordinate value of the above-described mesh node 31. Referring to FIG. 9, the X-axis coordinate value and the Y-axis coordinate value of the mesh node 31 are obtained by the step d, and the spatial filter 10 uses the coordinates of the mesh node 31 (circle of FIG. 9). The value data finds the three-point coordinate data (the triangle of FIG. 9) closest to the above-mentioned mesh node 31 on the above-mentioned processing path 21 (the thick solid line of FIG. 9), and is calculated from the three-point coordinate data. a plane equation (z=f(x, y)), assuming that the grid node 31 is on the plane, the X-axis coordinate value and the Y-axis coordinate value of the grid node 31 are input into the plane equation, and the above-mentioned equation can be obtained. The Z-axis coordinate value of the mesh node 31.
舉例說明,假設距離上述網格節點31最近的三個點座標資料的座標分別(x,y,z)=(-1,0,0.5)、(x,y,z)=(1,1,1)與(x,y,z)=(1,-1,1),利用此三點的點座標資料計算出平面方程式為,將網格節點31的X軸座標值與Y軸座標值「(x,y)=(0,0)」輸入至平面方程式,即可得到上述網格節點31的Z軸座標值為,因此上述網格節點31的座標點資料為。 For example, assume that the coordinates of the three point coordinates closest to the mesh node 31 are (x, y, z) = (-1, 0, 0.5), (x, y, z) = (1, 1, 1) and (x, y, z) = (1, -1, 1), using the coordinate data of the three points to calculate the plane equation The X-axis coordinate value of the mesh node 31 and the Y-axis coordinate value "(x, y) = (0, 0)" are input to the plane equation, and the Z-axis coordinate value of the mesh node 31 is obtained. Therefore, the coordinate point data of the above-mentioned mesh node 31 is .
h.請參閱第10圖,上述空間濾波器10對上述網格節點31的Z軸座標值執行第一次平滑化處理,並求得一Z軸座標的平滑數值。請參閱第10圖所示,於此較佳實施例中,上述空間濾波器10會設定一遮罩常數,在對上述網格節點31的Z軸座標值進行第一次平滑化處理。於此實施例中,上述遮罩常數設為1,並開始執行第一次平滑化處理的過程,上述空間濾波器10先令一個網格節點31為中心(第10圖所示的M5),並且求得周圍八個網格節點31(第10圖所示的M1~M4與M6~M9)的Z軸座標平均值,而上述網格節點31(第10圖所示的M5)在經過第一次平滑化處理後,得知上述Z軸座標的平滑數值、Z軸座標平均值與網格節點31(第10圖所示的M5)並存在以下關係式,如下所示:Z' M5=f(Zavg,ZM5,β) h. Referring to FIG. 10, the spatial filter 10 performs a first smoothing process on the Z-axis coordinate value of the mesh node 31, and obtains a smoothed value of a Z-axis coordinate. Referring to FIG. 10, in the preferred embodiment, the spatial filter 10 sets a mask constant for performing a first smoothing process on the Z-axis coordinate value of the mesh node 31. In this embodiment, the mask constant is set to 1, and the process of the first smoothing process is started. The spatial filter 10 first centers on one mesh node 31 (M5 shown in FIG. 10). And the Z-axis coordinate average of the eight mesh nodes 31 (M1~M4 and M6~M9 shown in FIG. 10) is obtained, and the mesh node 31 (M5 shown in FIG. 10) is in the After one smoothing process, it is known that the smoothed value of the Z-axis coordinate, the average value of the Z-axis coordinate, and the mesh node 31 (M5 shown in Fig. 10) have the following relationship, as follows: Z ' M5 = f(Z avg , Z M5 , β)
其中,Z’M5:上述網格節點31中心之Z軸座標的平滑數值;Zavg:周圍八個網格節點31的Z軸座標平均值;ZM5:上述網格節點31中心的Z軸座標值;以及β為比例係數。 Where Z'M5: the smoothed value of the Z-axis coordinate of the center of the mesh node 31; Zavg: the average value of the Z-axis coordinates of the surrounding eight mesh nodes 31; ZM5: the Z-axis coordinate value of the center of the mesh node 31; And β is a proportional coefficient.
如圖所示,假設中心網格節點31的Z軸座標值(ZM5)為0.9mm,而鄰近周遭八個網格節點31(M1~M4與M6~M9)的Z軸座標值皆為0.7mm,經過計算後求得Z軸座標平均值(Zavg)為0.7mm,則比例係數(β)設為0.8,依據前述公式可計算出中心網格節點31(M5)在經過第一次平滑處理後的Z軸座標的平滑數值(Z’M5)為0.86mm。由結果可知,中心的網格節點31(M5)在經過第一次平滑化處理後得到的Z軸座標平滑數值(Z’M5)會接近於周遭網格節點31的Z軸座標平均值(Zavg),使九個網格節點31的Z軸座標值較為相近,以達到平滑化的效果。因此,依照上述網格節點31的順序依序計算即可得到所有網格節點31經過第一次平滑化處理後的Z軸座標平滑數值。 As shown in the figure, it is assumed that the Z-axis coordinate value (Z M5 ) of the central mesh node 31 is 0.9 mm, and the Z-axis coordinate values of the adjacent eight mesh nodes 31 (M1 to M4 and M6 to M9) are 0.7. Mm, after calculation, the Z-axis coordinate average (Zavg) is 0.7mm, then the proportional coefficient ( β ) is set to 0.8. According to the above formula, the central mesh node 31 (M5) can be calculated after the first smoothing process. The smoothed value (Z'M5) of the latter Z-axis coordinate is 0.86 mm. It can be seen from the results that the Z-axis coordinate smoothing value (Z'M5) obtained by the center mesh node 31 (M5) after the first smoothing process is close to the Z-axis coordinate average value of the surrounding mesh node 31 (Zavg ), the z-axis coordinate values of the nine mesh nodes 31 are relatively similar to achieve the smoothing effect. Therefore, the Z-axis coordinate smoothing values of all the mesh nodes 31 after the first smoothing process can be obtained by sequentially calculating in the order of the mesh nodes 31 described above.
如圖所示,由於上述網格模型30中的5個網格節點31(M1~M4與M7)位於上述網格模型30的最邊緣處,而相鄰節點數不足1,因而不影響上述加工路徑21的平滑化結果,因此,上述網格模型30中的5個網格節點31(M1~M4與M7)不進行第一次平滑化處理。 As shown in the figure, since the five mesh nodes 31 (M1 to M4 and M7) in the mesh model 30 are located at the outermost edge of the mesh model 30, and the number of adjacent nodes is less than 1, the processing is not affected. As a result of the smoothing of the path 21, the five mesh nodes 31 (M1 to M4 and M7) in the mesh model 30 are not subjected to the first smoothing process.
i.為了不改變原本X軸與Y軸的加工路徑21且達到上述加工路徑21的平滑化,在執行完上述所有網格節點31的第一次平滑化處理,上述空間濾波器10將上述加工路徑21的點座標資料依照上述Z軸座標平滑數值進行第二次平滑化處理,使上述加工路徑21的Z軸座標值依序平滑化,進而求得平滑化後的上述加工程式碼20。請參閱第11圖所示,利用上述加工路徑21的點座標資料(第11圖的三角形)的X軸座標值與Y軸座標值((X,Y)=(0.3,0.2))找出鄰
近的四個網格節點31(第11圖的圓圈M1~M4),並配合下列關係式可求得上述加工路徑21經過第二次平滑化處理後的Z軸座標值(Z1234)
其中,Z1234為經過第二次平滑化處理求得的Z軸座標值;、、與分別為上述網格節點31中M1、M2、M3與M4的Z軸座標值;Lx與Ly分別為圖式所示中四個網格節點31的最大X軸與Y軸距離;△x與△y分別為上述加工路徑21的點座標資料距離網格節點31(M1)的X軸距離與Y軸距離。 Wherein, Z1234 is a Z-axis coordinate value obtained by the second smoothing process; , , versus The Z-axis coordinate values of M1, M2, M3, and M4 in the mesh node 31 are respectively; Lx and Ly are the maximum X-axis and Y-axis distances of the four mesh nodes 31 in the figure respectively; Δx and △ y is the X-axis distance and the Y-axis distance of the point coordinate data of the above-mentioned processing path 21 from the mesh node 31 (M1).
舉例來說,假設上述網格節點31(M1~M4)的點座標資料(X,Y,Z)分別為M1(0.0,0.0,0.8)、M2(0.5,0.0,0.7)、M3(0.0,0.5,0.7)與M4(0.5,0.5,0.8),帶入前述公式,計算求得與,接著再將求得的與帶入前述公式中,求得Z1234=0.748。而Z1234為經過第二次平滑化處理求得的Z軸座標值。因此,依照步驟a至步驟i能求得平滑化後的上述加工程式碼20。 For example, assume that the point coordinates (X, Y, Z) of the mesh nodes 31 (M1 to M4) are M1 (0.0, 0.0, 0.8), M2 (0.5, 0.0, 0.7), and M3 (0.0, respectively). 0.5, 0.7) and M4 (0.5, 0.5, 0.8), brought into the above formula, calculated and obtained versus And then will find it again versus Bring into the above formula and find Z1234=0.748. Z1234 is the Z-axis coordinate value obtained by the second smoothing process. Therefore, the smoothed processing code 20 can be obtained in accordance with steps a to i.
綜上所述,本發明藉由提供空間濾波器讀取加工程式碼,移除加工程式碼中未切削的加工路徑,並計算出加工路徑之間的平均寬度、外圍輪廓和外圍輪廓的寬度與長度,再經由外圍輪廓的寬度、長度與加工路徑的平均寬度計算出由複數個網格節點組成的網格模型,又進一步求得網格節點的X軸座標值、Y軸座標值和Z軸座標值,最後對Z軸座標值進行第一次平滑化處理,而求得Z軸座標值的平滑數值,再藉由平滑數值對加工路徑的座標資料進行第二次平滑化處理,即可求得平滑化後的加工程式碼。藉此提高加工路徑的相似性,避免加工後,使產品表面產生不均勻的刀痕或產品表面的平滑度不足。 In summary, the present invention reads a machining program code by providing a spatial filter, removes an uncut machining path in the machining code, and calculates an average width, a peripheral contour, and a peripheral contour width between the machining paths. Length, and then calculate the mesh model composed of a plurality of mesh nodes through the width, length and average width of the peripheral contour, and further obtain the X-axis coordinate value, the Y-axis coordinate value and the Z-axis of the mesh node. Coordinate value, finally smoothing the Z-axis coordinate value for the first time, and obtaining the smoothed value of the Z-axis coordinate value, and then smoothing the coordinate data of the processing path for the second smoothing process, The smoothed processing code. Thereby, the similarity of the processing paths is improved, and after processing, unevenness of the tool marks on the surface of the product or insufficient smoothness of the surface of the product is avoided.
以上所舉實施例,僅用為方便說明本發明並非加以限制,在不離本發明精神範疇,熟悉此一行業技藝人士依本發明申請專利範圍及發明說明所作之各種簡易變形與修飾,均仍應含括於以下申請專利範圍中。 The above embodiments are intended to be illustrative only, and are not intended to limit the scope of the present invention. It is included in the scope of the following patent application.
Claims (7)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW102137622A TWI524162B (en) | 2013-10-18 | 2013-10-18 | Spatial Machining Path Trajectory Smoothing Algorithm |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW102137622A TWI524162B (en) | 2013-10-18 | 2013-10-18 | Spatial Machining Path Trajectory Smoothing Algorithm |
Publications (2)
Publication Number | Publication Date |
---|---|
TW201516597A TW201516597A (en) | 2015-05-01 |
TWI524162B true TWI524162B (en) | 2016-03-01 |
Family
ID=53720306
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW102137622A TWI524162B (en) | 2013-10-18 | 2013-10-18 | Spatial Machining Path Trajectory Smoothing Algorithm |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI524162B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10409256B2 (en) | 2016-10-28 | 2019-09-10 | Fanuc Corporation | Tool-path generating device, tool-path generating method, and non-transitory recording medium storing tool-path generating program |
US11119465B2 (en) | 2020-01-06 | 2021-09-14 | Industrial Technology Research Institute | Method for inspecting defects of machining path |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI641931B (en) * | 2016-01-14 | 2018-11-21 | 捷準科技股份有限公司 | Device and method for automatically generating machine tool control instructions and parameters |
-
2013
- 2013-10-18 TW TW102137622A patent/TWI524162B/en active
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10409256B2 (en) | 2016-10-28 | 2019-09-10 | Fanuc Corporation | Tool-path generating device, tool-path generating method, and non-transitory recording medium storing tool-path generating program |
US11119465B2 (en) | 2020-01-06 | 2021-09-14 | Industrial Technology Research Institute | Method for inspecting defects of machining path |
Also Published As
Publication number | Publication date |
---|---|
TW201516597A (en) | 2015-05-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Calleja et al. | Highly accurate 5-axis flank CNC machining with conical tools | |
CN112348864B (en) | Three-dimensional point cloud automatic registration method for laser contour features of fusion line | |
Tsay et al. | Accurate 5-axis machining of twisted ruled surfaces | |
Lin et al. | A generic uniform scallop tool path generation method for five-axis machining of freeform surface | |
CN109101741B (en) | Complex surface detection self-adaptive sampling method based on triangular mesh simplification | |
CN108073138B (en) | Elliptical arc smooth compression interpolation algorithm suitable for high-speed high-precision machining | |
TWI524162B (en) | Spatial Machining Path Trajectory Smoothing Algorithm | |
US20120206457A1 (en) | Methods and Systems for Generating Continuous Surfaces from Polygonal Data | |
CN106774153B (en) | A kind of profile tolerance compensation method of S-shaped rose cutter | |
CN114545863B (en) | Trajectory smoothing method for numerical control machining based on B spline curve fitting | |
Liang et al. | Iso-scallop tool path planning for triangular mesh surfaces in multi-axis machining | |
JP4702951B2 (en) | Contour surface and solid processing method with numerically controlled single blade | |
CN113094964B (en) | Method and device for generating blade machining coordinates | |
Min et al. | An improved b-spline fitting method with arc-length parameterization, g 2-continuous blending, and quality refinement | |
Liang et al. | Tool path planning on triangular mesh surfaces based on the shortest boundary path graph | |
RU2607867C2 (en) | Adaptive treatment of cast blades | |
Li et al. | Automatic design for trimming die insert of automotive panel | |
CN111610751A (en) | Iterative calculation method for repeatedly subdividing interpolation errors of NURBS (non-uniform rational B-spline) interpolation curve of over-point set | |
Shih et al. | One-sided offset approximation of freeform curves for interference-free NURBS machining | |
JP4981313B2 (en) | Three-dimensional shape processing apparatus, curved surface creation program, and curved surface creation method | |
CN112100823B (en) | Method for designing and manufacturing nanometer precision of cutter | |
CN116339243A (en) | Involute-based numerical control system interpolation curve fitting system and equipment | |
CN104625193A (en) | Processing method of complex slot-type milling cutter chip breaker groove | |
CN104148397A (en) | Method for flexible design of spiral groove skew rolling roller | |
CN114970247A (en) | Automatic modeling method of high-fidelity finite element model for leaf disc structure |