123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- using FEIApiControl;
- using OTSModelSharp.ServiceCenter;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OTSMeasureApp.ServiceCenter.PicoSmart
- {
- class PicoSmartSemController : ISemController
- {
- public static PicoSmartApi_cshape m_api;
- private int imageWidth = 640;
- private int imageHeight = 480;
- double dwelltime = 10;
- int port = 7321;
- string ip = "127.0.0.1";
- /// <summary>
- /// //se 0;bse 1;se_bse 2;
- /// </summary>
- int scan_chanel = 1;
- /// <summary>
- /// //red 0; fast 1; slow 2; slow2 3
- /// </summary>
- int scan_speed = 1;
- public PicoSmartSemController()
- {
- m_api = new PicoSmartApi_cshape();
- m_api.set_ip(ip);
- m_api.set_port(port);
- }
- public static PicoSmartApi_cshape GetApiClassInstance()
- {
- if(m_api==null)
- {
- m_api=new PicoSmartApi_cshape();
- }
- return m_api;
- }
- public bool Connect()
- {
- string FEIIP = FileHelper.GetXMLInformations("FEIIP");
- string FEIPORT = FileHelper.GetXMLInformations("FEIPORT");
- if (FEIIP == "" || FEIPORT == "")
- {
- NLog.LogManager.GetCurrentClassLogger().Error("FEI电镜端口配置为空!");
- return false;
- }
- m_api.set_ip(FEIIP);
- m_api.set_port(int.Parse(FEIPORT));
- if (m_api.isStart() == 1)
- {
- return true;
- }
- if (m_api.start()==1)
- {
- return true;
- }
- return false;
- }
- public bool DisConnect()
- {
- if (m_api.stop() == 1)
- {
- return true;
- }
- return false;
- }
- public bool GetMagnification(ref double a_dMagnification)
- {
- return m_api.GetMagnification(ref a_dMagnification);
- }
- public bool GetScanFieldSize(ref double dScanFieldSizeX, ref double dScanFieldSizeY)
- {
- if(m_api.isStart()==0)
- {
- return false;
- }
- else
- {
- dScanFieldSizeX = imageWidth;
- dScanFieldSizeY = imageHeight;
- }
- return false;
- }
- public bool GetSemBeamBlank(ref int a_nBeamBlank)
- {
- return false;
- }
- public bool GetSemBrightness(ref double a_dBrightness)
- {
- return m_api.GetSemBrightness(ref a_dBrightness);
- }
- public bool GetSemContrast(ref double a_dContrast)
- {
- return m_api.GetSemContrast(ref a_dContrast);
- }
- public bool GetSemHighTension(ref double a_dKV)
- {
- return m_api.GetSemHighTension(ref a_dKV);
- }
- public bool GetSemPositionXY(ref double a_dPositionX, ref double a_dPositionY, ref double a_dPositionR)
- {
- return false;
- }
- public bool GetWorkingDistance(ref double a_distance)
- {
- return m_api.GetWorkingDistance(ref a_distance);
- }
- public bool IsConnected()
- {
- if(m_api.isStart()==1)
- {
- return true;
- }
- return false;
- }
- public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY, double rotation)
- {
- return false;
- }
- public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY)
- {
- return m_api.MoveSEMToPoint(a_dPositionX, a_dPositionY);
- }
- public bool SetMagnification(double a_dMagnification)
- {
- return m_api.SetMagnification(a_dMagnification);
- }
- public bool SetScanExternal(bool b)
- {
- return false;
- }
- public bool SetSemBeamBlank(bool value)
- {
- return false;
- }
- public bool SetSemBeamCurrentOff(bool value)
- {
- return false;
- }
- public bool SetSemBrightness(double a_dBrightness)
- {
- return m_api.SetSemBrightness(a_dBrightness);
- }
- public bool SetSemContrast(double a_dContrast)
- {
- return m_api.SetSemContrast( a_dContrast);
- }
- public bool SetSemHighTension(double a_dKV)
- {
- return m_api.SetSemHighTension(a_dKV);
- }
- public bool SetSemHTOff(bool value)
- {
- return false;
- }
- public bool SetWorkingDistance(double a_distance)
- {
- return false;
- }
- public bool StopXrayAcquisition()
- {
- return false;
- }
- }
- }
|