PicoSmartSemController.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. using FEIApiControl;
  2. using OTSModelSharp.ServiceCenter;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace OTSMeasureApp.ServiceCenter.PicoSmart
  9. {
  10. class PicoSmartSemController : ISemController
  11. {
  12. public static PicoSmartApi_cshape m_api;
  13. private int imageWidth = 640;
  14. private int imageHeight = 480;
  15. double dwelltime = 10;
  16. int port = 7321;
  17. string ip = "127.0.0.1";
  18. /// <summary>
  19. /// //se 0;bse 1;se_bse 2;
  20. /// </summary>
  21. int scan_chanel = 1;
  22. /// <summary>
  23. /// //red 0; fast 1; slow 2; slow2 3
  24. /// </summary>
  25. int scan_speed = 1;
  26. public PicoSmartSemController()
  27. {
  28. m_api = new PicoSmartApi_cshape();
  29. m_api.set_ip(ip);
  30. m_api.set_port(port);
  31. }
  32. public static PicoSmartApi_cshape GetApiClassInstance()
  33. {
  34. if(m_api==null)
  35. {
  36. m_api=new PicoSmartApi_cshape();
  37. }
  38. return m_api;
  39. }
  40. public bool Connect()
  41. {
  42. string FEIIP = FileHelper.GetXMLInformations("FEIIP");
  43. string FEIPORT = FileHelper.GetXMLInformations("FEIPORT");
  44. if (FEIIP == "" || FEIPORT == "")
  45. {
  46. NLog.LogManager.GetCurrentClassLogger().Error("FEI电镜端口配置为空!");
  47. return false;
  48. }
  49. m_api.set_ip(FEIIP);
  50. m_api.set_port(int.Parse(FEIPORT));
  51. if (m_api.isStart() == 1)
  52. {
  53. return true;
  54. }
  55. if (m_api.start()==1)
  56. {
  57. return true;
  58. }
  59. return false;
  60. }
  61. public bool DisConnect()
  62. {
  63. if (m_api.stop() == 1)
  64. {
  65. return true;
  66. }
  67. return false;
  68. }
  69. public bool GetMagnification(ref double a_dMagnification)
  70. {
  71. return m_api.GetMagnification(ref a_dMagnification);
  72. }
  73. public bool GetScanFieldSize(ref double dScanFieldSizeX, ref double dScanFieldSizeY)
  74. {
  75. if(m_api.isStart()==0)
  76. {
  77. return false;
  78. }
  79. else
  80. {
  81. dScanFieldSizeX = imageWidth;
  82. dScanFieldSizeY = imageHeight;
  83. }
  84. return false;
  85. }
  86. public bool GetSemBeamBlank(ref int a_nBeamBlank)
  87. {
  88. return false;
  89. }
  90. public bool GetSemBrightness(ref double a_dBrightness)
  91. {
  92. return m_api.GetSemBrightness(ref a_dBrightness);
  93. }
  94. public bool GetSemContrast(ref double a_dContrast)
  95. {
  96. return m_api.GetSemContrast(ref a_dContrast);
  97. }
  98. public bool GetSemHighTension(ref double a_dKV)
  99. {
  100. return m_api.GetSemHighTension(ref a_dKV);
  101. }
  102. public bool GetSemPositionXY(ref double a_dPositionX, ref double a_dPositionY, ref double a_dPositionR)
  103. {
  104. return false;
  105. }
  106. public bool GetWorkingDistance(ref double a_distance)
  107. {
  108. return m_api.GetWorkingDistance(ref a_distance);
  109. }
  110. public bool IsConnected()
  111. {
  112. if(m_api.isStart()==1)
  113. {
  114. return true;
  115. }
  116. return false;
  117. }
  118. public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY, double rotation)
  119. {
  120. return false;
  121. }
  122. public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY)
  123. {
  124. return m_api.MoveSEMToPoint(a_dPositionX, a_dPositionY);
  125. }
  126. public bool SetMagnification(double a_dMagnification)
  127. {
  128. return m_api.SetMagnification(a_dMagnification);
  129. }
  130. public bool SetScanExternal(bool b)
  131. {
  132. return false;
  133. }
  134. public bool SetSemBeamBlank(bool value)
  135. {
  136. return false;
  137. }
  138. public bool SetSemBeamCurrentOff(bool value)
  139. {
  140. return false;
  141. }
  142. public bool SetSemBrightness(double a_dBrightness)
  143. {
  144. return m_api.SetSemBrightness(a_dBrightness);
  145. }
  146. public bool SetSemContrast(double a_dContrast)
  147. {
  148. return m_api.SetSemContrast( a_dContrast);
  149. }
  150. public bool SetSemHighTension(double a_dKV)
  151. {
  152. return m_api.SetSemHighTension(a_dKV);
  153. }
  154. public bool SetSemHTOff(bool value)
  155. {
  156. return false;
  157. }
  158. public bool SetWorkingDistance(double a_distance)
  159. {
  160. return false;
  161. }
  162. public bool StopXrayAcquisition()
  163. {
  164. return false;
  165. }
  166. }
  167. }