跳到主要內容

錐面孔倒角(三)

文章日期:2009-02-19 11:46


現在進入主題--錐面軸向直孔的倒角,倒角之前首先得要瞭解市售的45度外倒角刀,如下圖所示
        
                         

由於軸向直孔壁與錐面兩者之間的夾角是不固定的,所以倒角帶的高度也不固定,如下圖中的C1C2所示,C1是最淺的倒角帶高度,而C2則是最深的倒角帶高度,故使用者輸入之倒角深度hk必需大於C2才行。


倒角方法 :
原本想用省事的方法,以直孔和錐面所形成的交線為基準,然後垂直往外倒0.3C的倒角,不過,此法經仔細推敲之後,發現會造成倒角尺寸不穩定,如下圖所示,原本上圖中的C1是最淺的倒角帶高度,但經此法倒角之後反成最深的倒角帶高度
   

因此,倒角的方法還是要先在上視圖的地方先畫出倒角圓,並以此倒角圓投影下來到錐面上,以求得錐面上的倒角圓曲線上的各個座標,最後再以這些座標向內及向下偏置,以求得銑刀底圓中心的座標,這樣才能得到CNC程式所需的座標點
  
AutoLISP的寫法 :
(defun c:bt()
  (command "color" "bylayer" "")
  (setq   r1 5.0  r2 15.0  h1 5.0  r3 4.0  r0 1.0  h0 3.0  c0 0.5)
  (setq r1 (/ (getreal "\nEnter the top diameter : ") 2 ))
  (setq r2 (/ (getreal "\nEnter the bottom diameter : ") 2 ))
  (setq h1 (getreal "\nEnter the height : "))
  (setq r3 (/ (getreal "\nEnter the diameter of the hole : ") 2 ))
  (setq r0 (/ (getreal "\nEnter the bottom diameter of the chamfer tool : ") 2 ))
  (setq h0 (abs (getreal "\nEnter the chamfering height of the chamfer tool : ")) )
  (setq c0 (getreal "\nEnter the chamfering size : ") 2 )
  (setq  x2 0  y2 0  x22 0   y22 0 )
  (setq  i1 1  cta (/ 3.1415926 180.0)  ctaWk 0  h1 (* -1 (abs h1)) )
  (while (< i1 361)
    (setq ctaWk (* cta i1))
    (setq x2   (* r1 (cos ctaWk))    y2 (* r1 (sin ctaWk )) )
    (setq x22  (* r2 (cos ctaWk))  y22 (* r2 (sin ctaWk )) )
    (command "line" (list x2 y2 0) (list x22 y22 h1) "" )
    (setq i1 (+ 1 i1))
  )

  (command "zoom" "e" "")
  (command "vpoint" "1,-1,1"  "")


  (setq  delR (- r2 r1) z2 0  x1 0   y1 0 x2 0  y2 0)
  (setq  x11 0   y11 0 z11 0  x22 0   y22 0 z22 0)
  (setq  c1 (/ (+ r1 r2) 2)   s1 (/ (* r1 h1) delR) )
  (setq tanValue (/ h1 delR ))
  (setq  i1 0  ctaWk 0  )
  (command "color" "red" "")
  (while (< i1 361)
    (setq ctaWk (* cta i1))
    (setq x2 (+ c1 (* r3 (cos ctaWk)))    y2 (+ 0 (* r3 (sin ctaWk))) )
    (setq z2 (- (* (sqrt (+ (* x2 x2) (* y2 y2))) tanValue) s1))
    (setq x22 (+ c1 (* (+ r3 c0) (cos ctaWk)))    y22 (+ 0 (* (+ r3 c0) (sin ctaWk))) )
    (setq z22 (- (* (sqrt (+ (* x22 x22) (* y22 y22))) tanValue) s1))
    (if (> i1 0 )
      (progn
        (command "color" "red" "")
        (command "line" (list x1 y1 z1) (list x2 y2 z2) "" )
        (command "line" (list x11 y11 z11) (list x22 y22 z22) "" )
        (command "line" (list x1 y1 10)   (list x2 y2 10) "" )
        (command "line" (list x11 y11 10)   (list x22 y22 10) "" )
        (if (= (rem i1 6 ) 0 )
           (progn
             (command "color" "green" "")
             (command "line" (list x22 y22 10) (list x22 y22 z2) "" ) ))))
    (setq x1 x2   y1 y2   z1 z2    x11 x22    y11 y22   z11 z22)
    (setq i1 (+ 1 i1))
  )
)
啟動AutoLISP後AutoCAD便可自動畫出如下之圖,圖中紅色內圓是直孔,紅色外圓是倒角用的,有了外圓這些座標後向內及向下偏置,就可求得銑刀底圓中心的座標

   
 
