PCB Genesis 外形加內角孔實現方法
阿新 • • 發佈:2018-09-18
spa pub 2pc als pan 代碼 nes 目前 font
如果客戶此槽需插元器件可能無法插入的影響
在PCB工程制作CAM時,經常會遇到外形拐角處直角的,而客戶對內角是要求,比如最大內角要求R0.5mm或者不接受內角,
但成型方式為銑方式,又不是啤板成型,那怎麽處理才可以達到要求效果呢,在這裏介紹2種方法。
一.采用大小鑼刀分2次鑼外形
由於采用2次鑼,此效率較低,目前PCB行業基本已放棄此方法了處理內角了,
要知道我們PCB行業是非常很重視效率,為了提高效率,PCB行業普遍采用第2種方法(詳見方法2)
二.在外形拐角處加----內角孔
方槽為直角時,用直徑2.0mm鑼刀,內角無法鑼出直角效果,
像如下圖所示:這樣就會造成內角R1.0mm內角
如果客戶此槽需插元器件可能無法插入的影響
如下圖這樣加內角孔後,比第一種方法效率要高多了,也達到了同樣處理內角的效果
三.代碼實現:
如下代碼是:線與線求相切圓, (弧與線,弧與弧 求相切圓的原理是相似的,可以在此基礎上擴展)
/// <summary> /// 線段與線段倒圓角 /// </summary> /// <param name="l1"></param> /// <param name="l2"></param> ///View Code<param name="tolerance"></param> /// <returns></returns> public gL_di l2l_Round(ref gL l1, ref gL l2, double Radius, double tolerance = 0.5) { gL_di gldi = new gL_di(); int isIntersectType = 0; gPoint pc = l2l_Intersect(l1, l2, refisIntersectType); if (isIntersectType == 0) //平行無交點 平行線方位角相同 接近平行線 相差接近 { return gldi; } else { double l1pspc = p2p_di(pc, l1.ps); double l1pepc = p2p_di(pc, l1.pe); double l2pspc = p2p_di(pc, l2.ps); double l2pepc = p2p_di(pc, l2.pe); gPoint p1, p2, p11, p22; double p1pc, p2pc; Ptype p1Type, p2Type; if (l1pspc > l1pepc) { p1 = l1.pe; p11 = l1.ps; p1pc = l1pepc; p1Type = Ptype.pe; } else { p1 = l1.ps; p11 = l1.pe; p1pc = l1pspc; p1Type = Ptype.ps; } if (l2pspc > l2pepc) { p2 = l2.pe; p22 = l2.ps; p2pc = l2pepc; p2Type = Ptype.pe; } else { p2 = l2.ps; p22 = l2.pe; p2pc = l2pspc; p2Type = Ptype.ps; } gldi = new gL_di(p1, p1Type, p2, p2Type, pc); //交點與2條線端點距離判斷 確認兩條線是否接合 ---另一個參數 兩條相接近平行且兩條線接近需加以修復,延長非常長,超公差,但也需修復 if (p1pc > tolerance || p2pc > tolerance) return gldi; //倒角線段長小於圓弧半徑 if ((p1Type == Ptype.ps && l1pepc < Radius) || (p1Type == Ptype.pe && l1pspc < Radius)) return gldi; if ((p2Type == Ptype.ps && l2pepc < Radius) || (p2Type == Ptype.pe && l2pspc < Radius)) return gldi; double center_dirdction = 0; bool islg180deg = true; double pcAng = a_Angle(p11, pc, p22, false, ref center_dirdction, ref islg180deg);//交點圓心角 if (Math.Abs(180 - pcAng) < 0.01) //夾角接近180度 返回 return gldi; double pcSinVal = Radius / (Math.Sin(pcAng * 0.5 * Math.PI / 180)); //交點增量 double pcTanVal = Radius / (Math.Tan(pcAng * 0.5 * Math.PI / 180)); //交點Tan增量 gA ga = new gA(); ga.pc = p_val_ang(pc, pcSinVal, center_dirdction); ga.ps = p_val_ang(pc, pcTanVal, center_dirdction - pcAng * 0.5); ga.pe = p_val_ang(pc, pcTanVal, center_dirdction + pcAng * 0.5); ga.width = 500; ga.symbols = ""; gldi.a = ga; gldi.State = 1; if (p1Type == Ptype.pe) { l1.pe = islg180deg ? ga.pe : ga.ps; } else { l1.ps = islg180deg ? ga.pe : ga.ps; } if (p2Type == Ptype.pe) { l2.pe = islg180deg ? ga.ps : ga.pe; } else { l2.ps = islg180deg ? ga.ps : ga.pe; } } return gldi; }
返回Mode類
/// <summary> /// Line 數據類型 /// </summary> public struct gL_di { public gL_di(gPoint p1_, Ptype p1_Ptype_, gPoint p2_, Ptype p2_Ptype_, gPoint pc_ = new gPoint()) { this.p1 = p1_; this.p2 = p2_; this.p1_Ptype = p1_Ptype_; this.p2_Ptype = p2_Ptype_; this.pc = pc_; this.State = 0; this.a = new gA(); } /// <summary> /// 狀態 0失敗 1成功 /// </summary> public int State { get; set; } /// <summary> /// P1端點 /// </summary> public gPoint p1 { get; set; } /// <summary> /// P2端點 /// </summary> public gPoint p2 { get; set; } /// <summary> /// 原線段P1端點類型 /// </summary> public Ptype p1_Ptype { get; set; } /// <summary> /// 原線段P2端點類型 /// </summary> public Ptype p2_Ptype { get; set; } /// <summary> /// 倒角後生成的數據 /// </summary> public gA a { get; set; } /// <summary> /// PC端點(交點) /// </summary> public gPoint pc { get; set; } public double p1p2_di { get { return p2p_di(this.p1, this.p2); } } public double p1pc_di { get { return p2p_di(this.p1, this.pc); } } public double p2pc_di { get { return p2p_di(this.p2, this.pc); } } /// <summary> /// 返回兩點之間歐氏距離 /// </summary> /// <param name="p1"></param> /// <param name="p2"></param> /// <returns></returns> public static double p2p_di(gPoint p1, gPoint p2) { return Math.Sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y)); } }View Code
四.框選加內角孔實現效果
五.整板加內角孔實現效果
PCB Genesis 外形加內角孔實現方法