Пример #1
0
        /// <summary>
        /// laser processing
        /// </summary>
        /// <param name="rtc"></param>
        /// <returns></returns>
        public override bool Mark(IRtc rtc)
        {
            bool success = true;

            success &= rtc.ListSpeed(this.JumpSpeed, this.MarkSpeed);
            success &= rtc.ListFrequency(this.Frequency, this.PulseWidth);
            success &= rtc.ListDelay(this.LaserOnDelay, this.LaserOffDelay, this.ScannerJumpDelay, this.ScannerMarkDelay, this.ScannerPolygonDelay);
            return(success);
        }
Пример #2
0
        /// <summary>
        /// draw rectangle
        /// </summary>
        /// <param name="laser"></param>
        /// <param name="rtc"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        private static bool DrawRectangle(ILaser laser, IRtc rtc, float width, float height)
        {
            if (rtc.CtlGetStatus(RtcStatus.Busy))
            {
                return(false);
            }
            var rtcMeasurement = rtc as IRtcMeasurement;

            Debug.Assert(rtcMeasurement != null);
            Console.WriteLine("WARNING !!! LASER IS BUSY ... Draw Rectangle");
            timer = Stopwatch.StartNew();
            MeasurementChannel[] channels = new MeasurementChannel[4]
            {
                MeasurementChannel.SampleX,      //X
                MeasurementChannel.SampleY,      //Y
                MeasurementChannel.LaserOn,      //Gate
                MeasurementChannel.OutputPeriod, //KHz
            };
            float hz      = 10000;               //10 KHz
            bool  success = true;

            success &= rtc.ListBegin(laser);
            success &= rtcMeasurement.ListMeasurementBegin(hz, channels); //10 Khz, 4개 채널
            success &= rtc.ListFrequency(50 * 1000, 2);                   // 주파수 50KHz, 펄스폭 2usec
            success &= rtc.ListSpeed(500, 500);                           // 점프, 마크 속도 500mm/s
            success &= rtc.ListDelay(10, 100, 200, 200, 0);               // 스캐너/레이저 지연값
            success &= rtc.ListJump(new Vector2(-width / 2, height / 2));
            success &= rtc.ListMark(new Vector2(width / 2, height / 2));
            success &= rtc.ListMark(new Vector2(width / 2, -height / 2));
            success &= rtc.ListMark(new Vector2(-width / 2, -height / 2));
            success &= rtc.ListMark(new Vector2(-width / 2, height / 2));
            success &= rtcMeasurement.ListMeasurementEnd();
            success &= rtc.ListEnd();
            if (success)
            {
                success &= rtc.ListExecute(true);
            }
            var measurementFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plot", "measurement_rectangle.txt");

            success &= MeasurementHelper.Save(measurementFile, rtcMeasurement, hz, channels, false);
            if (success)
            {
                Console.WriteLine($"Processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s. plot to file = {measurementFile}");
            }

            return(success);
        }