PCB genesis短槽加引導孔實現方法
阿新 • • 發佈:2018-11-13
一.何為短槽
短槽通常定義:槽長小於2倍槽寬 如:槽長1.8mm,槽寬1.0mm
二.為什麼要加短槽加引孔呢
短槽孔在鑽孔時孔易偏斜導致槽長偏短, 當槽長寬比越小,則受力越不均勻,在鑽第2個孔時,鑽頭兩邊受力不均勻再加上是順時針旋轉,會導至第2個孔往逆時針方向偏轉且變短(如下圖)
短槽偏位問題如何解決呢,在我們PCB行業最佳作法是在鑽槽孔之前,先在槽孔兩端2個小孔(如下圖).
在PCB行業已有很多短槽加工方法
具體方法請連結:PCB鑽孔--超短坑槽的加工方法
三.加短槽引孔實現原理
求解思路
1.已知短槽寬1.0mm與短槽2點座標
2.求出槽長=槽中心距0.8 + 槽寬1.0=1.8mm
3.求出引孔大小=(1.8-0.2)/2 =0.8mm
(0.2為2個引孔間距, 孔徑向下取整為鑽刀大小)
4.求出短槽的線拉伸距離=
(槽長1.8- 引孔大小0.8mm)-槽中心距0.8mm=0.2mm
5.求引孔座標,在短槽2點座標為一條線,在的基礎上拉伸0.2mm即可,每邊各拉0.1mm,即可得到引孔座標(下面程式碼有提供線拉伸函式)
四.C#簡易程式碼實現:
1.加短槽程式碼
#regionView Code短槽加引孔 ydkdrl List<gL> SlotList = glayer.Llist.Where(tt => ((calc2.p2p_di(tt.ps, tt.pe) + tt.width * 0.001) / (tt.width * 0.001)) < 2).ToList(); if (SlotList.Count() > 0) { if (!g.Check_Layer_Exist("ydkdrl")) g.CreateLayer("ydkdrl"); g.SetAffectedLayer("ydkdrl"); for (int i = 0; i < SlotList.Count; i++) { double HoleSize = ((int)(Math.Floor(((calc2.p2p_di(SlotList[i].ps, SlotList[i].pe) * 1000 + SlotList[i].width)) * 0.5 / 50)) * 50); SlotList[i] = calc2.l_extend(SlotList[i], (SlotList[i].width - HoleSize) * 0.001); addCOM.pad(SlotList[i].ps, HoleSize); addCOM.pad(SlotList[i].pe, HoleSize); } g.SetAffectedLayer(""); } #endregion
2.線拉伸函式(關鍵在於此函式實現)
/// <summary> /// 線Line拉伸 /// </summary> /// <param name="l"></param> /// <param name="extend_val">拉伸數值</param> /// <param name="type_">0兩端拉伸 1起點拉伸 2端點拉伸</param> /// <returns></returns> public gL l_extend(gL l, double extend_val, byte type_ = 0) { gL tempL = l; double angle_ = p_ang(l.ps, l.pe); if (type_ == 1) { tempL.ps = p_val_ang(l.ps, extend_val, p_ang_invert(angle_)); } else if (type_ == 2) { tempL.pe = p_val_ang(l.pe, extend_val, angle_); } else { extend_val = extend_val * 0.5; tempL.ps = p_val_ang(l.ps, extend_val, p_ang_invert(angle_)); tempL.pe = p_val_ang(l.pe, extend_val, angle_); } return tempL; } /// <summary> /// 求方位角 /// </summary> /// <param name="ps"></param> /// <param name="pe"></param> /// <returns></returns> public double p_ang(gPoint ps, gPoint pe) { double a_ang = Math.Atan((pe.y - ps.y) / (pe.x - ps.x)) / Math.PI * 180; //象限角 轉方位角 計算所屬象限 並求得方位角 if (pe.x >= ps.x && pe.y >= ps.y) //↗ 第一象限 { return a_ang; } else if (!(pe.x >= ps.x) && pe.y >= ps.y) // ↖ 第二象限 { return a_ang + 180; } else if (!(pe.x >= ps.x) && !(pe.y >= ps.y)) //↙ 第三象限 { return a_ang + 180; } else if (pe.x >= ps.x && !(pe.y >= ps.y)) // ↘ 第四象限 { return a_ang + 360; } else { return a_ang; } } /// <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.點線資料結構
/// <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; } } /// <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; }View Code
五.加短槽引孔指令碼UI
六.加短槽效果