將上述程式修改一下,如下所示,把倒角畫出來,啟動AutoLISP後則可得到下列圖形
   (defun c:bt()
  (command "color" "bylayer" "")
  (setq   r1 5.0  r2 15.0  h1 5.0  r3 4.0  r0 1.0  h0 3.0  c0 0.5)
  (setq r1 (/ (getreal "\nEnter the top diameter : ") 2 ))
  (setq r2 (/ (getreal "\nEnter the bottom diameter : ") 2 ))
  (setq h1 (getreal "\nEnter the height : "))
  (setq r3 (/ (getreal "\nEnter the diameter of the hole : ") 2 ))
  (setq r0 (/ (getreal "\nEnter the bottom diameter of the chamfer tool : ") 2 ))
  (setq h0 (abs (getreal "\nEnter the chamfering height of the chamfer tool : ")) )
  (setq c0 (getreal "\nEnter the chamfering size : ") 2 )
  (setq  x2 0  y2 0  x22 0   y22 0 )
  (setq  i1 1  cta (/ 3.1415926 180.0)  ctaWk 0  h1 (* -1 (abs h1)) )
  (while (< i1 361)
    (setq ctaWk (* cta i1))
    (setq x2   (* r1 (cos ctaWk))    y2 (* r1 (sin ctaWk )) )
    (setq x22  (* r2 (cos ctaWk))  y22 (* r2 (sin ctaWk )) )
    (command "line" (list x2 y2 0) (list x22 y22 h1) "" )
    (setq i1 (+ 1 i1))
  )
  (command "zoom" "e" "")
  (command "vpoint" "1,-1,1"  "")

  (setq  delR (- r2 r1) z2 0  x1 0   y1 0 x2 0  y2 0)
  (setq  x11 0   y11 0 z11 0  x22 0   y22 0 z22 0  x3 0  y3 0  z3  0)
  (setq  c1 (/ (+ r1 r2) 2)   s1 (/ (* r1 h1) delR) )
  (setq tanValue (/ h1 delR ))
  (setq  i1 0  ctaWk 0  )
  (command "color" "red" "")
  (while (< i1 361)
    (setq ctaWk (* cta i1))
    (setq x2 (+ c1 (* r3 (cos ctaWk)))    y2 (+ 0 (* r3 (sin ctaWk))) )
    (setq z2 (- (* (sqrt (+ (* x2 x2) (* y2 y2))) tanValue) s1))
    (setq x22 (+ c1 (* (+ r3 c0) (cos ctaWk)))    y22 (+ 0 (* (+ r3 c0) (sin ctaWk))) )
    (setq z22 (- (* (sqrt (+ (* x22 x22) (* y22 y22))) tanValue) s1))
    (if (> i1 0 )
      (progn
        (command "color" "red" "")
        (command "line" (list x1 y1 (- z11 c0)) (list x2 y2 (- z22 c0)) "" )
        (command "line" (list x11 y11 z11) (list x22 y22 z22) "" )
        (command "line" (list x2 y2 (- z22 c0)) (list x22 y22 z22) "" )
         (command "line" (list x11 y11 10)   (list x22 y22 10) "" )
        (if (= (rem i1 6 ) 0 )
           (progn
             (command "color" "green" "")
             (command "line" (list x22 y22 10) (list x22 y22 z22) "" ) ))))
    (setq x1 x2   y1 y2   z1 z2    x11 x22    y11 y22   z11 z22)
    (setq i1 (+ 1 i1))
  )
)
   

   

   

