那是在2016年初,项目有需求,软件没这项功能,然后想到了自己做的MeGauging中有这样的功能,修改即可
谁也不知道
谁也没告诉
当时有点怕怕
很谨慎,反复测试,用了半年,很稳定,戒备心也慢慢放下了,就是下面这个图中红色的框,以及中心十字:
这个通道可以看得再清晰一些:
当下这个红色框占用的通道是20um宽度,一系列的还有8um通道,4um通道等等,激光就是要在这个晶圆通道切割。
代码如下:
double lmapsx1 = 0, lmapsy1 = 0, lmapex1 = 0, lmapey1 = 0;
ccbt.Calibration.GetComputedUncalibratedFromCalibratedTransform().MapPoint(startx, starty, out lmapsx1, out lmapsy1);
ccbt.Calibration.GetComputedUncalibratedFromCalibratedTransform().MapPoint(endx, endy, out lmapex1, out lmapey1);
//刻画通道矩形,用自己的代码,comefrom MeGauging
#region DrawRect
int tdwidth00 = Convert.ToInt32(tongdao00.Text);//这里是通道宽度
PointF m_RcCenter = drawtongdaorect(lmapsx1, lmapsy1, lmapex1, lmapey1, tdwidth00);
#endregion DrawRect
函数原型:
private PointF drawtongdaorect(double tmp_startX,double tmp_startY,double tmp_endX,double tmp_endY,int tmp_tdwidth)
{//四线一心,通道长方形//来自MeGauging抓线工具
//籵耋撻倛
mg_line RcCentreLine;//-------
mg_line startLine;//酘|
mg_line otherLine1;//奻----------
mg_line lastline;//衵|
PointF m_RcCenter;
PointF start = new PointF((float)tmp_startX, (float)tmp_startY);
PointF end = new PointF((float)tmp_endX, (float)tmp_startY);//lmapey1
RcCentreLine = new mg_line(start, end);
m_RcCenter = new PointF((start.X + end.X) / (float)2, (start.Y + end.Y) / (float)2);
// int tdwidth = Convert.ToInt32(tongdaowidth.Text);
PointF start1 = new PointF((float)tmp_startX, (float)tmp_startY - tmp_tdwidth);//50 IS 籵耋ㄛ撈20u
PointF end1 = new PointF((float)tmp_startX, (float)tmp_startY);
startLine = new mg_line(start1, end1);
PointF start2 = new PointF((float)tmp_startX, (float)tmp_startY - tmp_tdwidth);//剒猁党蜊2ㄛ50
PointF end2 = new PointF((float)tmp_endX, (float)tmp_startY - tmp_tdwidth);
otherLine1 = new mg_line(start2, end2);
PointF start3 = new PointF((float)tmp_endX, (float)tmp_startY - tmp_tdwidth);
PointF end3 = new PointF((float)tmp_endX, (float)tmp_startY);
lastline = new mg_line(start3, end3);
//otherline
double k, k1;
double fenziY, fenmuX;
fenziY = (RcCentreLine.pt_end.Y - RcCentreLine.pt_start.Y);
fenmuX = RcCentreLine.pt_end.X - RcCentreLine.pt_start.X;
if (fenmuX == 0)
{
k = 65535;
}
else
{
k = fenziY / (fenmuX);
}
RcCentreLine.updatePend(new PointF((float)tmp_endX, (float)tmp_endY));
linelineline(start, new PointF((float)tmp_endX, (float)tmp_endY));///////////////////////////////刻画矩形第一条线
fenziY = (RcCentreLine.pt_end.Y - RcCentreLine.pt_start.Y);
fenmuX = RcCentreLine.pt_end.X - RcCentreLine.pt_start.X;
if (fenmuX == 0)
{
k1 = 65535;
}
else
{
k1 = fenziY / (fenmuX);
}
double DeltaTheta1 = 0;
DeltaTheta1 = Math.Atan(k1) - Math.Atan(k);
startLine.Rotate(RcCentreLine.pt_start, DeltaTheta1);
linelineline(startLine.pt_start, startLine.pt_end);////////////////////////////////////刻画矩形第二条线
//otherline1
double l2 = fenziY * fenziY + fenmuX * fenmuX;
double fenmu2 = l2 / (1 + k1 * k1);
double tempB = Math.Sqrt(fenmu2);
PointF e1 = new PointF();
PointF s = startLine.pt_start;
if (fenmuX > 0)//e.x-s.x>0
{
e1.X = (float)(s.X + tempB);
e1.Y = (float)(s.Y + (e1.X - s.X) * k1);
}
else
{
e1.X = (float)(s.X - tempB);
e1.Y = (float)(s.Y + (e1.X - s.X) * k1);
}
otherLine1.updatePend(e1);
otherLine1.updatePstart(s);
if (k1 == 65535)
{
PointF weizhi = new PointF();
weizhi.X = startLine.pt_start.X;
if (fenziY > 0)//e.y-s.y>0
weizhi.Y = (float)(startLine.pt_start.Y + fenziY);
else
weizhi.Y = (float)(startLine.pt_start.Y - fenziY);
otherLine1.updatePend(weizhi);
}
linelineline(otherLine1.pt_start, otherLine1.pt_end);///////////////////////刻画矩形第三条线
//lastline
lastline.updatePend(otherLine1.pt_end);
lastline.updatePstart(RcCentreLine.pt_end);
linelineline(lastline.pt_start, lastline.pt_end);///////////////////////刻画矩形第四条线
//m_RcCenter
PointF start11 = (RcCentreLine.pt_start);
PointF end11 = (RcCentreLine.pt_end);
PointF start22 = (otherLine1.pt_start);
PointF end22 = (otherLine1.pt_end);
m_RcCenter = new PointF((start11.X + end11.X + start22.X + end22.X) / (float)4,
(start11.Y + end11.Y + start22.Y + end22.Y) / (float)4);
crosscrosscross(m_RcCenter); //刻画中心十字
return m_RcCenter;
}
public void linelineline(PointF start, PointF end)//只针对ccd3使用
{//在界面显示,调用visionpro
CogLineSegment mline1 = new CogLineSegment(); //horizon
mline1.Color = CogColorConstants.Red;
mline1.StartX = start.X;
mline1.StartY = start.Y;
mline1.EndX = end.X;
mline1.EndY = end.Y;
cogDisplay3.InteractiveGraphics.Add((ICogGraphicInteractive)mline1, "test", false);
}
public void crosscrosscross(PointF centre)
{//在界面显示,调用visionpro
CogLineSegment mline1 = new CogLineSegment(); //horizon
mline1.Color = CogColorConstants.Red;
mline1.StartX = centre.X-20;
mline1.StartY = centre.Y;
mline1.EndX = centre.X + 20;
mline1.EndY = centre.Y;
cogDisplay3.InteractiveGraphics.Add((ICogGraphicInteractive)mline1, "test", false);
CogLineSegment mline2 = new CogLineSegment();//vertical
mline2.Color = CogColorConstants.Red;
mline2.StartX = centre.X;
mline2.StartY = centre.Y-20;
mline2.EndX = centre.X;
mline2.EndY = centre.Y+ 20;
cogDisplay3.InteractiveGraphics.Add((ICogGraphicInteractive)mline2, "test", false);
}
只要敢迈出第一步,不管多么小,都是巨大的。