現在進入主題:有一個圓柱面,在此圓柱面的柱面上挖一個正交形態的圓孔,用Autolisp畫出圓柱與圓孔的交線,並用球刀對此交線倒角。
首先,先畫出圓柱面,此圓柱端面圓上的座標的求法如下圖所示:
X座標:r0 * sin( a )
Y座標:-r0 + r0 *cos( a ),要注意角a必須要用弳度。
Autolisp程式如下:
(defun c:kk()
(setq r0 (getreal "Enter the radius of the pillar : "))
(setq s (getreal "Enter the length of the pillar : "))
(setq x1 0 z1 0 x2 0 z2 0 i1 1)
(while (< i1 361)
(setq x2 (* r0 (sin (/ (* i1 3.1415926) 180))) )
(setq z2 (+ (* -1 r0) (* r0 (cos (/ (* i1 3.1415926) 180))) ))
(command "line" (list x2 0 z2) (list x2 s z2) "")
(command "line" (list x1 0 z1) (list x2 0 z2) "")
(setq i1 (+ i1 1) x1 x2 z1 z2)
)
(command "vpoint" " -1, -1, 1" "")
(command "zoom" "a" "")
)程式可以至http://web.mcvs.tp.edu.tw/cu01/下載Autolisp程式;
執行此Autolisp程式之後便可得到圓柱面圖形,如下圖所示,此圖形是以線條架構畫成,不是實體模型,主要是用來觀察待會求出來的交線有沒有在此圓柱面上。
接下來求圓柱與圓孔的交線,如下圖所示,a為Y軸與交點間的夾角,s為圓柱長度,圓孔圓之圓心位於Y軸0.5*s的地方,此圓孔圓原本是呈平躺狀態,為了投影方便,把它翻90度起來,以便求得交線,圓柱與圓孔交點的XY座標可由圓孔圓求得,而Z座標則由圓柱圓求得:
X座標:-r2 * sin( a )
Y座標:0.5*s + r2 *cos( a ),
Z座標:-r1+ m
程式如下:(defun c:kk()
(setq r1 (getreal "Enter the radius of the pillar : "))
(setq s (getreal "Enter the length of the pillar : "))
(setq r2 (getreal "Enter the radius of the hole: "))
(setq x1 0 z1 0 x2 0 z2 0 y1 0 y2 0 i1 1)
(command "color" "green" )
(while (< i1 362)
(setq x2 (* -1 r2 (sin(/ (* i1 3.1415926) 180))) )
(setq y2 (+ (* 0.5 s) (* r2 (cos (/ (* i1 3.1415926) 180))) ))
(setq z2 (+ (* -1 r1) (sqrt (- (* r1 r1) (* x2 x2))) ))
(if (> i1 1)
(command "line" (list x1 y1 z1) (list x2 y2 z2) "") )
(setq i1 (+ i1 1) x1 x2 y1 y2 z1 z2)
)
(command "vpoint" "-1,-1,1" "")
(command "zoom" "a" "")
)
執行Autolisp程式後,從圖形中可以確定這個交線確實位在圓柱面上,如下圖所示:
修改一下上個Autolisp程式後,更容易看出這個交線確實位在圓柱面上,如下圖所示:
求出交線之後,下一個重點便是如何用球刀對此交線倒角,導角量假設是0.5C, 本來預計可能有兩個方法可以算出倒角,一是切圓直徑用100.5mm下去算(實際上搪孔孔徑還是用100mm下去銑),球銑刀半徑10,另一種是切圓直徑用100mm, 球銑刀半徑則改為9.293mm下去算(但實際上還是用10mm下去銑),後來發覺第一種方法不可靠,可能會造成倒角量不固定,原因請看下圖,以較大的切圓直徑100.5mm下去投影,會發現真實倒角尺寸不固定,除了剛好在XY平面上的倒角尺寸符合需求,其它部位的倒角都會變得較大,且在角a2達90度及270度時,會變得最大。
現只能採第二種倒角求法,計算倒角時採用較小的球銑刀半徑,實際銑削時,再用大的球銑刀半徑,造成對原本的交線過切,以達到倒角的目的,假設實際銑削時的球銑刀半徑為10mm,並以球銑刀的刀球45度方位來銑削倒角,倒角尺寸為0.5mm,則計算用的球銑刀半徑為10 - 0.5/1.414 = 9.646mm。
球銑刀的球心路徑即為CNC銑削路徑,其XY座標可由圓孔圓求得,而Z座標則由圓柱圓求得:
X座標:-(r2 – r3/1.414) * sin( a ) ,r3為計算用的球銑刀半徑
Y座標:0.5*s + (r2 – r3/1.414) *cos( a ),s為圓柱長度
Z座標:-r1 + m11 + r3/1.414,m11 = sqrt( r1*r1 - r2* sin( a ) * r2* sin( a ) )
Autolisp程式如下 :
(defun c:kk()
(setq r1 0 r2 0 r3 0 s1 0)
(setq r1 (getreal "Enter the radius of the pillar : "))
(setq s1 (getreal "Enter the length of the pillar : "))
(setq r2 (getreal "Enter the radius of the hole: "))
(setq r3 (getreal "Enter the radius of the ball-endmilling: "))
(setq chm (getreal "Enter the size of chamfer: "))
(setq r3 (- r3 (/ chm 1.414)))
(setq x1 0 z1 0 x2 0 z2 0 y1 0 y2 0 i1 1 k1 0)
(command "color" "red" )
(while (< i1 362)
(setq x2 (* -1 (- r2 (/ r3 1.414)) (sin(/ (* i1 3.1416) 180))) )
(setq y2 (+ (* 0.5 s1) (* (- r2 (/ r3 1.414)) (cos (/ (* i1 3.1416) 180))) ))
(setq k1 (* r2 (sin(/ (* i1 3.1415926) 180))))
(setq z2 (+ (* -1 r1) (sqrt (- (* r1 r1) (* k1 k1))) (/ r3 1.414) ))
(if (> i1 1)
(command "line" (list x1 y1 z1) (list x2 y2 z2) "") )
(setq i1 (+ i1 1) x1 x2 y1 y2 z1 z2)
)
(command "vpoint" "-1,-1,1" "")
(command "zoom" "a" "")
)
下三圖之紅色路徑為球銑刀之球心路徑,亦即為CNC銑削倒角之路徑 :
立體圖
上視圖
正視圖
側視圖
留言
張貼留言