版博士V2.0程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PointTestProp.cs 6.8 KiB

пре 2 година
пре 2 година
пре 2 година
пре 2 година
пре 2 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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("禁用本工序(True-是;False-否)")]
  61. public bool Disable { get; set; }
  62. public PointTestProp()
  63. {
  64. EngineName = "";
  65. TestType = PointTestType.Y轴方向PT值检测;
  66. DefPos = false;
  67. PointCnt = 5;
  68. AutoMark = true;
  69. SelectPoint = true;
  70. Indexs = new List<int>();
  71. Points = new List<PointF>();
  72. JudgmentData = DataJudgment.均值;
  73. ExposureTime = 30000;
  74. Gain = 0;
  75. VelLow = 0;
  76. VelHigh = 100;
  77. Acc = 200;
  78. Dec = 200;
  79. WaitTime = 50;
  80. AutoFocus = true;
  81. FocusStep = 0.02;
  82. DirStep = 0.04;
  83. WaitDoneTime = 200;
  84. TimeOut = 30000;
  85. OffsetValue = 0;
  86. Disable = false;
  87. }
  88. /// <summary>
  89. /// 序列化
  90. /// </summary>
  91. /// <param name="obj"></param>
  92. /// <returns></returns>
  93. public string serialize()
  94. {
  95. return JsonConvert.SerializeObject(this);
  96. }
  97. /// <summary>
  98. /// 反序列化
  99. /// </summary>
  100. /// <param name="json"></param>
  101. /// <returns></returns>
  102. public void deserialize(string json)
  103. {
  104. var o = JsonConvert.DeserializeObject<PointTestProp>(json);
  105. Type type = o.GetType();
  106. System.Reflection.PropertyInfo[] properties = type.GetProperties();
  107. foreach (System.Reflection.PropertyInfo property in properties)
  108. {
  109. string name = property.Name;
  110. if (!type.GetProperty(name).IsDefined(typeof(JsonIgnoreAttribute), true))
  111. {
  112. var value = property.GetValue(o);
  113. this.GetType().GetProperty(name).SetValue(this, value);
  114. }
  115. }
  116. }
  117. }
  118. }