public MainForm() { InitializeComponent(); //라이브러리 초기화 SpiralLab.Core.Initialize(); //문서 생성 var doc = new DocumentDefault(); siriusEditorForm1.Document = doc; // 내부 데이타(IDocument) 가 변경될경우 이를 이벤트 통지를 받는 핸들러 등록 siriusEditorForm1.OnDocumentSourceChanged += SiriusEditorForm1_OnDocumentSourceChanged; #region RTC 초기화 //var rtc = new RtcVirtual(0); //create Rtc for dummy var rtc = new Rtc5(0); //create Rtc5 controller //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //실험적인 상태 (Scanlab Rtc6 Ethernet 제어기) //var rtc = new Rtc6SyncAxis(0, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "configuration", "syncAXISConfig.xml")); //실험적인 상태 (Scanlab XLSCAN 솔류션) float fov = 60.0f; // scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // 스캐너 보정 파일 지정 : correction file rtc.CtlFrequency(50 * 1000, 2); // laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); // default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); // scanner and laser delays var rtcMOTF = rtc as IRtcMOTF; //엔코더 스케일 설정 (단축 MOTF) rtcMOTF.EncXCountsPerMm = 2000; //단위 mm 이동시 발생되는 엔코더 펄스의 수 rtcMOTF.EncYCountsPerMm = 0; #endregion this.siriusEditorForm1.Rtc = rtc; #region 레이저 소스 초기화 var laser = new LaserVirtual(0, "virtual", 20.0f); laser.Rtc = rtc; laser.Initialize(); laser.CtlPower(10); #endregion this.siriusEditorForm1.Laser = laser; #region 마커 지정 var marker = new MotfMarker(0); #endregion this.siriusEditorForm1.Marker = marker; timer1.Enabled = true; }
public MainWindow() { InitializeComponent(); SpiralLab.Core.Initialize(); var siriusEditorForm = (siriusEditor.Child as SiriusEditorForm); //펜 집합 기능 사용 siriusEditorForm.EnablePens = true; var doc = new DocumentDefault(); siriusEditorForm.Document = doc; #region RTC 초기화 //var rtc = new RtcVirtual(0); //create Rtc for dummy (가상 RTC 카드) var rtc = new Rtc5(0); //create Rtc5 controller //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //Rtc6 Ethernet //var rtc = new Rtc6SyncAxis(0, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "syncAxis", "syncAXISConfig.xml")); //Scanlab XLSCAN float fov = 60.0f; ///scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // 스캐너 보정 파일 지정 : correction file rtc.CtlFrequency(50 * 1000, 2); // laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); // default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); // scanner and laser delays #endregion siriusEditorForm.Rtc = rtc; #region initialize Laser (virtual) var laser = new LaserVirtual(0, "virtual", 20); // virtual laser source with max 20W power (최대 출력 20W 의 가상 레이저 소스 생성) //var laser = new IPGYLP(0, "IPG YLP", 1, 20); //var laser = new JPTTypeE(0, "JPT Type E", 1, 20); //var laser = new SPIG4(0, "SPI G3/4", 1, 20); //var laser = new PhotonicsIndustryDX(0, "PI", 1, 20); //var laser = new AdvancedOptoWaveFotia(0, "Fotia", 1, 20); //var laser = new CoherentAviaLX(0, "Avia LX", 1, 20); laser.Rtc = rtc; laser.Initialize(); laser.CtlPower(2); #endregion siriusEditorForm.Laser = laser; #region 마커 지정 var marker = new MarkerDefault(0); #endregion siriusEditorForm.Marker = marker; }
private void button8_Click(object sender, EventArgs e) { uint index = 0; var rtc = new Rtc5(index); //create Rtc5 controller //var rtc = new Rtc6(index); //create Rtc6 controller float fov = 60.0f; // scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); bool success = true; success &= rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // correction file (스캐너 보정 파일) success &= rtc.CtlFrequency(50 * 1000, 2); // laser frequency : 50KHz, pulse width : 2usec (주파수 50KHz, 펄스폭 2usec) success &= rtc.CtlSpeed(500, 500); // jump and mark speed : 500mm/s (점프, 마크 속도 500mm/s) success &= rtc.CtlDelay(10, 100, 200, 200, 0); // scanner and laser delays (스캐너/레이저 지연값 설정) var laser = new DemoIPGYLPTypeE(index, "YLP TYPE E", 1, 20); laser.Rtc = rtc; var rtcDInExt1 = new RtcDInput(rtc, index, "DIN RTC EXT1"); success &= rtcDInExt1.Initialize(); var rtcDOutExt1 = new RtcDOutputExt1(rtc, index, "DOUT RTC EXT1"); success &= rtcDOutExt1.Initialize(); var rtcDOutExt2 = new RtcDOutputExt2(rtc, index, "DIN RTC EXT2"); success &= rtcDOutExt2.Initialize(); laser.RtcDInExt1 = rtcDInExt1; laser.RtcDOutExt1 = rtcDOutExt1; laser.RtcDOutExt2 = rtcDOutExt2; success &= laser.Initialize(); var form = new SpiralLab.Sirius.Laser.LaserForm(); form.AliasName = "TYPE E"; form.Laser = laser; form.ShowDialog(this); laser.Dispose(); rtcDInExt1.Dispose(); rtcDOutExt1.Dispose(); rtcDOutExt2.Dispose(); rtc.Dispose(); }
static void Main(string[] args) { SpiralLab.Core.Initialize(); #region initialize RTC //var rtc = new RtcVirtual(0); //create Rtc for dummy var rtc = new Rtc5(0); //create Rtc5 controller //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //실험적인 상태 (Scanlab Rtc6 Ethernet 제어기) //var rtc = new Rtc6SyncAxis(0, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "syncAxis", "syncAXISConfig.xml")); //실험적인 상태 (Scanlab XLSCAN 솔류션) float fov = 60.0f; // scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); //default correction file rtc.CtlFrequency(50 * 1000, 2); //laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); // default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); //scanner and laser delays #endregion #region initialize Laser (virtual) var laser = new LaserVirtual(0, "virtual", 20); // virtual laser source with max 20W power (최대 출력 20W 의 가상 레이저 소스 생성) //var laser = new IPGYLP(0, "IPG YLP", 1, 20); //var laser = new JPTTypeE(0, "JPT Type E", 1, 20); //var laser = new SPIG4(0, "SPI G3/4", 1, 20); //var laser = new PhotonicsIndustryDX(0, "PI", 1, 20); //var laser = new AdvancedOptoWaveFotia(0, "Fotia", 1, 20); //var laser = new CoherentAviaLX(0, "Avia LX", 1, 20); laser.Rtc = rtc; laser.Initialize(); laser.CtlPower(2); #endregion #region create entity at 0,0 location var doc = new DocumentDefault("3x3 scanner field correction"); // 레이어 생성 var layer = new Layer("default"); // 나선 개체 추가 layer.Add(new Spiral(0.0f, 0.0f, 0.5f, 2.0f, 5, true)); // 레이어의 모든 개채들 내부 데이타 계산및 갱신 layer.Regen(); // 문서에 레이어 추가 doc.Layers.Add(layer); // 문서 저장 DocumentSerializer.Save(doc, "test.sirius"); #endregion ConsoleKeyInfo key; do { Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("Testcase for spirallab.sirius. powered by [email protected] (http://spirallab.co.kr)"); Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("'M' : draw entities by marker"); Console.WriteLine("'O' : draw entities by marker with offsets"); Console.WriteLine("'Q' : quit"); Console.WriteLine($"{Environment.NewLine}"); Console.Write("select your target : "); key = Console.ReadKey(false); if (key.Key == ConsoleKey.Q) { break; } Console.WriteLine($"{Environment.NewLine}"); switch (key.Key) { case ConsoleKey.M: Console.WriteLine("WARNING !!! LASER IS BUSY ..."); DrawByMarker(doc, rtc, laser); break; case ConsoleKey.O: Console.WriteLine("WARNING !!! LASER IS BUSY ..."); DrawByMarkerWithOffset(doc, rtc, laser); break; } } while (true); rtc.Dispose(); }
static void Main(string[] args) { SpiralLab.Core.Initialize(); #region initialize RTC //var rtc = new RtcVirtual(0); //create Rtc for dummy var rtc = new Rtc5(0); //create Rtc5 controller //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //실험적인 상태 (Scanlab Rtc6 Ethernet 제어기) //var rtc = new Rtc6SyncAxis(0, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "syncAxis", "syncAXISConfig.xml")); //실험적인 상태 (Scanlab XLSCAN 솔류션) float fov = 60.0f; // scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); //default correction file rtc.CtlFrequency(50 * 1000, 2); //laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); // default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); //scanner and laser delays #endregion #region initialize Laser (virtual) var laser = new LaserVirtual(0, "virtual", 20); // virtual laser source with max 20W power (최대 출력 20W 의 가상 레이저 소스 생성) //var laser = new IPGYLP(0, "IPG YLP", 1, 20); //var laser = new JPTTypeE(0, "JPT Type E", 1, 20); //var laser = new SPIG4(0, "SPI G3/4", 1, 20); //var laser = new PhotonicsIndustryDX(0, "PI", 1, 20); //var laser = new AdvancedOptoWaveFotia(0, "Fotia", 1, 20); //var laser = new CoherentAviaLX(0, "Avia LX", 1, 20); laser.Rtc = rtc; laser.Initialize(); laser.CtlPower(2); #endregion #region create entities // 문서 생성 var doc = new DocumentDefault("Unnamed"); // 레이어 생성및 문서에 추가 var layer = new Layer("default"); // 펜 개체(Entity) 생성및 레이어에 추가 var pen = new PenDefault() { Frequency = 100 * 1000, //주파수 Hz PulseWidth = 2, //펄스폭 usec LaserOnDelay = 0, // 레이저 시작 지연 usec LaserOffDelay = 0, // 레이저 끝 지연 usec ScannerJumpDelay = 100, // 스캐너 점프 지연 usec ScannerMarkDelay = 200, // 스캐너 마크 지연 usec ScannerPolygonDelay = 0, // 스캐너 폴리곤 지연 usec JumpSpeed = 500, // 스캐너 점프 속도 mm/s MarkSpeed = 500, // 스캐너 마크 속도 mm/s }; layer.Add(pen); // 선 개체 레이어에 추가 layer.Add(new Line(0, 0, 10, 20)); // 원 개체 레이어에 추가 layer.Add(new Circle(0, 0, 10)); // 나선 개체 레이어에 추가 layer.Add(new Spiral(-20.0f, 0.0f, 0.5f, 2.0f, 5, true)); //레이어의 모든 개채들 내부 데이타 계산및 갱신 layer.Regen(); // 문서에 레이어 추가 doc.Layers.Add(layer); // 문서를 지정된 파일에 저장 DocumentSerializer.Save(doc, "test.sirius"); #endregion ConsoleKeyInfo key; do { Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("Testcase for spirallab.sirius. powered by [email protected] (http://spirallab.co.kr)"); Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("'D' : draw entities by pen"); Console.WriteLine("'Q' : quit"); Console.WriteLine($"{Environment.NewLine}"); Console.Write("select your target : "); key = Console.ReadKey(false); if (key.Key == ConsoleKey.Q) { break; } Console.WriteLine($"{Environment.NewLine}"); switch (key.Key) { case ConsoleKey.D: Console.WriteLine("WARNING !!! LASER IS BUSY ..."); var timer = Stopwatch.StartNew(); DrawForFieldCorrection(laser, rtc, doc); Console.WriteLine($"processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s"); break; } } while (true); rtc.Dispose(); }
static void Main(string[] args) { SpiralLab.Core.Initialize(); #region initialize RTC //var rtc = new RtcVirtual(0); //create Rtc for dummy var rtc = new Rtc5(0); //create Rtc5 controller //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //실험적인 상태 (Scanlab Rtc6 Ethernet 제어기) float fov = 60.0f; // scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // 스캐너 보정 파일 지정 : correction file rtc.CtlFrequency(50 * 1000, 2); // laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); // default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); // scanner and laser delays var rtcMOTF = rtc as IRtcMOTF; //엔코더 스케일 설정 rtcMOTF.EncXCountsPerMm = 67; rtcMOTF.EncYCountsPerMm = 67; #endregion #region initialize Laser (virtual) var laser = new LaserVirtual(0, "virtual", 20); // virtual laser source with max 20W power (최대 출력 20W 의 가상 레이저 소스 생성) //var laser = new IPGYLP(0, "IPG YLP", 1, 20); //var laser = new JPTTypeE(0, "JPT Type E", 1, 20); //var laser = new SPIG4(0, "SPI G3/4", 1, 20); //var laser = new PhotonicsIndustryDX(0, "PI", 1, 20); //var laser = new AdvancedOptoWaveFotia(0, "Fotia", 1, 20); //var laser = new CoherentAviaLX(0, "Avia LX", 1, 20); laser.Rtc = rtc; laser.Initialize(); laser.CtlPower(2); #endregion ConsoleKeyInfo key; do { Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("Testcase for spirallab.sirius. powered by [email protected] (http://spirallab.co.kr)"); Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("'R' : encoder reset"); Console.WriteLine("'N' : MOTF With Follow Only"); Console.WriteLine("'C' : MOTF With Circle And Wait Encoder"); Console.WriteLine("'Q' : quit"); Console.WriteLine($"{Environment.NewLine}"); Console.Write("select your target : "); key = Console.ReadKey(false); if (key.Key == ConsoleKey.Q) { break; } Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("WARNING !!! LASER IS BUSY ..."); var timer = Stopwatch.StartNew(); switch (key.Key) { case ConsoleKey.R: // X,Y 엔코더값을 0,0 으로 리셋합니다. rtcMOTF.CtlEncoderReset(); // 가상 엔코더를 100mm/s 으로 동작시킵니다. //rtcMOTF.CtlEncoderSpeed(100, 100); break; case ConsoleKey.N: MotfWithFollowOnly(laser, rtc, false); break; case ConsoleKey.C: MotfWithCircleAndWaitEncoder(laser, rtc, false); break; } Console.WriteLine($"Processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s"); } while (true); rtc.Dispose(); }
public MainForm() { InitializeComponent(); this.FormClosed += MainForm_FormClosed; SpiralLab.Core.Initialize(); // 신규 문서 생성 var doc = new DocumentDefault(); // 문서 지정 siriusEditorForm1.Document = doc; // 기본 펜 생성후 문서에 추가 var pen = new PenDefault(); doc.Action.ActEntityAdd(pen); // 내부 데이타(IDocument) 가 변경될경우 이를 이벤트 통지를 받는 핸들러 등록 siriusEditorForm1.OnDocumentSourceChanged += SiriusEditorForm1_OnDocumentSourceChanged; #region RTC 초기화 //var rtc = new RtcVirtual(0); //create Rtc for dummy var rtc = new Rtc5(0); //create Rtc5 controller //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //실험적인 상태 (Scanlab Rtc6 Ethernet 제어기) //var rtc = new Rtc6SyncAxis(0, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "syncAxis", "syncAXISConfig.xml")); //실험적인 상태 (Scanlab XLSCAN 솔류션) float fov = 60.0f; ///scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // 스캐너 보정 파일 지정 : correction file rtc.CtlFrequency(50 * 1000, 2); // laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); // default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); // scanner and laser delays #endregion this.siriusEditorForm1.Rtc = rtc; #region 레이저 소스 초기화 var laser = new LaserVirtual(0, "virtual", 20); // virtual laser source with max 20W power (최대 출력 20W 의 가상 레이저 소스 생성) //var laser = new IPGYLP(0, "IPG YLP", 1, 20); //var laser = new JPTTypeE(0, "JPT Type E", 1, 20); //var laser = new SPIG4(0, "SPI G3/4", 1, 20); //var laser = new PhotonicsIndustryDX(0, "PI", 1, 20); //var laser = new AdvancedOptoWaveFotia(0, "Fotia", 1, 20); //var laser = new CoherentAviaLX(0, "Avia LX", 1, 20); laser.Rtc = rtc; laser.Initialize(); laser.CtlPower(2); #endregion this.siriusEditorForm1.Laser = laser; #region 마커 지정 var marker = new MarkerDefault(0); #endregion this.siriusEditorForm1.Marker = marker; this.tcpClient = new SiriusTcpClient(this.siriusEditorForm1, "localhost", 9999); this.tcpClient.Start(); }
static void Main3(string[] args) { SpiralLab.Core.Initialize(); #region initialize RTC //var rtc = new RtcVirtual(0); //create Rtc for dummy (가상 RTC 카드) var rtc = new Rtc5(0); //create Rtc5 controller //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //Rtc6 Ethernet //var rtc = new Rtc6SyncAxis(0, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "syncAxis", "syncAXISConfig.xml")); //Scanlab XLSCAN float fov = 60.0f; // scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // correction file (스캐너 보정 파일) #endregion // 헤더 정보를 조회할 보정 파일 RTC 내부 메모리 (테이블)로 로드 var targetCorrectionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "D2_1128.ct5"); rtc.CtlLoadCorrectionFile(CorrectionTableIndex.Table3, targetCorrectionFile); var rtcExt = rtc as IRtcExtension; Debug.Assert(rtcExt != null); ConsoleKeyInfo key; do { Console.WriteLine("Testcase for spirallab.sirius. powered by [email protected] (http://spirallab.co.kr)"); Console.WriteLine(""); Console.WriteLine("'H' : correction file header information"); Console.WriteLine("'Q' : quit"); Console.WriteLine(""); Console.Write("select your target : "); key = Console.ReadKey(false); if (key.Key == ConsoleKey.Q) { break; } Console.WriteLine(""); switch (key.Key) { case ConsoleKey.H: rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.CorrectionTable, out double dimension); if (0 == dimension) { Console.WriteLine($"Dimension : 2D"); } else { Console.WriteLine($"Dimension : 3D"); } rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.KFactor, out double internalKFactor); Console.WriteLine($"K-Factor : {internalKFactor}"); rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.FocalLengthOrWorkingDistance, out double len); Console.WriteLine($"F-Length/Working Distance : {len}"); rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.StretchFactorX, out double stretchX); rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.StretchFactorY, out double stretchY); Console.WriteLine($"3D : Stretch Factor : X= {stretchX}, Y= {stretchY}"); rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.CoefficientA, out double coefA); rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.CoefficientB, out double coefB); rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.CoefficientC, out double coefC); Console.WriteLine($"3D : Parabolic Equation : Zout = {coefA} + l * {coefB} + l^2 * {coefC}"); rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.AngleCalibration, out double angleCalibration); Console.WriteLine($"Angle Calibration : {angleCalibration}"); rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.ImageFieldSizeLimited, out double fieldSizeLimited); if (0 == fieldSizeLimited) { Console.WriteLine($"Image Field Size : Not clipped"); } else { Console.WriteLine($"Image Field Size : Clipped"); } Console.WriteLine(Environment.NewLine); break; } } while (true); }
static void Main3(string[] args) { SpiralLab.Core.Initialize(); #region initialize RTC //var rtc = new RtcVirtual(0); //create Rtc for dummy var rtc = new Rtc5(0); //create Rtc5 controller //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //실험적인 상태 (Scanlab Rtc6 Ethernet 제어기) float fov = 60.0f; // scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // 스캐너 보정 파일 지정 : correction file rtc.CtlFrequency(50 * 1000, 2); // laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); // default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); // scanner and laser delays #endregion #region initialize Laser (virtual) var laser = new LaserVirtual(0, "virtual", 20); // virtual laser source with max 20W power (최대 출력 20W 의 가상 레이저 소스 생성) //var laser = new IPGYLP(0, "IPG YLP", 1, 20); //var laser = new JPTTypeE(0, "JPT Type E", 1, 20); //var laser = new SPIG4(0, "SPI G3/4", 1, 20); //var laser = new PhotonicsIndustryDX(0, "PI", 1, 20); //var laser = new AdvancedOptoWaveFotia(0, "Fotia", 1, 20); //var laser = new CoherentAviaLX(0, "Avia LX", 1, 20); laser.Rtc = rtc; laser.Initialize(); laser.CtlPower(2); #endregion var rtcCharSet = rtc as IRtcCharacterSet; ConsoleKeyInfo key; do { Console.WriteLine("Testcase for spirallab.sirius. powered by [email protected] (http://spirallab.co.kr)"); Console.WriteLine(""); Console.WriteLine("'D' : mark to date"); Console.WriteLine("'I' : mark to time"); Console.WriteLine("'S' : mark to serial number"); Console.WriteLine("'R' : reset serial number"); Console.WriteLine("'Q' : quit"); Console.WriteLine(""); Console.Write("select your target : "); key = Console.ReadKey(false); if (key.Key == ConsoleKey.Q) { break; } Console.WriteLine(""); var timer = Stopwatch.StartNew(); switch (key.Key) { case ConsoleKey.D: RtcCharacterSetHelper.Clear(rtc); MarkToDate(laser, rtc); break; case ConsoleKey.I: RtcCharacterSetHelper.Clear(rtc); MarkToTime(laser, rtc); break; case ConsoleKey.S: RtcCharacterSetHelper.Clear(rtc); MarkToSerial(laser, rtc); break; case ConsoleKey.R: RtcCharacterSetHelper.Clear(rtc); rtcCharSet.CtlSerialReset(1000, 1); break; } Console.WriteLine($"Processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s"); } while (true); rtc.Dispose(); }
static void Main2(string[] args) { SpiralLab.Core.Initialize(); #region initialize RTC //var rtc = new RtcVirtual(0); //create Rtc for dummy var rtc = new Rtc5(0); //create Rtc5 controller //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //실험적인 상태 (Scanlab Rtc6 Ethernet 제어기) float fov = 60.0f; // scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // 스캐너 보정 파일 지정 : correction file rtc.CtlFrequency(50 * 1000, 2); // laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); // default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); // scanner and laser delays //이미 table1 에 로드 및 선택 완료 (initialize 의 인자에서 처리됨) //var correctionFile1 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); //rtc.CtlLoadCorrectionFile(CorrectionTableIndex.Table1, correctionFile1); var correctionFile2 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.CtlLoadCorrectionFile(CorrectionTableIndex.Table2, correctionFile2); rtc.CtlSelectCorrection(CorrectionTableIndex.Table1, CorrectionTableIndex.Table2); #endregion #region initialize Laser (virtual) var laser = new LaserVirtual(0, "virtual", 20); // virtual laser source with max 20W power (최대 출력 20W 의 가상 레이저 소스 생성) //var laser = new IPGYLP(0, "IPG YLP", 1, 20); //var laser = new JPTTypeE(0, "JPT Type E", 1, 20); //var laser = new SPIG4(0, "SPI G3/4", 1, 20); //var laser = new PhotonicsIndustryDX(0, "PI", 1, 20); //var laser = new AdvancedOptoWaveFotia(0, "Fotia", 1, 20); //var laser = new CoherentAviaLX(0, "Avia LX", 1, 20); laser.Rtc = rtc; laser.Initialize(); laser.CtlPower(2); #endregion ConsoleKeyInfo key; do { Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("Testcase for spirallab.sirius. powered by [email protected] (http://spirallab.co.kr)"); Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("'D' : draw circle with dual head offset"); Console.WriteLine("'Q' : quit"); Console.WriteLine($"{Environment.NewLine}"); Console.Write("select your target : "); key = Console.ReadKey(false); if (key.Key == ConsoleKey.Q) { break; } Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("WARNING !!! LASER IS BUSY ..."); var timer = Stopwatch.StartNew(); switch (key.Key) { case ConsoleKey.D: //개별 헤드에 오프셋 및 회전 처리 var rtcDualHead = rtc as IRtcDualHead; rtcDualHead.CtlHeadOffset(ScannerHead.Primary, new Vector2(5, 0), 0); rtcDualHead.CtlHeadOffset(ScannerHead.Secondary, new Vector2(-5, 0), 0); DrawCircle(laser, rtc); // 원복 rtcDualHead.CtlHeadOffset(ScannerHead.Primary, Vector2.Zero, 0); rtcDualHead.CtlHeadOffset(ScannerHead.Secondary, Vector2.Zero, 0); break; } Console.WriteLine($"Processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s"); } while (true); rtc.Dispose(); }
static void Main(string[] args) { SpiralLab.Core.Initialize(); #region create entities //신규 문서(Document) 생성 var doc1 = new DocumentDefault("Unnamed"); // 레이어 생성 var layer = new Layer("default"); //레이어에 선 형상 개체(Entity) 생성및 추가 layer.Add(new Line(0, 10, 20, 20)); //레이어에 원 형상 개체(Entity) 생성및 추가 layer.Add(new Circle(0, 0, 10)); //레이어에 나선 형상 개체(Entity) 생성및 추가 layer.Add(new Spiral(-20.0f, 0.0f, 0.5f, 2.0f, 5, true)); // 레이어를 문서에 추가 doc1.Layers.Add(layer); #endregion Console.WriteLine("press any key to save ..."); Console.ReadKey(false); string filename = "default.sirius"; // 문서(Document) 저장하기 DocumentSerializer.Save(doc1, filename); Console.WriteLine("press any key to open ..."); Console.ReadKey(false); // 문서(Document) 불러오기 var doc2 = DocumentSerializer.OpenSirius(filename); Console.WriteLine("press any key to rtc initialize ..."); Console.ReadKey(false); #region initialize RTC //var rtc = new RtcVirtual(0); //create Rtc for dummy var rtc = new Rtc5(0, "output.txt"); //create Rtc5 controller with list commands output file //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //실험적인 상태 (Scanlab Rtc6 Ethernet 제어기) //var rtc = new Rtc6SyncAxis(0, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "syncAxis", "syncAXISConfig.xml")); //실험적인 상태 (Scanlab XLSCAN 솔류션) float fov = 60.0f; // scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // 스캐너 보정 파일 지정 : correction file rtc.CtlFrequency(50 * 1000, 2); // laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); // default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); // scanner and laser delays #endregion #region initialize Laser (virtual) var laser = new LaserVirtual(0, "virtual", 20); // virtual laser source with max 20W power (최대 출력 20W 의 가상 레이저 소스 생성) //var laser = new IPGYLP(0, "IPG YLP", 1, 20); //var laser = new JPTTypeE(0, "JPT Type E", 1, 20); //var laser = new SPIG4(0, "SPI G3/4", 1, 20); //var laser = new PhotonicsIndustryDX(0, "PI", 1, 20); //var laser = new AdvancedOptoWaveFotia(0, "Fotia", 1, 20); //var laser = new CoherentAviaLX(0, "Avia LX", 1, 20); laser.Rtc = rtc; laser.Initialize(); laser.CtlPower(2); #endregion Console.WriteLine("press any key to laser processing ...WARNING !!! LASER EMISSION"); Console.ReadKey(false); DoBegin(laser, rtc, doc2); Console.WriteLine("press any key to terminate program"); Console.ReadKey(false); }
static void Main(string[] args) { SpiralLab.Core.Initialize(); //initializing spirallab.sirius library engine (시리우스 라이브러리 초기화) #region initialize RTC //var rtc = new RtcVirtual(0); //create Rtc for dummy (가상 RTC 카드) var rtc = new Rtc5(0); //create Rtc5 controller //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //Rtc6 Ethernet //var rtc = new Rtc6SyncAxis(0, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "syncAxis", "syncAXISConfig.xml")); //Scanlab XLSCAN float fov = 60.0f; // scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // correction file (스캐너 보정 파일) #endregion #region initialize Laser (virtual) var laser = new LaserVirtual(0, "virtual", 20); // virtual laser source with max 20W power (최대 출력 20W 의 가상 레이저 소스 생성) //var laser = new IPGYLP(0, "IPG YLP", 1, 20); //var laser = new JPTTypeE(0, "JPT Type E", 1, 20); //var laser = new SPIG4(0, "SPI G3/4", 1, 20); //var laser = new PhotonicsIndustryDX(0, "PI", 1, 20); //var laser = new AdvancedOptoWaveFotia(0, "Fotia", 1, 20); //var laser = new CoherentAviaLX(0, "Avia LX", 1, 20); laser.Rtc = rtc; laser.Initialize(); laser.CtlPower(2); #endregion ConsoleKeyInfo key; do { Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("Testcase for spirallab.sirius. powered by [email protected] (http://spirallab.co.kr)"); Console.WriteLine($"----------------------------------------------------------------------------------------"); Console.WriteLine("'C' : draw circle with measurement"); Console.WriteLine("'R' : draw rectangle with measurement"); Console.WriteLine("'O' : open and plot measurement file"); Console.WriteLine("'Q' : quit"); Console.Write("Select your target : "); key = Console.ReadKey(false); Console.WriteLine($"{Environment.NewLine}"); if (key.Key == ConsoleKey.Q) { break; } switch (key.Key) { case ConsoleKey.C: // draw circle (원 모양 가공) DrawCircle(laser, rtc, 10); break; case ConsoleKey.R: // draw rectangle (사각형 모양 가공) DrawRectangle(laser, rtc, 10, 10); break; case ConsoleKey.O: // open file var dlg = new OpenFileDialog(); dlg.Filter = "measurement data files (*.txt)|*.txt|All Files (*.*)|*.*"; dlg.Title = "Open Measurement File"; dlg.InitialDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plot"); DialogResult result = dlg.ShowDialog(); if (result != DialogResult.OK) { return; } MeasurementHelper.Plot(dlg.FileName); break; } } while (true); if (rtc.CtlGetStatus(RtcStatus.Busy)) { rtc.CtlAbort(); rtc.CtlBusyWait(); } rtc.Dispose(); }
static void Main(string[] args) { SpiralLab.Core.Initialize(); #region initialize RTC //var rtc = new RtcVirtual(0); //create Rtc for dummy var rtc = new Rtc5(0); //create Rtc5 controller //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //실험적인 상태 (Scanlab Rtc6 Ethernet 제어기) //var rtc = new Rtc6SyncAxis(0, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "syncAxis", "syncAXISConfig.xml")); //실험적인 상태 (Scanlab XLSCAN 솔류션) float fov = 60.0f; // scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // 스캐너 보정 파일 지정 : correction file //signal level : if active low //var ctrlSignal = new Rtc5LaserControlSignal(); //ctrlSignal.Add(Rtc5LaserControlSignal.Bit.Laser12SignalLevelLow); //ctrlSignal.Add(Rtc5LaserControlSignal.Bit.LaserOnSignalLevelLow); //rtc.CtlLaserSignalLevel(ctrlSignal); rtc.CtlFrequency(50 * 1000, 2); // laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); // default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); // scanner and laser delays #endregion #region initialize Laser (virtual) var laser = new LaserVirtual(0, "virtual", 20); // virtual laser source with max 20W power (최대 출력 20W 의 가상 레이저 소스 생성) //var laser = new IPGYLP(0, "IPG YLP", 1, 20); //var laser = new JPTTypeE(0, "JPT Type E", 1, 20); //var laser = new SPIG4(0, "SPI G3/4", 1, 20); //var laser = new PhotonicsIndustryDX(0, "PI", 1, 20); //var laser = new AdvancedOptoWaveFotia(0, "Fotia", 1, 20); //var laser = new CoherentAviaLX(0, "Avia LX", 1, 20); laser.Rtc = rtc; laser.Initialize(); laser.CtlPower(2); #endregion ConsoleKeyInfo key; do { Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("Testcase for spirallab.sirius. powered by [email protected] (http://spirallab.co.kr)"); Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("'R' : draw rectangle with rotate"); Console.WriteLine("'L' : draw lines with rotate"); Console.WriteLine("'F' : pop up laser source form"); Console.WriteLine("'Q' : quit"); Console.WriteLine(""); Console.Write("select your target : "); key = Console.ReadKey(false); if (key.Key == ConsoleKey.Q) { break; } Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("WARNING !!! LASER IS BUSY ..."); Console.WriteLine($"{Environment.NewLine}"); var timer = Stopwatch.StartNew(); switch (key.Key) { case ConsoleKey.R: // 회전하는 사각형 모양 가공 (가로 10, 세로 10 크기, 0 ~360 각도의 회전 형상) DrawRectangle(laser, rtc, 10, 10, 0, 360); break; case ConsoleKey.L: //회전하는 직선 모양 가공 DrawLinesWithRotate(laser, rtc, 0, 360); break; case ConsoleKey.F: SpiralLab.Sirius.Laser.LaserForm laerForm = new SpiralLab.Sirius.Laser.LaserForm(); laerForm.Laser = laser; laerForm.ShowDialog(); break; } Console.WriteLine($"Processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s"); } while (true); rtc.Dispose(); }
static void Main(string[] args) { SpiralLab.Core.Initialize(); #region initialize RTC //var rtc = new RtcVirtual(0); //create Rtc for dummy var rtc = new Rtc5(0); //create Rtc5 controller //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //실험적인 상태 (Scanlab Rtc6 Ethernet 제어기) //var rtc = new Rtc6SyncAxis(0, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "syncAxis", "syncAXISConfig.xml")); //실험적인 상태 (Scanlab XLSCAN 솔류션) float fov = 60.0f; /// scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; /// k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); ///default correction file rtc.CtlFrequency(50 * 1000, 2); ///laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); /// default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); ///scanner and laser delays #endregion #region initialize Laser source //var laser = new LaserVirtual(0, "Virtual", 20); var laser = new IPGYLPTypeD(0, "IPG YLP Type D", 1, 20); //var laser = new JPTTypeE(0, "JPT Type E", 1, 20); //var laser = new SPIG4(0, "SPI G3/4", 1, 20); //var laser = new PhotonicsIndustryDX(0, "PI", 1, 20); //var laser = new AdvancedOptoWaveFotia(0, "Fotia", 1, 20); //var laser = new CoherentAviaLX(0, "Avia LX", 1, 20); //var laser = new YourCustomLaser(0, "custom laser", 20.0f); //var laser = new YourCustomLaser2(0, "custom laser", 20.0f, 1); laser.Rtc = rtc; laser.Initialize(); laser.CtlPower(10); #endregion #region motor z axis IMotor motorZ = new MotorZ(); motorZ.Initialize(); motorZ.CtlHomeSearch(); #endregion #region prepare your marker // 사용자 정의 마커 생성 var marker = new YourCustomMarker(0); marker.Name = "custom marker"; //가공 완료 이벤트 핸들러 등록 marker.OnFinished += Marker_OnFinished; #endregion ConsoleKeyInfo key; do { Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("Testcase for spirallab.sirius. powered by [email protected] (http://spirallab.co.kr)"); Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("'M' : mark by your custom marker"); Console.WriteLine("'F' : laser form"); Console.WriteLine("'Q' : quit"); Console.WriteLine($"{Environment.NewLine}"); Console.Write("select your target : "); key = Console.ReadKey(false); if (key.Key == ConsoleKey.Q) { break; } Console.WriteLine($"{Environment.NewLine}"); switch (key.Key) { case ConsoleKey.M: Console.WriteLine("WARNING !!! LASER IS BUSY ..."); DrawByMarker(rtc, laser, marker, motorZ); break; case ConsoleKey.F: SpiralLab.Sirius.Laser.LaserForm laerForm = new SpiralLab.Sirius.Laser.LaserForm(); laerForm.Laser = laser; laerForm.ShowDialog(); break; } } while (true); rtc.Dispose(); }
static void Main(string[] args) { SpiralLab.Core.Initialize(); #region initialize RTC //var rtc = new RtcVirtual(0); //create Rtc for dummy var rtc = new Rtc5(0); //create Rtc5 controller //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //실험적인 상태 (Scanlab Rtc6 Ethernet 제어기) //var rtc = new Rtc6SyncAxis(0, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "syncAxis", "syncAXISConfig.xml")); //실험적인 상태 (Scanlab XLSCAN 솔류션) float fov = 60.0f; // scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // 스캐너 보정 파일 지정 : correction file rtc.CtlFrequency(50 * 1000, 2); // laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); // default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); // scanner and laser delays #endregion #region initialize Laser (virtual) var laser = new LaserVirtual(0, "virtual", 20); // virtual laser source with max 20W power (최대 출력 20W 의 가상 레이저 소스 생성) //var laser = new IPGYLP(0, "IPG YLP", 1, 20); //var laser = new JPTTypeE(0, "JPT Type E", 1, 20); //var laser = new SPIG4(0, "SPI G3/4", 1, 20); //var laser = new PhotonicsIndustryDX(0, "PI", 1, 20); //var laser = new AdvancedOptoWaveFotia(0, "Fotia", 1, 20); //var laser = new CoherentAviaLX(0, "Avia LX", 1, 20); laser.Rtc = rtc; laser.Initialize(); laser.CtlPower(2); #endregion ConsoleKeyInfo key; do { Console.WriteLine("Testcase for spirallab.sirius. powered by [email protected] (http://spirallab.co.kr)"); Console.WriteLine(""); Console.WriteLine("'S' : get status"); Console.WriteLine("'A' : 지령 속도(Set Velocity) 기반 레이저 신호 (아나로그) 제어"); Console.WriteLine("'B' : 위치 의존적(Position Dependent) + 지령 속도(Set Velocity) 기반 레이저 신호 (아나로그 ~10V) 제어"); Console.WriteLine("'C' : 실제 속도(Actual Velocity) 기반 레이저 신호 (주파수 변조) 제어"); Console.WriteLine("'D' : 벡터 위치(Vector Defined) 기반 레이저 신호(아나로그) 제어"); Console.WriteLine("'Q' : quit"); Console.WriteLine(""); Console.Write("select your target : "); key = Console.ReadKey(false); Console.WriteLine(""); if (key.Key == ConsoleKey.Q) { break; } var timer = Stopwatch.StartNew(); switch (key.Key) { case ConsoleKey.S: //RTC의 상태 확인 if (rtc.CtlGetStatus(RtcStatus.Busy)) { Console.WriteLine($"\r\nRtc is busy!"); } else if (!rtc.CtlGetStatus(RtcStatus.PowerOK)) { Console.WriteLine($"\r\nScanner power is not ok"); } else if (!rtc.CtlGetStatus(RtcStatus.PositionAckOK)) { Console.WriteLine($"\r\nScanner position is not acked"); } else if (!rtc.CtlGetStatus(RtcStatus.NoError)) { Console.WriteLine($"\r\nRtc status has an error"); } else { Console.WriteLine($"\r\nIt's okay"); } break; case ConsoleKey.A: Console.WriteLine("\r\nWARNING !!! LASER IS BUSY ..."); DrawLine1(laser, rtc, -10, -10, 10, 10); break; case ConsoleKey.B: Console.WriteLine("\r\nWARNING !!! LASER IS BUSY ..."); DrawLine2(laser, rtc, -10, -10, 10, 10); break; case ConsoleKey.C: Console.WriteLine("\r\nWARNING !!! LASER IS BUSY ..."); DrawLine3(laser, rtc, -10, -10, 10, 10); break; case ConsoleKey.D: Console.WriteLine("\r\nWARNING !!! LASER IS BUSY ..."); DrawLine4(laser, rtc, -10, -10, 10, 10); break; } Console.WriteLine($"Processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s"); } while (true); rtc.Dispose(); }
static void Main(string[] args) { SpiralLab.Core.Initialize(); //initializing spirallab.sirius library engine (시리우스 라이브러리 초기화) #region initialize RTC //var rtc = new RtcVirtual(0); //create Rtc for dummy (가상 RTC 카드) var rtc = new Rtc5(0); //create Rtc5 controller //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //Rtc6 Ethernet //var rtc = new Rtc6SyncAxis(0, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "syncAxis", "syncAXISConfig.xml")); //Scanlab XLSCAN float fov = 60.0f; // scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // correction file (스캐너 보정 파일) rtc.CtlFrequency(50 * 1000, 2); // laser frequency : 50KHz, pulse width : 2usec (주파수 50KHz, 펄스폭 2usec) rtc.CtlSpeed(500, 500); // jump and mark speed : 500mm/s (점프, 마크 속도 500mm/s) rtc.CtlDelay(10, 100, 200, 200, 0); // scanner and laser delays (스캐너/레이저 지연값 설정) #endregion #region initialize Laser (virtual) var laser = new LaserVirtual(0, "virtual", 20); // virtual laser source with max 20W power (최대 출력 20W 의 가상 레이저 소스 생성) //var laser = new IPGYLP(0, "IPG YLP", 1, 20); //var laser = new JPTTypeE(0, "JPT Type E", 1, 20); //var laser = new SPIG4(0, "SPI G3/4", 1, 20); //var laser = new PhotonicsIndustryDX(0, "PI", 1, 20); //var laser = new AdvancedOptoWaveFotia(0, "Fotia", 1, 20); //var laser = new CoherentAviaLX(0, "Avia LX", 1, 20); laser.Rtc = rtc; laser.Initialize(); laser.CtlPower(2); #endregion ConsoleKeyInfo key; do { Console.WriteLine($"{Environment.NewLine}"); Console.WriteLine("Testcase for spirallab.sirius. powered by [email protected] (http://spirallab.co.kr)"); Console.WriteLine($"----------------------------------------------------------------------------------------"); Console.WriteLine("'S' : get status"); Console.WriteLine("'L' : draw line"); Console.WriteLine("'C' : draw circle"); Console.WriteLine("'R' : draw rectangle"); Console.WriteLine("'D' : draw circle with dots"); Console.WriteLine("'P' : draw square area with pixel operation"); Console.WriteLine("'H' : draw heavy and slow job with thread"); Console.WriteLine("'A' : abort to mark and finish the thread"); Console.WriteLine("'F' : pop up laser source form"); Console.WriteLine("'Q' : quit"); Console.Write("Select your target : "); key = Console.ReadKey(false); Console.WriteLine($"{Environment.NewLine}"); if (key.Key == ConsoleKey.Q) { break; } switch (key.Key) { case ConsoleKey.S: //RTC's status (상태 확인) if (rtc.CtlGetStatus(RtcStatus.Busy)) { Console.WriteLine($"Rtc is busy!"); } if (!rtc.CtlGetStatus(RtcStatus.PowerOK)) { Console.WriteLine($"Scanner power is not ok"); } if (!rtc.CtlGetStatus(RtcStatus.PositionAckOK)) { Console.WriteLine($"Scanner position is not acked"); } if (!rtc.CtlGetStatus(RtcStatus.NoError)) { Console.WriteLine($"Rtc status has an error"); } break; case ConsoleKey.L: // draw line (선 모양 가공) DrawLine(laser, rtc, -10, -10, 10, 10); break; case ConsoleKey.C: // draw circle (원 모양 가공) DrawCircle(laser, rtc, 10); break; case ConsoleKey.R: // draw rectangle (사각형 모양 가공) DrawRectangle(laser, rtc, 10, 10); break; case ConsoleKey.D: // draw dotted circle (점으로 이루어진 원 모양 가공) DrawCircleWithDots(laser, rtc, 10, 1.0f); break; case ConsoleKey.P: // draw filled rectangle with raster (사각 영역을 픽셀(Raster)로 채우기 DrawSquareAreaWithPixels(laser, rtc, 10, 0.2f); break; case ConsoleKey.H: // draw with heavy works (시간이 오래 걸리는 모양을 가공 -별도 가공 쓰레드 생성하여 처리) DrawTooHeavyAndSlowJob(laser, rtc); break; case ConsoleKey.A: // abort operation (강제 가공 중지) StopMarkAndReset(laser, rtc); break; case ConsoleKey.F: SpiralLab.Sirius.Laser.LaserForm laerForm = new SpiralLab.Sirius.Laser.LaserForm(); laerForm.Laser = laser; laerForm.ShowDialog(); break; } } while (true); if (rtc.CtlGetStatus(RtcStatus.Busy)) { rtc.CtlAbort(); rtc.CtlBusyWait(); } rtc.Dispose(); }