修改界面

This commit is contained in:
xhm\HP 2025-03-12 17:18:39 +08:00
parent b8c83e459d
commit a9d02a5a9d
14 changed files with 2425 additions and 636 deletions

View File

@ -309,7 +309,14 @@ namespace DH.Devices.Camera
public int ImageCallbackFunc(uint handle, dvpStreamEvent _event, IntPtr pContext, ref dvpFrame refFrame, IntPtr pBuffer) public int ImageCallbackFunc(uint handle, dvpStreamEvent _event, IntPtr pContext, ref dvpFrame refFrame, IntPtr pBuffer)
{ {
Mat cvImage = new Mat(); Mat cvImage = new Mat();
if (this.CameraName.Equals("Cam1"))
{
Console.WriteLine( );
}
if (this.CameraName.Equals("Cam2"))
{
Console.WriteLine();
}
try try
{ {
@ -336,7 +343,8 @@ namespace DH.Devices.Camera
break; break;
default: default:
throw new NotSupportedException($"Unsupported format: {refFrame.format}"); cvImage = Mat.FromPixelData(nHeight, nWidth, MatType.CV_8UC1, pBuffer);
break;
} }
Mat smat = cvImage.Clone(); Mat smat = cvImage.Clone();
OnHImageOutput?.Invoke(DateTime.Now, this, smat); OnHImageOutput?.Invoke(DateTime.Now, this, smat);

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
using DH.Commons.Enums; using DH.Commons.Enums;
using DH.Devices.Motion; using DH.Devices.Motion;
using MCDLL_NET; using MCDLL_NET;
using OpenCvSharp;
using System.Diagnostics; using System.Diagnostics;
using static System.Collections.Specialized.BitVector32; using static System.Collections.Specialized.BitVector32;
@ -286,54 +287,57 @@ namespace DH.Devices.Motion
} }
for (ushort station = 0; station < BoardCount; station++) for (ushort station = 0; station < BoardCount; station++)
{ {
// 关闭调试测试后的位置比较
//关闭调试测试后的位置比较 //关闭调试测试后的位置比较
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
rtn = CMCDLL_NET.MCF_Set_Compare_Config_Net((ushort)i, 0, 0, station); rtn = CMCDLL_NET.MCF_Set_Compare_Config_Net((ushort)i, 0, 0, station);
Console.WriteLine($"MCF_Set_Compare_Config_Net {i}::{rtn}");
} }
//2.配置物件设置 //2.配置物件设置
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Piece_Size_Net(PieceMaxSize, PieceMinSize, station); rtn = CMCDLL_NET.MCF_Sorting_Set_Piece_Size_Net(PieceMaxSize, PieceMinSize, station);
Console.WriteLine($"MCF_Sorting_Set_Piece_Size_Net::{rtn}");
rtn = CMCDLL_NET.MCF_Sorting_Set_Piece_Place_Net(MinDistance, MinTimeInterval, station);
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Piece_Place_Net(MinDistance, MinTimeInterval, station); Console.WriteLine($"MCF_Sorting_Set_Piece_Place_Net::{rtn}");
} }
if (BoardCount < 2) //if (BoardCount < 2)
{ //{
// // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(10, 6, 0);
// // 3.配置相机设置
// rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(10, 6, 0); // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(10, 6, 0);
// 3.配置相机设置 // //设置来料使能 0 是默认 1是开始
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(10, 6, 0); // //
//设置来料使能 0 是默认 1是开始 // rtn = CMCDLL_NET.MCF_Sorting_Set_Input_Enable_Net((ushort)SortingInputSetting.BitInputNumber, 1);
// // //设置物件检测有效电平 0是低电平 1是高电平
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Enable_Net((ushort)SortingInputSetting.BitInputNumber, 1); // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Logic_Net((ushort)SortingInputSetting.BitInputNumber, 0);
//设置物件检测有效电平 0是低电平 1是高电平 // //设置来料检测编码器 双转盘要设置两个轴
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Logic_Net((ushort)SortingInputSetting.BitInputNumber, 0); // /*Bit_Input_Number设置位号。
//设置来料检测编码器 双转盘要设置两个轴 // 取值: Bit_Input_0, Bit_Input_1。
/*Bit_Input_Number // Axis: 轴号。
Bit_Input_0, Bit_Input_1 // Source跟随方式
Axis: // 取值0命令
Source // 1编码器(默认)
0 // StationNumber: 站点号;*/
1() // // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net((ushort)IIConfig.SortingInputSetting.BitInputNumber, 0, 1);
StationNumber: */ // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net((ushort)SortingInputSetting.BitInputNumber, 1, 1);
// rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net((ushort)IIConfig.SortingInputSetting.BitInputNumber, 0, 1);
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net((ushort)SortingInputSetting.BitInputNumber, 1, 1);
//rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net( // //rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(
// (ushort)IIConfig.SnapshotSettings.Count, // // (ushort)IIConfig.SnapshotSettings.Count,
// (ushort)IIConfig.BlowSettings.Count, // // (ushort)IIConfig.BlowSettings.Count,
// 0); // // 0);
// rtn = CMCDLL_NET_Sorting.MCF_Set_Config_Camera_Net(); // // rtn = CMCDLL_NET_Sorting.MCF_Set_Config_Camera_Net();
//为防止转盘第二个盘不触发拍照 设置一键取反功能 // //为防止转盘第二个盘不触发拍照 设置一键取反功能
} //}
// 3.配置相机设置 // 3.配置相机设置
ConfigCamera(); ConfigCamera();
// 4.配置气阀 // 4.配置气阀
ConfigBlow(); // ConfigBlow();
@ -345,54 +349,33 @@ namespace DH.Devices.Motion
for (ushort card = 0; card < cardCount; card++) for (ushort card = 0; card < cardCount; card++)
{ {
//IIConfig.SortingInputSettings.ForEach(sortingInputSetting => //5.开启筛选
rtn = CMCDLL_NET.MCF_Sorting_Start_Net(0, card);
if (rtn != (short)0)
{
// LogAsync(DateTime.Now, LogLevel.Warning, $"卡{station}开启筛选异常ret{rtn}");
}
//if (cardCount < 2)
//{ //{
// var camStart = 0; // // 最小值 1 2 2
// if (sortingInputSetting.EnableBindCamera) // var ret = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Bind_Net(
// { // (ushort)SortingInputSetting.BitInputNumber, // 1
// camStart = sortingInputSetting.CameraStartNumber; // SortingInputSetting.CameraStartNumber, // 7,
// } // SortingInputSetting.BlowStartNumber, // 2,
// var blowStart = 0;
// if (sortingInputSetting.EnableBindBlow)
// {
// blowStart = sortingInputSetting.BlowStartNumber;
// }
// var b = (ushort)sortingInputSetting.BitInputNumber;
// //var ret = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Bind_Net(b,
// // (ushort)camStart,
// // (ushort)blowStart,
// // card);
// var ret = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Bind_Net(1,
// 1,
// 2,
// card); // card);
//}); //}
// CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net();
if (cardCount < 2)
{
// 最小值 1 2 2
var ret = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Bind_Net(
(ushort)SortingInputSetting.BitInputNumber, // 1
SortingInputSetting.CameraStartNumber, // 7,
SortingInputSetting.BlowStartNumber, // 2,
card);
} //for (ushort station = 0; station < cardCount; station++)
//{
for (ushort station = 0; station < cardCount; station++) // // 5.开启筛选
{ // //开启自动筛选功能
// 5.开启筛选 // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Start_Net(0, station);
//开启自动筛选功能 // if (rtn != (short)FuncRet.Function_Success)
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Start_Net(0, station); // {
if (rtn != (short)FuncRet.Function_Success) // //LogAsync(DateTime.Now, LogLevel.Warning, $"卡{card}开启筛选异常ret{rtn}");
{ // }
//LogAsync(DateTime.Now, LogLevel.Warning, $"卡{card}开启筛选异常ret{rtn}"); //}
}
}
} }
} }
@ -419,6 +402,7 @@ namespace DH.Devices.Motion
public override void Stop() public override void Stop()
{ {
isconnected = false;
//base.Stop(); //base.Stop();
AxisStop(); AxisStop();
int ret = CMCDLL_NET.MCF_Set_Servo_Enable_Net(0, (ushort)ServoLogic.Servo_Open, 0); int ret = CMCDLL_NET.MCF_Set_Servo_Enable_Net(0, (ushort)ServoLogic.Servo_Open, 0);
@ -636,7 +620,7 @@ namespace DH.Devices.Motion
// 初始化 // 初始化
for (ushort station = 0; station < BoardCount; station++) for (ushort station = 0; station < BoardCount; station++)
{ {
ret = CMCDLL_NET_Sorting.MCF_Sorting_Init_Net(station); ret = CMCDLL_NET.MCF_Sorting_Init_Net(station);
stations.Add(station); stations.Add(station);
cardTypes.Add(2); cardTypes.Add(2);
} }
@ -658,8 +642,8 @@ namespace DH.Devices.Motion
{ {
} }
MCF_Screen_Set_Trigger1(); //MCF_Screen_Set_Trigger1();
MCF_Screen_Set_Trigger1(1); // MCF_Screen_Set_Trigger1(1);
} }
@ -1859,7 +1843,7 @@ namespace DH.Devices.Motion
continue; continue;
} }
var rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Trig_Camera_Delay_Count_Net(i, var rtn = CMCDLL_NET.MCF_Sorting_Set_Trig_Camera_Delay_Count_Net(i,
camSetting.CameraDelayCountMS, camSetting.StationNumber); camSetting.CameraDelayCountMS, camSetting.StationNumber);
@ -1894,7 +1878,7 @@ namespace DH.Devices.Motion
} }
else else
{ {
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Camera_Net( rtn = CMCDLL_NET.MCF_Sorting_Set_Camera_Net(
i, // CCD0 i, // CCD0
CameraPositionReal, CameraPositionReal,
RotationDirectionReal, RotationDirectionReal,
@ -2004,23 +1988,31 @@ namespace DH.Devices.Motion
switch (blowSetting.BlowType) switch (blowSetting.BlowType)
{ {
case BlowType.OK: case BlowType.OK:
CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_OK_Net(CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber); CMCDLL_NET.MCF_Sorting_Set_Blow_OK_Net(CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber);
break; break;
case BlowType.NG: case BlowType.NG:
CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_NG_Net(CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber); CMCDLL_NET.MCF_Sorting_Set_Blow_NG_Net(CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber);
break; break;
case BlowType.Blow1: case BlowType.Blow1:
CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_Net(1, CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber); CMCDLL_NET.MCF_Sorting_Set_Blow_1_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber);
break; break;
///第一路绑定OK NG 吹起口1 ///第一路绑定OK NG 吹起口1
case BlowType.Blow2: case BlowType.Blow2:
CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_Net(2, CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber); CMCDLL_NET.MCF_Sorting_Set_Blow_2_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber);
break; break;
case BlowType.Blow3: case BlowType.Blow3:
CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_Net(3, CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber); CMCDLL_NET.MCF_Sorting_Set_Blow_3_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber);
break; break;
case BlowType.Blow4: case BlowType.Blow4:
CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_Net(4, CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber); CMCDLL_NET.MCF_Sorting_Set_Blow_4_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber);
break;
case BlowType.Blow5:
CMCDLL_NET.MCF_Sorting_Set_Blow_5_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber);
break;
case BlowType.Blow6:
CMCDLL_NET.MCF_Sorting_Set_Blow_6_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber);
break;
default:
break; break;
//case BlowType.OK: //case BlowType.OK:
// CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_OK_Net(setting.BlowPosition, (ushort)IIConfig.MotionDir, (ushort)setting.ActionMode, (ushort)setting.BlowIO.IOIndex, setting.StationNumber); // CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_OK_Net(setting.BlowPosition, (ushort)IIConfig.MotionDir, (ushort)setting.ActionMode, (ushort)setting.BlowIO.IOIndex, setting.StationNumber);
@ -2047,8 +2039,7 @@ namespace DH.Devices.Motion
//case BlowType.Blow6: //case BlowType.Blow6:
// CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_6_Net(setting.BlowPosition, (ushort)IIConfig.MotionDir, (ushort)setting.ActionMode, (ushort)setting.BlowIO.IOIndex, setting.StationNumber); // CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_6_Net(setting.BlowPosition, (ushort)IIConfig.MotionDir, (ushort)setting.ActionMode, (ushort)setting.BlowIO.IOIndex, setting.StationNumber);
// break; // break;
default:
break;
} }
} }

