PCB Genesis 外形加内角孔实现方法

 在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>
        /// <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, ref isIntersectType);
            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;
        }
View Code

返回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

 

五.框选加内角孔实现效果

 

六.整板加内角孔实现效果

posted @ 2018-09-17 22:18  pcbren  阅读(2567)  评论(0编辑  收藏  举报