PCB genesis方槽加內角槽孔實現方法
阿新 • • 發佈:2018-11-28
一.為什麼方槽孔加內角孔
如下圖,客戶來的方槽或Slot槽有內角尺寸要求,通常直接鑽一個Slot槽孔內角是不能滿足客戶要求的,這時我們做CAM的需採用小鑽刀進行處理.加內角孔或內角槽的方式進行處理了.
二.為什麼不建議直接在4個角加內角孔
Slot槽4個角採用加內角孔的方式處理,這樣會導致如下圖效果,凸起.
三.方槽加內角槽孔方式(裡面加4條槽)
1.常規槽寬則計算方式:
內角槽孔寬度:(W-0.1mm)/2
如:2.0X5.0mm槽寬,內角要求最大r0.5mm 那麼內角槽寬為(2-0.1)/2 =0.95mm
2.特殊情況內角槽寬(不能滿足內角尺寸要求):
如:2.0X3.0mm,內角要求最大r0.4mm,如按上面常規計算內角槽寬(1-0.1)/2=0.95mm
選用0.95mm鑽刀,無法滿足r0.4mm內角尺寸要求,這時需選用0.8mm鑽刀
3.特殊情況槽寬(無槽刀):
如:1.0X3.0mm,內角要求最大r0.3mm,如按上面常規計算內角槽寬(1-0.1)/2=0.45mm
實際沒有0.45mm槽刀,那這種情況,需選0.6mm槽刀,存在短槽孔時,鑽刀需減速慢鑽
此計算未考慮補償,如真實計算需將鑽孔補償考慮進來.
四.C#簡易程式碼實現:
1.方槽加內角槽孔程式碼
#region 方槽 加內角孔 gLayer glayerView Code= g.getFEATURES($"{"drl"}", g.STEP, g.JOB, "mm", true); foreach (var item in glayer.Llist) { List<gL> glList = calc2.l_InnerLine(item); addCOM.line(glList); } #endregion
2.計算函式
/// <summary> /// 將線段轉為內切邊的4條線段 /// </summary> /// <param name="l"></param> /// <param name="SlotWidth">4個SLOT槽寬 當為0時,自動計算SLOT槽寬</param> /// <param name="UpVal">單邊預大值</param> /// <returns></returns> public List<gL> l_InnerLine(gL l, double SlotWidth = 0, double UpVal = 0) { List<gL> lineList = new List<gL>(); double width = l.width * 0.001; if (SlotWidth < 0.001) { SlotWidth = ((width + UpVal * 2) - 0.1)*0.5; SlotWidth = ((int)(Math.Floor((SlotWidth * 1000) / 50)) * 50) * 0.001; ; } double val = (width - SlotWidth)* 0.5 + UpVal ; double ang_direction = p_ang(l); double length = width + UpVal * 2 - SlotWidth; gL gL1 = p_val_angL(l.pe, val, ang_direction, length); gL1.width = SlotWidth * 1000; gL gL2 = p_val_angL(l.ps, val, p_ang_invert(ang_direction), length); gL2.width = SlotWidth * 1000; lineList.Add(gL1); lineList.Add(gL2); lineList.Add(new gL(gL1.ps, gL2.pe, gL1.width)); lineList.Add(new gL(gL1.pe, gL2.ps, gL1.width)); return lineList; } /// <summary> /// 求方位角 /// </summary> /// <param name="l"></param> /// <returns></returns> public double p_ang(gL l)//求方位角 { return p_ang(l.ps, l.pe); } /// <summary> /// //求增量T 線L座標 /// </summary> /// <param name="ps"></param> /// <param name="val"></param> /// <param name="ang_direction"></param> /// <param name="length"></param> /// <returns></returns> public gL p_val_angL(gPoint ps, double val, double ang_direction, double length = 2) { gPoint pe = p_val_ang(ps, val, ang_direction); gL tempL; tempL.ps = p_val_ang(pe, length * 0.5, ang_direction + 90); tempL.pe = p_val_ang(pe, length * 0.5, ang_direction - 90); tempL.negative = false; tempL.attribut = ""; tempL.symbols = ""; tempL.width = 121; return tempL; } /// <summary> /// 求反方位角 /// </summary> /// <param name="ang_direction"></param> /// <returns></returns> public double p_ang_invert(double ang_direction)//求反方位角 { if (ang_direction >= 180) return ang_direction - 180; else return ang_direction + 180; } /// <summary> /// 求增量座標 /// </summary> /// <param name="ps">起點</param> /// <param name="val">增量值</param> /// <param name="ang_direction">角度</param> /// <returns></returns> public gPoint p_val_ang(gPoint ps, double val, double ang_direction) { gPoint pe; pe.x = ps.x + val * Math.Cos(ang_direction * Math.PI / 180); pe.y = ps.y + val * Math.Sin(ang_direction * Math.PI / 180); return pe; }View Code
3.Point,PAD;Line資料結構
/// <summary> /// Line 資料型別 /// </summary> public struct gL { public gL(double ps_x, double ps_y, double pe_x, double pe_y, double width_) { this.ps = new gPoint(ps_x, ps_y); this.pe = new gPoint(pe_x, pe_y); this.negative = false; this.symbols = "r"; this.attribut = string.Empty; this.width = width_; } public gL(gPoint ps_, gPoint pe_, double width_) { this.ps = ps_; this.pe = pe_; this.negative = false; this.symbols = "r"; this.attribut = string.Empty; this.width = width_; } public gL(gPoint ps_, gPoint pe_, string symbols_, double width_) { this.ps = ps_; this.pe = pe_; this.negative = false; this.symbols = symbols_; this.attribut = string.Empty; this.width = width_; } public gPoint ps; public gPoint pe; public bool negative;//polarity-- positive negative public string symbols; public string attribut; public double width; public static gL operator +(gL l1, gPoint move_p) { l1.ps += move_p; l1.pe += move_p; return l1; } public static gL operator +(gL l1, gP move_p) { l1.ps += move_p.p; l1.pe += move_p.p; return l1; } public static gL operator -(gL l1, gPoint move_p) { l1.ps -= move_p; l1.pe -= move_p; return l1; } public static gL operator -(gL l1, gP move_p) { l1.ps -= move_p.p; l1.pe -= move_p.p; return l1; } } /// <summary> /// PAD 資料型別 /// </summary> public struct gP { public gP(double x_val, double y_val, double width_) { this.p = new gPoint(x_val, y_val); this.negative = false; this.angle = 0; this.mirror = false; this.symbols = "r"; this.attribut = string.Empty; this.width = width_; } public gPoint p; public bool negative;//polarity-- positive negative public double angle; public bool mirror; public string symbols; public string attribut; public double width; public static gP operator +(gP p1, gP p2) { p1.p += p2.p; return p1; } public static gP operator -(gP p1, gP p2) { p1.p -= p2.p; return p1; } } /// <summary> /// 點 資料型別 (XY) /// </summary> public struct gPoint { public gPoint(gPoint p_) { this.x = p_.x; this.y = p_.y; } public gPoint(double x_val, double y_val) { this.x = x_val; this.y = y_val; } public double x; public double y; public static gPoint operator +(gPoint p1, gPoint p2) { p1.x += p2.x; p1.y += p2.y; return p1; } public static gPoint operator -(gPoint p1, gPoint p2) { p1.x -= p2.x; p1.y -= p2.y; return p1; } }View Code
五.實現效果