View File

@ -12,6 +12,18 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Include="Views\CamConfigFrm.cs" />
<Compile Include="Views\CamConfigFrm.Designer.cs" />
<Compile Include="Views\UserConfigFrm.cs" />
<Compile Include="Views\UserConfigFrm.Designer.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Views\CamConfigFrm.resx" />
<EmbeddedResource Include="Views\UserConfigFrm.resx" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AntdUI" Version="1.8.9" /> <PackageReference Include="AntdUI" Version="1.8.9" />
<PackageReference Include="System.IO.Ports" Version="9.0.2" /> <PackageReference Include="System.IO.Ports" Version="9.0.2" />

View File

@ -41,6 +41,7 @@
button_color = new AntdUI.Button(); button_color = new AntdUI.Button();
buttonSZ = new AntdUI.Button(); buttonSZ = new AntdUI.Button();
pageHeader1 = new AntdUI.PageHeader(); pageHeader1 = new AntdUI.PageHeader();
label1 = new Label();
divider2 = new AntdUI.Divider(); divider2 = new AntdUI.Divider();
panelmain = new AntdUI.Panel(); panelmain = new AntdUI.Panel();
panel2 = new AntdUI.Panel(); panel2 = new AntdUI.Panel();
@ -56,11 +57,9 @@
panel3 = new AntdUI.Panel(); panel3 = new AntdUI.Panel();
tabs2 = new AntdUI.Tabs(); tabs2 = new AntdUI.Tabs();
tabPage2 = new AntdUI.TabPage(); tabPage2 = new AntdUI.TabPage();
pictureBox1 = new PictureBox();
divider1 = new AntdUI.Divider(); divider1 = new AntdUI.Divider();
panel1 = new AntdUI.Panel(); panel1 = new AntdUI.Panel();
segmented1 = new AntdUI.Segmented(); segmented1 = new AntdUI.Segmented();
label1 = new Label();
titlebar.SuspendLayout(); titlebar.SuspendLayout();
pageHeader1.SuspendLayout(); pageHeader1.SuspendLayout();
panelmain.SuspendLayout(); panelmain.SuspendLayout();
@ -73,8 +72,6 @@
tabPage3.SuspendLayout(); tabPage3.SuspendLayout();
panel3.SuspendLayout(); panel3.SuspendLayout();
tabs2.SuspendLayout(); tabs2.SuspendLayout();
tabPage2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
panel1.SuspendLayout(); panel1.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
@ -139,6 +136,15 @@
pageHeader1.TabIndex = 7; pageHeader1.TabIndex = 7;
pageHeader1.Text = "UPH"; pageHeader1.Text = "UPH";
// //
// label1
//
label1.AutoSize = true;
label1.Location = new Point(61, 10);
label1.Name = "label1";
label1.Size = new Size(64, 21);
label1.TabIndex = 1;
label1.Text = "100000";
//
// divider2 // divider2
// //
divider2.Dock = DockStyle.Top; divider2.Dock = DockStyle.Top;
@ -285,22 +291,11 @@
// //
// tabPage2 // tabPage2
// //
tabPage2.Controls.Add(pictureBox1);
tabPage2.Location = new Point(3, 28); tabPage2.Location = new Point(3, 28);
tabPage2.Name = "tabPage2"; tabPage2.Name = "tabPage2";
tabPage2.Size = new Size(347, 469); tabPage2.Size = new Size(347, 469);
tabPage2.TabIndex = 0; tabPage2.TabIndex = 0;
tabPage2.Text = "统计"; tabPage2.Text = "配置";
//
// pictureBox1
//
pictureBox1.Dock = DockStyle.Fill;
pictureBox1.Location = new Point(0, 0);
pictureBox1.Name = "pictureBox1";
pictureBox1.Size = new Size(347, 469);
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
pictureBox1.TabIndex = 0;
pictureBox1.TabStop = false;
// //
// divider1 // divider1
// //
@ -401,15 +396,6 @@
segmented1.Text = "segmented1"; segmented1.Text = "segmented1";
segmented1.SelectIndexChanged += segmented1_SelectIndexChanged; segmented1.SelectIndexChanged += segmented1_SelectIndexChanged;
// //
// label1
//
label1.AutoSize = true;
label1.Location = new Point(61, 10);
label1.Name = "label1";
label1.Size = new Size(64, 21);
label1.TabIndex = 1;
label1.Text = "100000";
//
// MainWindow // MainWindow
// //
ClientSize = new Size(1024, 648); ClientSize = new Size(1024, 648);
@ -438,8 +424,6 @@
tabPage3.ResumeLayout(false); tabPage3.ResumeLayout(false);
panel3.ResumeLayout(false); panel3.ResumeLayout(false);
tabs2.ResumeLayout(false); tabs2.ResumeLayout(false);
tabPage2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
panel1.ResumeLayout(false); panel1.ResumeLayout(false);
ResumeLayout(false); ResumeLayout(false);
} }
@ -468,7 +452,6 @@
private AntdUI.TabPage tabPage2; private AntdUI.TabPage tabPage2;
private AntdUI.Divider divider1; private AntdUI.Divider divider1;
private RichTextBox richTextBox1; private RichTextBox richTextBox1;
private PictureBox pictureBox1;
private Label label1; private Label label1;
} }
} }