最後得將倒角刀底圓中心的路徑角畫出來驗証看看,再來用AutoLISP寫CNC程式,啟動AutoLISP後則可得到下列圖形 :
   

   

   

AutoLISP程式如下:
(defun c:bt()
  (command "color" "bylayer" "")
  (setq   r1 5.0  r2 15.0  h1 5.0  r3 4.0  r0 1.0  h0 3.0  c0 0.5)
  (setq r1 (/ (getreal "\nEnter the top diameter : ") 2 ))
  (setq r2 (/ (getreal "\nEnter the bottom diameter : ") 2 ))
  (setq h1 (getreal "\nEnter the height : "))
  (setq r3 (/ (getreal "\nEnter the diameter of the hole : ") 2 ))
  (setq r0 (/ (getreal "\nEnter the bottom diameter of the chamfer tool : ") 2 ))
  (setq h0 (abs (getreal "\nEnter the chamfering height of the chamfer tool : ")) )
  (setq c0 (getreal "\nEnter the chamfering size : ") )
  (setq  x2 0  y2 0  x22 0   y22 0 )
  (setq  i1 1  cta (/ 3.1415926 180.0)  ctaWk 0  h1 (* -1 (abs h1)) )
  (while (< i1 361)
    (setq ctaWk (* cta i1))
    (setq x2   (* r1 (cos ctaWk))    y2 (* r1 (sin ctaWk )) )
    (setq x22  (* r2 (cos ctaWk))  y22 (* r2 (sin ctaWk )) )
    (command "line" (list x2 y2 0) (list x22 y22 h1) "" )
    (setq i1 (+ 1 i1))
  )
  (command "zoom" "e" "")
  (command "vpoint" "1,-1,1"  "")

  (setq  delR (- r2 r1) z2 0  x1 0   y1 0 x2 0  y2 0  x3 0  y3 0  z3  0  x4 0  y4 0)
  (setq  x11 0   y11 0 z11 0  x22 0   y22 0 z22 0  x33 0  y33 0  z33  0  x44 0 y44 0)
  (setq  c1 (/ (+ r1 r2) 2)   s1 (/ (* r1 h1) delR) )
  (setq tanValue (/ h1 delR ))
  (setq  i1 0  ctaWk 0  )
  (command "color" "red" "")
  (while (< i1 361)
    (setq ctaWk (* cta i1))
    (setq x2 (+ c1 (* r3 (cos ctaWk)))    y2 (+ 0 (* r3 (sin ctaWk))) )
    (setq z2 (- (* (sqrt (+ (* x2 x2) (* y2 y2))) tanValue) s1))
    (setq x22 (+ c1 (* (+ r3 c0) (cos ctaWk)))    y22 (+ 0 (* (+ r3 c0) (sin ctaWk))) )
    (setq z22 (- (* (sqrt (+ (* x22 x22) (* y22 y22))) tanValue) s1))
    (setq x33 (+ c1 (* (- (+ r3 c0) h0) (cos ctaWk)))  y33 (+ 0 (* (- (+ r3 c0) h0 ) (sin ctaWk))) )
    (setq x44 (+ c1 (* (- (+ r3 c0) r0 h0) (cos ctaWk)))  y44 (+ 0 (* (- (+ r3 c0) r0 h0) (sin ctaWk))) )
    (setq z33 (- z22 h0) )
    (if (> i1 0 )
      (progn
        (command "color" "red" "")
        (command "line" (list x1 y1 (- z11 c0)) (list x2 y2 (- z22 c0)) "" )
        (command "line" (list x11 y11 z11) (list x22 y22 z22) "" )
        (command "line" (list x2 y2 (- z22 c0)) (list x22 y22 z22) "" )
        (command "line" (list x3 y3 z33) (list x33 y33 z33) "" )
        (command "line" (list x4 y4 z33) (list x44 y44 z33) "" )
        (if (= (rem i1 5 ) 0 )
           (progn
             (command "color" "green" "")
             (command "line" (list x33 y33 z33)   (list x22 y22 z22) "" )   ))))
    (setq x1 x2   y1 y2   z1 z2    x11 x22    y11 y22   z11 z22  x3 x33   y3 y33  x4 x44  y4 y44)
    (setq i1 (+ 1 i1))
  )
)
篇幅所限,下篇文章再來寫如何用AutoLISP寫CNC程式
http://tw.myblog.yahoo.com/cu01joe/article?mid=1997&prev=2091&next=1970

