PCB genesis方槽加内角槽孔实现方法

Posted pcbren

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PCB genesis方槽加内角槽孔实现方法相关的知识,希望对你有一定的参考价值。

 一.为什么方槽孔加内角孔

      如下图,客户来的方槽或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 glayer = 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
View Code

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

五.实现效果

技术分享图片

 

以上是关于PCB genesis方槽加内角槽孔实现方法的主要内容,如果未能解决你的问题,请参考以下文章

PCB genesis连孔加除毛刺孔(槽孔与槽孔)实现方法

PCB SLOT槽孔数量计算方法,同CAM350孔数一致 实现方法

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

PCB 圆形板切边算法 实现

一个优美的时间片轮转调度算法模拟Python实现

PCB 奥宝LDI 输出正负片转换关系