Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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();
        }