一.何为短槽
短槽通常定义:槽长小于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.加短槽代码
#region 短槽加引孔 ydkdrl
List<gL> SlotList = glayer.Llist.Where(tt => ((calc2.p2p_di(tt.ps, tt.pe) + tt.width * 0.001) / (tt.width * 0.001)) < ).ToList();
if (SlotList.Count() > )
{
if (!g.Check_Layer_Exist("ydkdrl")) g.CreateLayer("ydkdrl");
g.SetAffectedLayer("ydkdrl");
for (int i = ; i < SlotList.Count; i++)
{
double HoleSize = ((int)(Math.Floor(((calc2.p2p_di(SlotList[i].ps, SlotList[i].pe) * + SlotList[i].width)) * 0.5 / )) * );
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_ = )
{
gL tempL = l;
double angle_ = p_ang(l.ps, l.pe);
if (type_ == )
{
tempL.ps = p_val_ang(l.ps, extend_val, p_ang_invert(angle_));
}
else if (type_ == )
{
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 * ;
//象限角 转方位角 计算所属象限 并求得方位角
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 + ;
}
else 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 + ;
}
else
{
return a_ang;
}
} /// <summary>
/// 求反方位角
/// </summary>
/// <param name="ang_direction"></param>
/// <returns></returns>
public double p_ang_invert(double ang_direction)//求反方位角
{
if (ang_direction >= )
return ang_direction - ;
else
return ang_direction + ;
}
/// <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 / );
pe.y = ps.y + val * Math.Sin(ang_direction * Math.PI / );
return pe;
}
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;
}
五.加短槽引孔脚本UI
六.加短槽效果