zoukankan      html  css  js  c++  java
  • 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

    五.实现效果

  • 相关阅读:
    C++类构造函数初始化列表
    VC++检测硬件设备状态
    MFC中调用Windows API函数的方式
    DEBUG无法进入断点解决方法
    【转】c++数组初始化
    vc++实现控制USB设备启用与否
    3d图像坐标轴及css3属性的讲解
    Ajax的兼容及Ajax的缓存问题
    Ajax中最有名axios插件(只应用于Ajax)(post方法,官网写错了,应是字符串格式)
    文档碎片及xml讲解
  • 原文地址:https://www.cnblogs.com/pcbren/p/9906536.html
Copyright © 2011-2022 走看看