Commit 91ee981a LN

aoi打开时投影显示全黑

1 个父辈 05e479bd
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
<Compile Include="deviceLibrary\IO\IOBase.cs" /> <Compile Include="deviceLibrary\IO\IOBase.cs" />
<Compile Include="deviceLibrary\IO\NanjingSDotIO.cs" /> <Compile Include="deviceLibrary\IO\NanjingSDotIO.cs" />
<Compile Include="deviceLibrary\IO\NiRenIO.cs" /> <Compile Include="deviceLibrary\IO\NiRenIO.cs" />
<Compile Include="manager\AlarmProcess.cs" /> <Compile Include="manager\ProjectorProcess.cs" />
<Compile Include="manager\LedManager.cs" /> <Compile Include="manager\LedManager.cs" />
<Compile Include="manager\LineWidthManager.cs" /> <Compile Include="manager\LineWidthManager.cs" />
<Compile Include="manager\ResourceControl.cs" /> <Compile Include="manager\ResourceControl.cs" />
......
...@@ -12,8 +12,11 @@ using static TSA_V.Common.LogUtil; ...@@ -12,8 +12,11 @@ using static TSA_V.Common.LogUtil;
namespace TSA_V namespace TSA_V
{ {
public class AlarmProcess public class ProjectorProcess
{ {
public static bool AOIopen = false;
private static System.Timers.Timer proTimer = null; private static System.Timers.Timer proTimer = null;
private static bool InPlay = false; private static bool InPlay = false;
...@@ -54,7 +57,7 @@ namespace TSA_V ...@@ -54,7 +57,7 @@ namespace TSA_V
private static void ProTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private static void ProTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
if (AlarmProcess.IsAlarm(out string msg)) if (ProjectorProcess.IsAlarm(out string msg))
{ {
if (InPlay) if (InPlay)
{ {
......
...@@ -134,7 +134,7 @@ namespace TSA_V.DeviceLibrary ...@@ -134,7 +134,7 @@ namespace TSA_V.DeviceLibrary
//return ResourceControl.GetString(ResourceControl.InitXFail, "振镜初始化失败"); //return ResourceControl.GetString(ResourceControl.InitXFail, "振镜初始化失败");
} }
}); });
AlarmProcess.Init(); ProjectorProcess.Init();
serverCommunication = new ServerCommunication(); serverCommunication = new ServerCommunication();
serverCommunication.StartConnectServer(); serverCommunication.StartConnectServer();
return ""; return "";
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.panAoi = new System.Windows.Forms.Panel();
this.lblAlarm = new System.Windows.Forms.Label(); this.lblAlarm = new System.Windows.Forms.Label();
this.colorDialog1 = new System.Windows.Forms.ColorDialog(); this.colorDialog1 = new System.Windows.Forms.ColorDialog();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
...@@ -40,6 +41,7 @@ ...@@ -40,6 +41,7 @@
// //
this.panel1.BackColor = System.Drawing.Color.Black; this.panel1.BackColor = System.Drawing.Color.Black;
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.panel1.Controls.Add(this.panAoi);
this.panel1.Controls.Add(this.lblAlarm); this.panel1.Controls.Add(this.lblAlarm);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Location = new System.Drawing.Point(0, 0);
...@@ -47,6 +49,16 @@ ...@@ -47,6 +49,16 @@
this.panel1.Size = new System.Drawing.Size(800, 633); this.panel1.Size = new System.Drawing.Size(800, 633);
this.panel1.TabIndex = 0; this.panel1.TabIndex = 0;
// //
// panAoi
//
this.panAoi.BackColor = System.Drawing.Color.White;
this.panAoi.Dock = System.Windows.Forms.DockStyle.Fill;
this.panAoi.Location = new System.Drawing.Point(0, 0);
this.panAoi.Name = "panAoi";
this.panAoi.Size = new System.Drawing.Size(800, 633);
this.panAoi.TabIndex = 1;
this.panAoi.Visible = false;
//
// lblAlarm // lblAlarm
// //
this.lblAlarm.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.lblAlarm.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
...@@ -90,5 +102,6 @@ ...@@ -90,5 +102,6 @@
private System.Windows.Forms.ColorDialog colorDialog1; private System.Windows.Forms.ColorDialog colorDialog1;
private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label lblAlarm; private System.Windows.Forms.Label lblAlarm;
private System.Windows.Forms.Panel panAoi;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -44,7 +44,7 @@ namespace TSA_V ...@@ -44,7 +44,7 @@ namespace TSA_V
lblAlarm.Visible = false; lblAlarm.Visible = false;
} }
} }
public bool CloseShowName=false; public bool CloseShowName = false;
public bool ShowForm() public bool ShowForm()
{ {
Screen[] sc = Screen.AllScreens; Screen[] sc = Screen.AllScreens;
...@@ -93,8 +93,10 @@ namespace TSA_V ...@@ -93,8 +93,10 @@ namespace TSA_V
private void FrmScreenTest_Shown(object sender, EventArgs e) private void FrmScreenTest_Shown(object sender, EventArgs e)
{ {
ShowPoint(new ProjectorPInfo( ScreenWidth / 2, ScreenHeight / 2)); ShowPoint(new ProjectorPInfo(ScreenWidth / 2, ScreenHeight / 2));
DrawArea(); DrawArea();
panAoi.BackColor = Color.Black;
panAoi.Visible = false;
} }
public void DrawArea() public void DrawArea()
{ {
...@@ -106,8 +108,8 @@ namespace TSA_V ...@@ -106,8 +108,8 @@ namespace TSA_V
int startY = 0; int startY = 0;
int Point_X_Length = 3; int Point_X_Length = 3;
int Point_Y_Length = 3; int Point_Y_Length = 3;
int lineWidth = (ScreenWidth ) / (Point_X_Length - 1); int lineWidth = (ScreenWidth) / (Point_X_Length - 1);
int lineHeight = (ScreenHeight ) / (Point_Y_Length - 1); int lineHeight = (ScreenHeight) / (Point_Y_Length - 1);
Graphics grfx = panel1.CreateGraphics(); Graphics grfx = panel1.CreateGraphics();
Color color = Color.White; Color color = Color.White;
grfx.SmoothingMode = SmoothingMode.HighQuality; grfx.SmoothingMode = SmoothingMode.HighQuality;
...@@ -147,8 +149,8 @@ namespace TSA_V ...@@ -147,8 +149,8 @@ namespace TSA_V
int Point_X_Length = 21; int Point_X_Length = 21;
int Point_Y_Length = 21; int Point_Y_Length = 21;
int lineWidth = (ScreenWidth - startX * 2) / (Point_X_Length-1); int lineWidth = (ScreenWidth - startX * 2) / (Point_X_Length - 1);
int lineHeight = (ScreenHeight - startY * 2) / (Point_Y_Length-1); int lineHeight = (ScreenHeight - startY * 2) / (Point_Y_Length - 1);
...@@ -304,17 +306,17 @@ namespace TSA_V ...@@ -304,17 +306,17 @@ namespace TSA_V
} }
} }
} }
public void ShowPoint(DeviceLibrary.ProjectorPInfo p ) public void ShowPoint(DeviceLibrary.ProjectorPInfo p)
{ {
if (!ISShow) if (!ISShow)
{ {
return; return;
} }
Graphics g = panel1.CreateGraphics(); Graphics g = panel1.CreateGraphics();
DrawPoint(g, p.PX,p.PY,p.PType,p.SizeX,p.SizeY,p.PenWidth, p.ShowText); DrawPoint(g, p.PX, p.PY, p.PType, p.SizeX, p.SizeY, p.PenWidth, p.ShowText);
g.Dispose(); g.Dispose();
} }
public void ShowPoint(bool showName , params SMTPointInfo[] points ) public void ShowPoint(bool showName, params SMTPointInfo[] points)
{ {
if (!ISShow) if (!ISShow)
{ {
...@@ -329,7 +331,7 @@ namespace TSA_V ...@@ -329,7 +331,7 @@ namespace TSA_V
int y = (int)point.NodePositionY; int y = (int)point.NodePositionY;
int sizex = point.PointSizeX; int sizex = point.PointSizeX;
int sizey = point.PointSizeY; int sizey = point.PointSizeY;
DrawPoint(g, x, y, type, sizex,sizey,point.PenWidth,""); DrawPoint(g, x, y, type, sizex, sizey, point.PenWidth, "");
if (showName) if (showName)
{ {
...@@ -352,9 +354,16 @@ namespace TSA_V ...@@ -352,9 +354,16 @@ namespace TSA_V
private void timer1_Tick(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e)
{ {
if (AlarmProcess.IsAlarm(out string msg))
if (ProjectorProcess.AOIopen)
{ {
if(panel1.BackgroundImage != null) panAoi.BackColor = Color.Black;
panAoi.Visible = true;
}
else if (ProjectorProcess.IsAlarm(out string msg))
{
panAoi.Visible = false;
if (panel1.BackgroundImage != null)
{ {
panel1.BackgroundImage = null; panel1.BackgroundImage = null;
} }
...@@ -369,11 +378,12 @@ namespace TSA_V ...@@ -369,11 +378,12 @@ namespace TSA_V
} }
else else
{ {
panAoi.Visible = false;
if (panel1.BackgroundImage != null) if (panel1.BackgroundImage != null)
{ {
panel1.BackgroundImage = null; panel1.BackgroundImage = null;
} }
if(lblAlarm.Visible) if (lblAlarm.Visible)
{ {
lblAlarm.Visible = false; lblAlarm.Visible = false;
} }
......
...@@ -336,12 +336,16 @@ namespace TSA_V ...@@ -336,12 +336,16 @@ namespace TSA_V
if (TSAVBean.IsNeedAOI && TSAVBean.Work.IsShowAOI.Equals(false)) if (TSAVBean.IsNeedAOI && TSAVBean.Work.IsShowAOI.Equals(false))
{ {
TSAVBean.Work.IsShowAOI = true; TSAVBean.Work.IsShowAOI = true;
LogUtil.info("焊接完成,清理投影内容,弹出 提示框提示进入AOI检测"); LogUtil.info(" 工作完成, 清理投影内容,弹出 提示框提示进入AOI检测 ,设置 AOIopen = true;");
ProjectorProcess.AOIopen = true;
FrmProjectorScreen.instance.ClearPoint(); FrmProjectorScreen.instance.ClearPoint();
//IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.HIGH); //IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.HIGH);
FrmAOICheck frm = new FrmAOICheck(CurrProject); FrmAOICheck frm = new FrmAOICheck(CurrProject);
frm.ShowDialog(); frm.ShowDialog();
ProjectorProcess.AOIopen = false;
LogUtil.info("AOI检测已关闭 ,设置 AOIopen = false;");
// IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.LOW); // IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.LOW);
} }
...@@ -895,11 +899,14 @@ namespace TSA_V ...@@ -895,11 +899,14 @@ namespace TSA_V
{ {
if (TSAVBean.IsNeedAOI) if (TSAVBean.IsNeedAOI)
{ {
LogUtil.info("点击【" + btnCamera.Text + "】,清理投影内容,进入AOI检测"); LogUtil.info("点击【" + btnCamera.Text + "】,清理投影内容,进入AOI检测 , 设置AOIopen = true");
ProjectorProcess.AOIopen = true;
FrmProjectorScreen.instance.ClearPoint(); FrmProjectorScreen.instance.ClearPoint();
// IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.HIGH); // IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.HIGH);
FrmAOICheck frm = new FrmAOICheck(CurrProject); FrmAOICheck frm = new FrmAOICheck(CurrProject);
frm.ShowDialog(); frm.ShowDialog();
ProjectorProcess.AOIopen = false;
LogUtil.info("点击【" + btnCamera.Text + "】,AOI检测已关闭 , 设置AOIopen = false");
// IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.LOW); // IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.LOW);
} }
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
1.AOI检测过程中,投影全黑。(到aoi步骤或者点击AOI检测按钮) 1.AOI检测过程中,投影全黑。(到aoi步骤或者点击AOI检测按钮)
2.判断库位中没有转盘位置时不需要加载轴。 2.标签库位单独配置到config\LabelPositions.csv , 判断库位中没有转盘位置时不需要初始化轴。
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!