View File

@ -420,22 +420,30 @@ namespace DHSoftware
} }
#else #else
Do3ThinkCamera do3ThinkCamera1 = new Do3ThinkCamera(); //Do3ThinkCamera do3ThinkCamera1 = new Do3ThinkCamera();
do3ThinkCamera1.dvpStreamFormat = dvpStreamFormat.S_RAW8; //do3ThinkCamera1.dvpStreamFormat = dvpStreamFormat.S_RAW8;
do3ThinkCamera1.CameraName = "Cam1"; //do3ThinkCamera1.CameraName = "Cam1";
do3ThinkCamera1.CameraConnect(); //do3ThinkCamera1.CameraConnect();
do3ThinkCamera1.OnHImageOutput += OnCameraHImageOutput; //do3ThinkCamera1.OnHImageOutput += OnCameraHImageOutput;
Cameras.Add(do3ThinkCamera1); // Cameras.Add(do3ThinkCamera1);
for (int i=2;i<=8;i++) for (int i = 1; i <= 8; i++)
{ {
Do3ThinkCamera do3ThinkCamera2 = new Do3ThinkCamera(); Do3ThinkCamera cam = new Do3ThinkCamera();
do3ThinkCamera2.dvpStreamFormat = dvpStreamFormat.S_RGB24; if (i == 1)
do3ThinkCamera2.CameraName = $"Cam{i}"; {
Cameras.Add(do3ThinkCamera2); cam.dvpStreamFormat = dvpStreamFormat.S_RAW8;
do3ThinkCamera2.CameraConnect(); }
do3ThinkCamera2.OnHImageOutput += OnCameraHImageOutput; else
{
cam.dvpStreamFormat = dvpStreamFormat.S_RGB24;
}
cam.CameraName = $"Cam{i}";
Cameras.Add(cam);
cam.CameraConnect();
cam.OnHImageOutput += OnCameraHImageOutput;
} }
@ -496,9 +504,17 @@ namespace DHSoftware
sLDMotion.SnapshotSettings = new List<SnapshotSetting>(); sLDMotion.SnapshotSettings = new List<SnapshotSetting>();
int[] cameraPositions = { 7613, 24161, 33608, 39702, 45701 }; int[] cameraPositions = { 24161, 33608, 39702, 45701 };
for (int i = 0; i < 5; i++)
sLDMotion.SnapshotSettings.Add(new SnapshotSetting
{
IsEnabled = true,
CameraIO = sLDMotion.IODefinitionCollection.FirstOrDefault(t => t.IOType == IOType.OUTPUT && t.IOIndex == 13),
CameraPosition = 7613,
StationNumber = 0
});
for (int i = 0; i < 4; i++)
{ {
sLDMotion.SnapshotSettings.Add(new SnapshotSetting sLDMotion.SnapshotSettings.Add(new SnapshotSetting
{ {
@ -513,17 +529,20 @@ namespace DHSoftware
sLDMotion.BlowSettings = new List<BlowSetting>(); sLDMotion.BlowSettings = new List<BlowSetting>();
int[] BlowPositions = { 61353, 68566 }; int[] BlowPositions = { 61353, 68566 };
for (int i = 0; i < 2; i++)
{
sLDMotion.BlowSettings.Add(new BlowSetting sLDMotion.BlowSettings.Add(new BlowSetting
{ {
IsEnabled = true, IsEnabled = true,
BlowIO = sLDMotion.IODefinitionCollection.FirstOrDefault(t => t.IOType == IOType.OUTPUT && t.IOIndex == i), BlowIO = sLDMotion.IODefinitionCollection.FirstOrDefault(t => t.IOType == IOType.OUTPUT && t.IOIndex == 5),
BlowPosition = BlowPositions[i], BlowPosition = BlowPositions[0],
StationNumber = 0
});
sLDMotion.BlowSettings.Add(new BlowSetting
{
IsEnabled = true,
BlowIO = sLDMotion.IODefinitionCollection.FirstOrDefault(t => t.IOType == IOType.OUTPUT && t.IOIndex == 6),
BlowPosition = BlowPositions[1],
StationNumber = 0 StationNumber = 0
}); });
}
//SnapshotSetting sna1 = new SnapshotSetting(); //SnapshotSetting sna1 = new SnapshotSetting();
//sna1.IsEnabled = true; //sna1.IsEnabled = true;
@ -536,6 +555,8 @@ namespace DHSoftware
// sLDMotion.SnapshotSettings.Add(sna1); // sLDMotion.SnapshotSettings.Add(sna1);
sLDMotion.AxisSettings.Add(axis1); sLDMotion.AxisSettings.Add(axis1);
sLDMotion.Init(); sLDMotion.Init();
sLDMotion.OnNewPieces -= MainMotion_NewPieces;
sLDMotion.OnNewPieces += MainMotion_NewPieces;
// sLDMotion.Start(); // sLDMotion.Start();
//PLC.IP = "192.168.6.6"; //PLC.IP = "192.168.6.6";
@ -543,7 +564,7 @@ namespace DHSoftware
//PLC.PLCConnect(); //PLC.PLCConnect();
//PLC.OnNewPieces -= MainMotion_NewPieces; //PLC.OnNewPieces -= MainMotion_NewPieces;
//PLC.OnNewPieces += MainMotion_NewPieces; //PLC.OnNewPieces += MainMotion_NewPieces;
ProductBaseCount = 2; ProductBaseCount = 8;
for (int i = 0; i < ProductBaseCount * ProductListMulti; i++) for (int i = 0; i < ProductBaseCount * ProductListMulti; i++)
{ {
ConcurrentDictionary<uint, ProductData> products = new ConcurrentDictionary<uint, ProductData>(); ConcurrentDictionary<uint, ProductData> products = new ConcurrentDictionary<uint, ProductData>();
@ -551,7 +572,8 @@ namespace DHSoftware
} }
sLDMotion.AxisStop(); sLDMotion.AxisStop();
bool e = sLDMotion.CArdReset(); bool e = sLDMotion.CArdReset();
sLDMotion.JOGRun(10000, 100000); //转盘速度
sLDMotion.JOGRun(14000, 100000);
startTime = DateTime.Now; startTime = DateTime.Now;
} }
public void Motion(List<IODefinition> iODefinitions) public void Motion(List<IODefinition> iODefinitions)
@ -608,7 +630,8 @@ namespace DHSoftware
_productLists[index][pieceNumber] = pData; _productLists[index][pieceNumber] = pData;
} }
string logStr = $"时间:{DateTime.Now} 轴{axisIndex}新产品{pieceNumber}加入队列{index}----入料计数{PieceCount}\n"; string logStr = $"时间:{DateTime.Now} 轴{axisIndex}新产品{pieceNumber}加入队列{index}----入料计数{PieceCount}\n";
Task.Run(() => { Task.Run(() =>
{
this.BeginInvoke(new MethodInvoker(delegate () { richTextBox1.AppendText(logStr); })); this.BeginInvoke(new MethodInvoker(delegate () { richTextBox1.AppendText(logStr); }));
}); });
@ -923,6 +946,16 @@ namespace DHSoftware
/// <param name="imageSet"></param> /// <param name="imageSet"></param>
private void OnCameraHImageOutput(DateTime dt, CameraBase camera, Mat imageSet) private void OnCameraHImageOutput(DateTime dt, CameraBase camera, Mat imageSet)
{ {
//if (camera.CameraName.Equals("cam1", StringComparison.OrdinalIgnoreCase))
//{
// Console.WriteLine();
//}
//if (camera.CameraName.Equals("cam2", StringComparison.OrdinalIgnoreCase))
//{
// Console.WriteLine();
//}
// 获取该相机的拍照计数 // 获取该相机的拍照计数
uint productNumber = (uint)camera.SnapshotCount; uint productNumber = (uint)camera.SnapshotCount;
@ -950,7 +983,8 @@ namespace DHSoftware
} }
else else
{ {
Thread.Sleep(20); // Thread.Sleep(20);
await Task.Delay(20);
} }
retryTimes--; retryTimes--;
} }
@ -967,6 +1001,23 @@ namespace DHSoftware
//LogAsync(DateTime.Now, LogLevel.Error, $"{camera.Name} 未找到产品,编号:{productNumber},队列{index}数量:{tmpDic.Count},列表:{pnStr}"); //LogAsync(DateTime.Now, LogLevel.Error, $"{camera.Name} 未找到产品,编号:{productNumber},队列{index}数量:{tmpDic.Count},列表:{pnStr}");
localImageSet.Dispose(); localImageSet.Dispose();
this.BeginInvoke(new MethodInvoker(delegate ()
{
int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y;
richTextBox1.AppendText(productNumber + "提前推出" + camera.CameraName);
// 设置回原来的滚动位置
richTextBox1.SelectionStart = richTextBox1.TextLength;
richTextBox1.ScrollToCaret();
}));
//重新生成实例 销毁之前的实例
using (StreamWriter sw = new StreamWriter("D://123log.txt", true, Encoding.UTF8))
{
sw.WriteLine(productNumber + "提前推出" + camera.CameraName);
}
return; return;
} }
@ -976,6 +1027,23 @@ namespace DHSoftware
{ {
localImageSet.Dispose(); localImageSet.Dispose();
this.BeginInvoke(new MethodInvoker(delegate ()
{
int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y;
richTextBox1.AppendText(productNumber+"提前推出" + camera.CameraName);
// 设置回原来的滚动位置
richTextBox1.SelectionStart = richTextBox1.TextLength;
richTextBox1.ScrollToCaret();
}));
//重新生成实例 销毁之前的实例
using (StreamWriter sw = new StreamWriter("D://123log.txt", true, Encoding.UTF8))
{
sw.WriteLine(productNumber+"提前推出" + camera.CameraName);
}
// LogAsync(DateTime.Now, LogLevel.Warning, $"{camera.Name} 找到产品{productNumber}但是没有推理1"); // LogAsync(DateTime.Now, LogLevel.Warning, $"{camera.Name} 找到产品{productNumber}但是没有推理1");
return; return;
@ -1062,14 +1130,14 @@ namespace DHSoftware
req.ResizeHeight = (int)detectConfig.ModelHeight; req.ResizeHeight = (int)detectConfig.ModelHeight;
// req.LabelNames = detectConfig.GetLabelNames(); // req.LabelNames = detectConfig.GetLabelNames();
// req.Score = IIConfig.Score; // req.Score = IIConfig.Score;
req.mImage = inferenceImage.Clone();
req.in_lable_path = detectConfig.in_lable_path; req.in_lable_path = detectConfig.in_lable_path;
req.confThreshold = detectConfig.ModelconfThreshold; req.confThreshold = detectConfig.ModelconfThreshold;
req.iouThreshold = 0.3f; req.iouThreshold = 0.3f;
req.segmentWidth = 320; req.segmentWidth = 320;
req.out_node_name = "output0";
switch (detectConfig.ModelType) switch (detectConfig.ModelType)
{ {
case MLModelType.ImageClassification: case MLModelType.ImageClassification:
@ -1122,9 +1190,9 @@ namespace DHSoftware
{ {
pictureBox1.Image?.Dispose(); // 释放旧图像 pictureBox1.Image?.Dispose(); // 释放旧图像
pictureBox1.Image = result.ResultMap; pictureBox1.Image = result.ResultMap;
richTextBox1.AppendText($"推理成功 {productNumber}, {result.IsSuccess} 耗时 {mlWatch.ElapsedMilliseconds}ms\n"); richTextBox1.AppendText($"推理成功 {productNumber}, {result.IsSuccess}相机名字{camera.CameraName} 耗时 {mlWatch.ElapsedMilliseconds}ms\n");
})); }));
req.mImage.Dispose(); req.mImage?.Dispose();
@ -1247,13 +1315,7 @@ namespace DHSoftware
} }
product.InferenceOne(() => product.InferenceOne();
{
;
}, () =>
{
;
});
// LogAsync(DateTime.Now, LogLevel.Information, $"{camera.Name} 推理完成,产品{productNumber}"); // LogAsync(DateTime.Now, LogLevel.Information, $"{camera.Name} 推理完成,产品{productNumber}");
@ -1397,7 +1459,7 @@ namespace DHSoftware
Cameras.Clear(); Cameras.Clear();
Dectection.Clear(); Dectection.Clear();
// Add the code for the "停止" button click here // Add the code for the "停止" button click here
PLC.TurntableStop(); // PLC.TurntableStop();
CurrentMachine = true; CurrentMachine = true;
sLDMotion.Stop(); sLDMotion.Stop();
} }
@ -1408,7 +1470,8 @@ namespace DHSoftware
UPH = (int)(ProductNum_Total / timeSpan.TotalHours) + 100; UPH = (int)(ProductNum_Total / timeSpan.TotalHours) + 100;
//UPM = (int)UPH / 60; //UPM = (int)UPH / 60;
this.BeginInvoke(new MethodInvoker(delegate () { this.BeginInvoke(new MethodInvoker(delegate ()
{
label1.Text = UPH.ToString(); label1.Text = UPH.ToString();
})); }));

