版博士V2.0程序
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 

100 rader
4.3 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 MarkProp
  15. {
  16. [PropertyOrder(1), Browsable(true), Category("1 算法"), DisplayName("1.1 引擎文件名"), Description("图像处理算法引擎文件名")]
  17. public string EngineName { get; set; }
  18. [PropertyOrder(11), Browsable(true), Category("2 Mark"), DisplayName("2.1 Mark类型"), Description("流程找Mark的类型位置")]
  19. public MarkCam MarkType { get; set; }
  20. [PropertyOrder(12), Browsable(true), Category("2 Mark"), DisplayName("2.2 Mark数量"), Description("流程找Mark的数量")]
  21. public int MarkCnt { get; set; }
  22. [PropertyOrder(13), Browsable(true), Category("2 Mark"), DisplayName("2.3 自动寻找Mark"), Description("根据产品设置和图纸自动寻找Mark(True-是;False-否)")]
  23. public bool AutoMark { get; set; }
  24. [PropertyOrder(14), Browsable(true), Category("2 Mark"), DisplayName("2.4 手动Mark位置列表"), Description("当自动寻找Mark False时,需要手动输入Mark点位")]
  25. public List<PointF> Points { get; set; }
  26. [PropertyOrder(21), Browsable(true), Category("3 相机"), DisplayName("3.1 曝光"), Description("曝光时长(us)")]
  27. public float ExposureTime { get; set; }
  28. [PropertyOrder(22), Browsable(true), Category("3 相机"), DisplayName("3.2 增益"), Description("增益")]
  29. public float Gain { get; set; }
  30. [PropertyOrder(31), Browsable(true), Category("4 动作"), DisplayName("4.1 起始速度(mm/s)"), Description("起始速度")]
  31. public double VelLow { get; set; }
  32. [PropertyOrder(32), Browsable(true), Category("4 动作"), DisplayName("4.2 运行速度(mm/s)"), Description("运行速度")]
  33. public double VelHigh { get; set; }
  34. [PropertyOrder(33), Browsable(true), Category("4 动作"), DisplayName("4.3 加速度(mm/s)"), Description("加速度")]
  35. public double Acc { get; set; }
  36. [PropertyOrder(34), Browsable(true), Category("4 动作"), DisplayName("4.4 减速度(mm/s)"), Description("减速度")]
  37. public double Dec { get; set; }
  38. [PropertyOrder(35), Browsable(true), Category("4 动作"), DisplayName("4.5 等待稳定时间(ms)"), Description("到位等待稳定时间")]
  39. public int WaitTime { get; set; }
  40. [PropertyOrder(41), Browsable(true), Category("5 控制"), DisplayName("5.1 禁用工序"), Description("禁用本工序(True-是;False-否)")]
  41. public bool Disable { get; set; }
  42. public MarkProp()
  43. {
  44. EngineName = "My_PI_PT_General";
  45. MarkType = MarkCam.尺寸检测Mark;
  46. MarkCnt = 4;
  47. AutoMark = true;
  48. Points = new List<PointF>();
  49. ExposureTime = 30000;
  50. Gain = 0;
  51. VelLow = 0;
  52. VelHigh = 100;
  53. Acc = 200;
  54. Dec = 200;
  55. WaitTime = 50;
  56. Disable = false;
  57. }
  58. /// <summary>
  59. /// 序列化
  60. /// </summary>
  61. /// <param name="obj"></param>
  62. /// <returns></returns>
  63. public string serialize()
  64. {
  65. return JsonConvert.SerializeObject(this);
  66. }
  67. /// <summary>
  68. /// 反序列化
  69. /// </summary>
  70. /// <param name="json"></param>
  71. /// <returns></returns>
  72. public void deserialize(string json)
  73. {
  74. var o = JsonConvert.DeserializeObject<MarkProp>(json);
  75. Type type = o.GetType();
  76. System.Reflection.PropertyInfo[] properties = type.GetProperties();
  77. foreach (System.Reflection.PropertyInfo property in properties)
  78. {
  79. string name = property.Name;
  80. if (!type.GetProperty(name).IsDefined(typeof(JsonIgnoreAttribute), true))
  81. {
  82. var value = property.GetValue(o);
  83. this.GetType().GetProperty(name).SetValue(this, value);
  84. }
  85. }
  86. }
  87. }
  88. }