留言

這個網誌中的熱門文章

管牙PT

文章日期:2009-07-12 23:08 本文旨在講解 PT錐度管牙 常見的標準的管牙規範計有:  NPT , NPTF ,NPS , PS ,PF , PT.. ,前3者有N開頭的是美國標準的管牙 ,牙角(又稱螺紋角)60度 ,後面這3者則是英國標準的管牙 ,牙角55度 ,這些代號裡面的T意指Taper ,也就是錐度牙 。 不論是PT還是NPT,他們的錐度值都是1/16, 換算成角度值是 2*tan-1(0.5/16)=3.57982度 = 3度34分47.356秒, 3.57982度為什麼等於3度34分47.356分呢? 這是因為角度的單位換算是六十進位,3.5798212度後面的小數點0.5798212"度"要換算成""分"時,0.5798212度 = 0.57982*60分 = 34.789273分 ,而34.789273分後面的小數點0.789273分要換算成秒, 則0.789273*60秒 = 47.356秒。 此外,切記在車削錐牙時得採半錐角,也就是1度47分23.7秒。 NPT (美制管用推拔螺紋) 制定在 ANSI 規格中,稱為美國標準管用推拔螺紋,有外螺紋與內螺紋。 NPT 外螺紋不但對 NPT 內螺紋配合,有時也配合 NPSC ,這點類似 PT 。螺紋峰與根切成同形,又因公差大,餘隙、緊密兩種配合都可用。如用潤滑劑,則變成耐密用,耐密用者另有稱為乾封閉之如 NPTF,NPSF 等付有 F 之一群。 NPTF (美制管用耐密推拔螺紋) NPTF 外螺紋,像 PT.NPT 有時也配合 NPSF.NPSI (都是內螺紋)。因這種螺紋都是峯尖、根淺,峯不是密接於根就是食進,可防止在此部分變成螺旋狀間隙,這是前述耐密性之理由。 PT( 英制管用推拔螺紋 ) 以前是使用面直角的螺紋峯,現在將規格統一為軸直角者。 JIS 定為耐密用而組合外螺紋和內螺紋。 PT 外螺紋除了配合 PT 內螺紋,有時也配合 PS 。 PS ( 英制管用推拔螺紋用平行內螺紋   ─   耐密用 )     屬於 JIS 內 PT 的規格,舊 JIS 裏 PS 牙的外螺紋已被取消,配合的外螺紋現規定要用 PT 。 PF( 英制管用平行螺紋 ...

G76車牙