View File

@ -0,0 +1,44 @@
namespace DHSoftware.Views
{
partial class CamConfigFrm
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
SuspendLayout();
//
// CamConfigFrm
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
Name = "CamConfigFrm";
Size = new Size(869, 521);
ResumeLayout(false);
}
#endregion
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DHSoftware.Views
{
public partial class CamConfigFrm : UserControl
{
public CamConfigFrm()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,44 @@
namespace DHSoftware.Views
{
partial class UserConfigFrm
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
SuspendLayout();
//
// UserConfigFrm
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
Name = "UserConfigFrm";
Size = new Size(749, 536);
ResumeLayout(false);
}
#endregion
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DHSoftware.Views
{
public partial class UserConfigFrm : UserControl
{
public UserConfigFrm()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -78,16 +78,16 @@ namespace DHSoftware
} }
public void InferenceOne(Action preAction = null, Action postAction = null) public void InferenceOne()
{ {
//lock (_inferenceLock) //lock (_inferenceLock)
//{ //{
// Interlocked.Decrement(ref InferenceLeft); // Interlocked.Decrement(ref InferenceLeft);
//} //}
preAction?.Invoke();
_countdownEvent.Signal(); _countdownEvent.Signal();
postAction?.Invoke();
} }
public bool InferenceFinished() public bool InferenceFinished()