FEISemController.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. using FEIApiControl;
  2. using OTSCLRINTERFACE;
  3. using OTSModelSharp.ServiceCenter;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace OTSMeasureApp.ServiceCenter
  10. {
  11. class FEISemController : ISemController
  12. {
  13. static APIClass m_ApiClass = null;
  14. public FEISemController()
  15. {
  16. m_ApiClass = new APIClass();
  17. }
  18. public static APIClass GetApiClassInstance()
  19. {
  20. if (m_ApiClass == null)
  21. {
  22. m_ApiClass = new APIClass();
  23. }
  24. return m_ApiClass;
  25. }
  26. public bool Connect()
  27. {
  28. string FEIIP = FileHelper.GetXMLInformations("FEIIP");
  29. string FEIPORT = FileHelper.GetXMLInformations("FEIPORT");
  30. if (FEIIP == "" || FEIPORT == "")
  31. {
  32. NLog.LogManager.GetCurrentClassLogger().Error("FEI电镜端口配置为空!");
  33. return false;
  34. }
  35. if (m_ApiClass.isConnect())
  36. {
  37. return true;
  38. }
  39. return m_ApiClass.Connect(FEIIP, FEIPORT);
  40. }
  41. public bool DisConnect()
  42. {
  43. return m_ApiClass.DisConnect();
  44. }
  45. public bool GetMagnification(ref double a_dMagnification)
  46. {
  47. return m_ApiClass.GetMagnification(ref a_dMagnification);
  48. }
  49. public bool GetScanFieldSize(ref double dScanFieldSizeX, ref double dScanFieldSizeY)
  50. {
  51. return m_ApiClass.GetSemScanFieldSize(ref dScanFieldSizeX, ref dScanFieldSizeY);
  52. }
  53. public bool GetScanFieldSize100(ref double dScanFieldSizeX, ref double dScanFieldSizeY)
  54. {
  55. m_ApiClass.SetMagnification(100);
  56. return m_ApiClass.GetSemScanFieldSize(ref dScanFieldSizeX, ref dScanFieldSizeY);
  57. }
  58. public bool GetSemBeamBlank(ref int a_nBeamBlank)
  59. {
  60. if (m_ApiClass.GetIsBlanked())
  61. {
  62. a_nBeamBlank = 1;
  63. }
  64. else
  65. {
  66. a_nBeamBlank = 0;
  67. }
  68. return true;
  69. }
  70. public bool GetSemBrightness(ref double a_dBrightness)
  71. {
  72. a_dBrightness = m_ApiClass.GetDetectorBrightness();
  73. return true;
  74. }
  75. public bool GetSemContrast(ref double a_dContrast)
  76. {
  77. a_dContrast = m_ApiClass.GetDetectorContrast();
  78. return true;
  79. }
  80. public bool GetSemHighTension(ref double a_dKV)
  81. {
  82. a_dKV = m_ApiClass.GetHightVoltage() / 1000;
  83. return true;
  84. }
  85. public bool GetSemPositionXY(ref double a_dPositionX, ref double a_dPositionY, ref double a_dPositionR)
  86. {
  87. double a_dPositionZ = 0;
  88. double a_dPositionT = 0;
  89. return m_ApiClass.GetSemPositionXYZRT(ref a_dPositionX, ref a_dPositionY, ref a_dPositionZ, ref a_dPositionR, ref a_dPositionT);
  90. }
  91. public bool GetWorkingDistance(ref double a_distance)
  92. {
  93. return m_ApiClass.GetWorkingDistance(ref a_distance);
  94. }
  95. public bool IsConnected()
  96. {
  97. return m_ApiClass.isConnect();
  98. }
  99. public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY, double rotation)
  100. {
  101. return m_ApiClass.SetSemPositionXYR(a_dPositionX, a_dPositionY, rotation);
  102. }
  103. public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY)
  104. {
  105. return m_ApiClass.SetSemPositionXY(a_dPositionX, a_dPositionY);
  106. }
  107. public bool SetMagnification(double a_dMagnification)
  108. {
  109. return m_ApiClass.SetMagnification(a_dMagnification);
  110. }
  111. public bool SetScanExternal(bool b)
  112. {
  113. return m_ApiClass.SetSemScanExternal(b);
  114. }
  115. public bool SetScanFieldSize100(double dScanFieldSizeX, double dScanFieldSizeY)
  116. {
  117. throw new NotImplementedException();
  118. }
  119. public bool SetSemBeamBlank(bool val)
  120. {
  121. if (val)
  122. {
  123. return m_ApiClass.SetBeamStateOn();
  124. }
  125. else
  126. {
  127. return m_ApiClass.SetBeamStateOff();
  128. }
  129. }
  130. public bool SetSemBeamCurrentOff(bool val)
  131. {
  132. if (val)
  133. {
  134. return m_ApiClass.SetBeamStateOn();
  135. }
  136. else
  137. {
  138. return m_ApiClass.SetBeamStateOff();
  139. }
  140. }
  141. public bool SetSemBrightness(double a_dBrightness)
  142. {
  143. return m_ApiClass.SetDetectorBrightness(a_dBrightness);
  144. }
  145. public bool SetSemContrast(double a_dContrast)
  146. {
  147. return m_ApiClass.SetDetectorContrast(a_dContrast);
  148. }
  149. public bool SetSemHighTension(double a_dKV)
  150. {
  151. return m_ApiClass.SetHightVoltage(a_dKV);
  152. }
  153. public bool SetSemHTOff(bool value)
  154. {
  155. return m_ApiClass.SetBeamStateOff();
  156. }
  157. public bool SetWorkingDistance(double a_distance)
  158. {
  159. return m_ApiClass.SetWorkingDistance(a_distance);
  160. }
  161. public bool StopXrayAcquisition()
  162. {
  163. return m_ApiClass.DisConnect();
  164. }
  165. public bool RunHIGH_VACUUM()
  166. {
  167. return m_ApiClass.RunHIGH_VACUUM();
  168. }
  169. public bool StopImageAcquisition()
  170. {
  171. return m_ApiClass.Stop_acquisition();
  172. }
  173. public bool SetReducedArea()
  174. {
  175. return m_ApiClass.SetReducedArea();
  176. }
  177. public bool SetFullFrame()
  178. {
  179. return m_ApiClass.SetFullFrame();
  180. }
  181. }
  182. }