文章日期:2008-10-10 00:02 工具機若使用 Fanuc 控制器,車牙轉速有一個先天上的限制: S × P < 4000 請參考 車牙的 NC 碼計有 G32 、 G92 、 G76 三種 ( 使用方法 這三個指令中,手寫 G92 一般是直進式切削,牙刀的兩刃皆受力,直進式切削 ,每刀吃深不多,以免造成牙面粗糙,反觀 G76 則是斜進式單邊車削 ,可以有較大的進刀深度 , 寫法也簡短方便廣受採用,不論多大的牙, G76 只要兩個單節就可解決了。 由於 G76 有單邊切削的效果,廣受學校或職訓單位的喜愛,如下圖所示。         Fanuc0T系列控制器之G76 格式如下 : 指令說明 (m) : 精車次數。 (r) : 車牙末端 拔刀時留下的不完全牙長度(倍率)。 (a) :牙刀之角度,可選擇 80 °、 60 °、 55 °、 30 °、 29 °、 0 °等角度。 Q( △ dmin) :最小進刀深度。 R(d) :精車預留量。 X(u) :螺紋程式終點的 X 軸方向座標。 Z(w) :螺紋程式終點的 Z 軸方向座標。 R(i) :螺紋部份的半徑差,如果 I=0 可作一般直線螺紋車削。 P(k) :螺紋高度即牙深度, K 為正值在 X 軸方向用半徑值指定。 Q( △ d) :第一次螺紋的切削深度,用半徑值指定。 F(l) :螺紋的導程,與 G32 相同。 以M20X2.5外螺紋為例 , 常見的寫法如下 : G76 P01 00 60 Q40 R0.02 G76 X16.933 Z-10.0  P1533    Q500   F2.5 1. G76第一行的 P01 00 60 ,這01表示最後精車時只車一刀精車, 00 表示車牙最後拔刀時不留倒角 ,此所謂之倒角是 不完全牙之意 ,亦即因拔刀而在工件上留下牙深較淺的牙 ,Fanuc的拔刀精度是0.1倍的導程 , 若是此值改成10,則表示拔刀時在軸向會留下一倍導程長度的不完全牙,這一倍就是指導程2.5的一倍,也就是不完全牙會有2.5mm那麼長, 60 ...

G70-G76

文章日期:2008-10-12 23:01   G71的使用法及優點 G71名稱為 : Z軸向粗車削循環,它可說是Fanuc最強大的形狀車削指令,幾乎所有手寫走刀式CNC車床程式的人都會用到它,使用時只要在指定的前後某兩個Nxxxx單節之間,輸入工件的車削範圍,就可將此車削範圍內的材料全部粗車去除,並且合併著G70使用,僅僅一行單節就完成精車部位    以Fanuc0T系列為例,它的寫法如下: G71 U2.5 R0.5 G71 P10 Q20 U0.3 W0.1 F0.3 N10 …… …(車削範圍)….…… N20 ………………. 第一行的G71的U2.5是指每次進刀(單邊)2.5mm,R0.5是指退刀高度,第二行的G71的P10是指車削範圍的起始單節編號為10,所以在G71之後可以看到N10….,而Q20是指車削範圍的終止單節編號為20,所以在N10及車削範圍單節之後,就可以看到N20,至於第二行的U0.3 W0.1,是指粗車指定的車削範圍之後,工件表面餘留的精車量,U0.3是指X軸向精車的預留量(雙邊)為0.3mm,如果車內徑,此值就設為負值,W0.1是指Z軸向精車的預留量為0.1mm。 第二行的F0.3,即車床會以F0.3為粗車之進給速率,若車削範圍內出現F,則會改以此新出現之F當進給速率。 如果G71包含之車削範圍就是精車範圍,則可使用G70, 其做法是將精車刀定位到與G71同樣的出發點之後,再呼叫G70即可, 只要一個單節就可以完成精車,不用再把精車路徑重寫一遍,相當好用, G70寫法如下 : G70 P10 Q20 F0.1( 要記得G70的P...Q..要與G71的P...Q..一樣才行。) G70後面若加寫F0.1,則便以F0.1為精車之進給速率,否則便以存留之F(譬如說上一刀所使用之F)當進給速率,車削範圍內若出現F,則以此新出現之F當進給速率。 G71的缺點 1.對於Fanuc0T的控制器來說,外徑工件,其直徑只能越來越大,不能有大的凹槽(直徑變小)的情況,否則會過切,而對於於內徑來說,其直徑只能越來越小,且不能有大的凹槽(直徑變大)的情況,否則會過切,以下圖為例,需將工件G71區拆解出來。 ...