版博士V2.0程序
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

169 líneas
9.1 KiB

  1. using MaiMuAOI.SysCtrl;
  2. using MaiMuAOI.SysUI.StepUI.PropExtend;
  3. using Newtonsoft.Json;
  4. using OpenCvSharp;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Drawing;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace MaiMuAOI.SysUI.ProcessStep.Prop
  13. {
  14. public class PointTestProp
  15. {
  16. [PropertyOrder(1), Browsable(true), Category("1 算法"), DisplayName("1.1 引擎文件名"), Description("图像处理算法引擎文件名")]
  17. public string EngineName { get; set; }
  18. [PropertyOrder(2), Browsable(true), Category("1 算法"), DisplayName("1.2 检测项"), Description("检测项选择")]
  19. public PointTestType TestType { get; set; }
  20. [PropertyOrder(3), Browsable(true), Category("1 算法"), DisplayName("1.3 使用默认点位"), Description("使用程序默认测试点位(True-是;False-否),当使用默认点位时【2 检测】多功能无效,只有检测数量和选点顺序有效")]
  21. public bool DefPos { get; set; }
  22. [PropertyOrder(12), Browsable(true), Category("2 检测"), DisplayName("2.1 检测数量"), Description("流程检测点位的数量")]
  23. public int PointCnt { get; set; }
  24. [PropertyOrder(13), Browsable(true), Category("2 检测"), DisplayName("2.2 自动寻找点位"), Description("根据产品设置和图纸自动寻找测试点位(True-是;False-否)")]
  25. public bool AutoMark { get; set; }
  26. [PropertyOrder(14), Browsable(true), Category("2 检测"), DisplayName("2.3 自动选点按顺序测试"), Description("根据产品设置和图纸按设置顺序自动寻找测试点位(True-是;False-否)")]
  27. public bool SelectPoint { get; set; }
  28. [PropertyOrder(15), Browsable(true), Category("2 检测"), DisplayName("2.4 自动检测顺序设置"), Description("当自动选点顺序 False时,需要手动输入顺序队列")]
  29. public List<int> Indexs { get; set; }
  30. [PropertyOrder(16), Browsable(true), Category("2 检测"), DisplayName("2.5 手动检测位置"), Description("当自动寻找点位 False时,需要手动输入检测点位")]
  31. public List<PointF> Points { get; set; }
  32. [PropertyOrder(17), Browsable(true), Category("2 检测"), DisplayName("2.6 数据判定方式"), Description("对采集数据进行判定处理的方式")]
  33. public DataJudgment JudgmentData { get; set; }
  34. [PropertyOrder(21), Browsable(true), Category("3 相机"), DisplayName("3.1 曝光"), Description("曝光时长(us)")]
  35. public float ExposureTime { get; set; }
  36. [PropertyOrder(22), Browsable(true), Category("3 相机"), DisplayName("3.2 增益"), Description("增益")]
  37. public float Gain { get; set; }
  38. [PropertyOrder(31), Browsable(true), Category("4 动作"), DisplayName("4.1 起始速度(mm/s)"), Description("起始速度")]
  39. public double VelLow { get; set; }
  40. [PropertyOrder(32), Browsable(true), Category("4 动作"), DisplayName("4.2 运行速度(mm/s)"), Description("运行速度")]
  41. public double VelHigh { get; set; }
  42. [PropertyOrder(33), Browsable(true), Category("4 动作"), DisplayName("4.3 加速度(mm/s)"), Description("加速度")]
  43. public double Acc { get; set; }
  44. [PropertyOrder(34), Browsable(true), Category("4 动作"), DisplayName("4.4 减速度(mm/s)"), Description("减速度")]
  45. public double Dec { get; set; }
  46. [PropertyOrder(35), Browsable(true), Category("4 动作"), DisplayName("4.5 等待稳定时间(ms)"), Description("到位等待稳定时间")]
  47. public int WaitTime { get; set; }
  48. [PropertyOrder(41), Browsable(true), Category("5 聚焦"), DisplayName("5.1 开启自动聚焦"), Description("是否开启自动聚焦功能(True-是;False-否)")]
  49. public bool AutoFocus { get; set; }
  50. [PropertyOrder(42), Browsable(true), Category("5 聚焦"), DisplayName("5.2 聚焦步进(mm)"), Description("每次聚焦的步进长度")]
  51. public double FocusStep { get; set; }
  52. [PropertyOrder(43), Browsable(true), Category("5 聚焦"), DisplayName("5.3 方向步进(mm)"), Description("寻找聚焦方向时的步进长度")]
  53. public double DirStep { get; set; }
  54. [PropertyOrder(44), Browsable(true), Category("5 聚焦"), DisplayName("5.4 等待稳定时间(ms)"), Description("聚焦步进之后等待稳定时间")]
  55. public int WaitDoneTime { get; set; }
  56. [PropertyOrder(45), Browsable(true), Category("5 聚焦"), DisplayName("5.5 聚焦超时(ms)"), Description("自动聚焦超时报警")]
  57. public int TimeOut { get; set; }
  58. [PropertyOrder(51), Browsable(true), Category("6 补偿"), DisplayName("6.1 补偿值"), Description("测试读取数据后加入的补偿值")]
  59. public double OffsetValue { get; set; }
  60. [PropertyOrder(61), Browsable(true), Category("7 上下限"), DisplayName("7.1 启用流程上下限"), Description("使用流程中设置的上下限判断")]
  61. public bool OpenUseLimit { get; set; }
  62. [PropertyOrder(62), Browsable(true), Category("7 上下限"), DisplayName("7.2 标准值"), Description("设置判断标志值")]
  63. public double StandardValues { get; set; }
  64. [PropertyOrder(63), Browsable(true), Category("7 上下限"), DisplayName("7.3 上限"), Description("设置判断上限")]
  65. public double MaxLimit { get; set; }
  66. [PropertyOrder(64), Browsable(true), Category("7 上下限"), DisplayName("7.4 下限"), Description("设置流程下限")]
  67. public double MinLimit { get; set; }
  68. [PropertyOrder(71), Browsable(true), Category("8 打印"), DisplayName("8.1 开启Excel打印"), Description("启用本工序数据打印")]
  69. public bool OpenPrint { get; set; }
  70. [PropertyOrder(72), Browsable(true), Category("8 打印"), DisplayName("8.2 打印数据"), Description("打印均值数据的位置")]
  71. public string ExcelData { get; set; }
  72. [PropertyOrder(73), Browsable(true), Category("8 打印"), DisplayName("8.3 打印上下限"), Description("打印上下限的位置")]
  73. public string ExcelLimit { get; set; }
  74. [PropertyOrder(74), Browsable(true), Category("8 打印"), DisplayName("8.4 开启标签打印"), Description("启用本工序数据打印")]
  75. public bool OpenPrintLabel { get; set; }
  76. [PropertyOrder(75), Browsable(true), Category("8 打印"), DisplayName("8.5 标签打印数据"), Description("打印均值数据的位置")]
  77. public string LabelData { get; set; }
  78. [PropertyOrder(76), Browsable(true), Category("8 打印"), DisplayName("8.6 标签打印上下限"), Description("打印上下限的位置")]
  79. public string LabelLimit { get; set; }
  80. [PropertyOrder(81), Browsable(true), Category("9 控制"), DisplayName("9.1 禁用工序"), Description("禁用本工序(True-是;False-否)")]
  81. public bool Disable { get; set; }
  82. public PointTestProp()
  83. {
  84. EngineName = "My_PI_PT_General";
  85. TestType = PointTestType.Y轴方向PT值检测;
  86. DefPos = false;
  87. PointCnt = 5;
  88. AutoMark = true;
  89. SelectPoint = true;
  90. Indexs = new List<int>();
  91. Points = new List<PointF>();
  92. JudgmentData = DataJudgment.均值;
  93. ExposureTime = 30000;
  94. Gain = 0;
  95. VelLow = 0;
  96. VelHigh = 100;
  97. Acc = 200;
  98. Dec = 200;
  99. WaitTime = 50;
  100. AutoFocus = true;
  101. FocusStep = 0.02;
  102. DirStep = 0.04;
  103. WaitDoneTime = 200;
  104. TimeOut = 30000;
  105. OffsetValue = 0;
  106. OpenUseLimit = false;
  107. StandardValues = 0;
  108. MaxLimit = 0;
  109. MinLimit = 0;
  110. Disable = false;
  111. OpenPrint = false;
  112. OpenPrintLabel = false;
  113. ExcelData = "";
  114. ExcelLimit = "";
  115. LabelData = "";
  116. LabelLimit = "";
  117. }
  118. /// <summary>
  119. /// 序列化
  120. /// </summary>
  121. /// <param name="obj"></param>
  122. /// <returns></returns>
  123. public string serialize()
  124. {
  125. return JsonConvert.SerializeObject(this);
  126. }
  127. /// <summary>
  128. /// 反序列化
  129. /// </summary>
  130. /// <param name="json"></param>
  131. /// <returns></returns>
  132. public void deserialize(string json)
  133. {
  134. var o = JsonConvert.DeserializeObject<PointTestProp>(json);
  135. Type type = o.GetType();
  136. System.Reflection.PropertyInfo[] properties = type.GetProperties();
  137. foreach (System.Reflection.PropertyInfo property in properties)
  138. {
  139. string name = property.Name;
  140. if (!type.GetProperty(name).IsDefined(typeof(JsonIgnoreAttribute), true))
  141. {
  142. var value = property.GetValue(o);
  143. this.GetType().GetProperty(name).SetValue(this, value);
  144. }
  145. }
  146. }
  147. }
  148. }