版博士V2.0程序
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

SizeLibProp.cs 5.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Xml.Linq;
  9. using MaiMuAOI.SysUI.StepUI.PropExtend;
  10. using Newtonsoft.Json;
  11. using Newtonsoft.Json.Serialization;
  12. using static ProductionControl.UI.UIAxisDev;
  13. namespace ProductionControl.UI
  14. {
  15. //[TypeConverter(typeof(PropertySorter))] //此属性使类无法序列化和反序列化
  16. public class SizeLibProp
  17. {
  18. //[PropertyOrder(1), Browsable(true), Category("1 数据"), DisplayName("1.1 引擎路径"), Description("引擎路径")]
  19. //public string EnginePath { get; set; }
  20. [PropertyOrder(1), Browsable(true), Category("1 数据"), DisplayName("1.2 引擎文件名"), Description("引擎文件名")]
  21. public string EngineName { get; set; }
  22. [PropertyOrder(1), Browsable(true), Category("1 数据"), DisplayName("1.3 源图"), Description("源图"), JsonIgnore]
  23. public string BmpPath { get; set; }
  24. [PropertyOrder(1), Browsable(true), Category("1 数据"), DisplayName("1.4 索引"), Description("索引 0-9")]
  25. public int Index { get; set; }
  26. [PropertyOrder(1), Browsable(true), Category("1 数据"), DisplayName("1.5 保存标识"), Description("供后续轴移动时引用此标识数据,不设则在本工序内立即进行轴校正。")]
  27. public string SizeTag { get; set; }
  28. //2023-10-27 新增图纸选点
  29. [PropertyOrder(1), Browsable(true), Category("1 数据"), DisplayName("1.6 图纸图片"), Description("图纸图片文件名")]
  30. public string MapPath { get; set; }
  31. [PropertyOrder(1), Browsable(true), Category("1 数据"), DisplayName("1.7 抓取位置"), Description("图纸上选取的点位,根据选取的5个PT点,9个线宽点,计算真是走位。")]
  32. //public double[] GetPointList { get; set; } = new double[23];//默认对应0和2号AXIS
  33. public double[] GetPointList { get; set; } = new double[23] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  34. [PropertyOrder(15), Browsable(true), Category("2 结果"), DisplayName("PT1"), Description("结果"), ReadOnly(true), JsonIgnore]
  35. public double PT1 { get; set; }
  36. [PropertyOrder(15), Browsable(true), Category("2 结果"), DisplayName("PT2"), Description("结果"), ReadOnly(true), JsonIgnore]
  37. public double PT2 { get; set; }
  38. [PropertyOrder(15), Browsable(true), Category("2 结果"), DisplayName("Shanxian"), Description("结果"), ReadOnly(true), JsonIgnore]
  39. public double Shanxian { get; set; }
  40. //[PropertyOrder(15), Browsable(true), Category("2 结果"), DisplayName("RowP"), Description("结果"), ReadOnly(true), JsonIgnore]
  41. //public double RowP { get; set; }
  42. [PropertyOrder(15), Browsable(true), Category("2 结果"), DisplayName("Circle_Ymm"), Description("结果"), ReadOnly(true), JsonIgnore]
  43. public double Circle_Ymm { get; set; }
  44. [PropertyOrder(15), Browsable(true), Category("2 结果"), DisplayName("Circle_Xmm"), Description("结果"), ReadOnly(true), JsonIgnore]
  45. public double Circle_Xmm { get; set; }
  46. [PropertyOrder(15), Browsable(true), Category("2 结果"), DisplayName("offsetX"), Description("结果"), ReadOnly(true), JsonIgnore]
  47. public double offsetX { get; set; }
  48. [PropertyOrder(15), Browsable(true), Category("2 结果"), DisplayName("offsetY"), Description("结果"), ReadOnly(true), JsonIgnore]
  49. public double offsetY { get; set; }
  50. [PropertyOrder(15), Browsable(true), Category("2 结果"), DisplayName("Mark点"), Description("Mark点"), ReadOnly(true), JsonIgnore]
  51. public double[] MarkPointList { get; set; }
  52. [PropertyOrder(15), Browsable(true), Category("2 结果"), DisplayName("信息"), Description("信息"), ReadOnly(true), JsonIgnore]
  53. public string resultInfo { get; set; }
  54. [PropertyOrder(25), Browsable(true), Category("3 控制"), DisplayName("3.1 运行前Sleep(ms)"), Description("休息时间")]
  55. public uint SleepPre { get; set; }
  56. [PropertyOrder(26), Browsable(true), Category("3 控制"), DisplayName("3.2 运行后Sleep(ms)"), Description("休息时间")]
  57. public uint SleepLater { get; set; }
  58. [PropertyOrder(27), Browsable(true), Category("3 控制"), DisplayName("3.3 异步运行"), Description("非阻塞后续流程运行(True-是;False-否)")]
  59. public bool AsynRun { get; set; } = true;
  60. [PropertyOrder(28), Browsable(true), Category("3 控制"), DisplayName("3.4 禁用工序"), Description("禁用本工序(True-是;False-否)")]
  61. public bool Disable { get; set; }
  62. /// <summary>
  63. /// 序列化
  64. /// </summary>
  65. /// <param name="obj"></param>
  66. /// <returns></returns>
  67. public string serialize()
  68. {
  69. return JsonConvert.SerializeObject(this);
  70. }
  71. /// <summary>
  72. /// 反序列化
  73. /// </summary>
  74. /// <param name="json"></param>
  75. /// <returns></returns>
  76. public void deserialize(string json)
  77. {
  78. var o= JsonConvert.DeserializeObject<SizeLibProp>(json);
  79. Type type = o.GetType();
  80. System.Reflection.PropertyInfo[] properties = type.GetProperties();
  81. foreach (System.Reflection.PropertyInfo property in properties)
  82. {
  83. string name = property.Name;
  84. if (!type.GetProperty(name).IsDefined(typeof(JsonIgnoreAttribute), true))
  85. {
  86. var value = property.GetValue(o);
  87. this.GetType().GetProperty(name).SetValue(this, value);
  88. }
  89. }
  90. }
  91. }
  92. }