/// <summary> /// 내부 리스트 메모리에 등록된 폰트를 이용한 시리얼 번호 /// </summary> /// <param name="laser"></param> /// <param name="rtc"></param> private static bool MarkToSerial(ILaser laser, IRtc rtc) { if (rtc.CtlGetStatus(RtcStatus.Busy)) { return(false); } bool success = true; var rtcCharSet = rtc as IRtcCharacterSet; //초기값: 1000, 증가값: 1 rtcCharSet.CtlSerialReset(1000, 1); success &= rtc.ListBegin(laser, ListType.Single); success &= rtc.ListJump(new Vector2(-10, -20)); success &= rtcCharSet.ListSerial(4, SerialFormat.LeadingWithZero); success &= rtc.ListJump(new Vector2(-10, 0)); success &= rtcCharSet.ListSerial(4, SerialFormat.LeadingWithZero); success &= rtc.ListJump(new Vector2(-10, 20)); success &= rtcCharSet.ListSerial(4, SerialFormat.LeadingWithZero); if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(); } return(success); }
/// <summary> /// draw cicle with dots /// </summary> /// <param name="laser"></param> /// <param name="rtc"></param> /// <param name="radius"></param> /// <param name="durationMsec"></param> private static bool DrawCircleWithDots(ILaser laser, IRtc rtc, float radius, float durationMsec) { if (rtc.CtlGetStatus(RtcStatus.Busy)) { return(false); } Console.WriteLine("WARNING !!! LASER IS BUSY ... DrawCircleWithDots"); timer = Stopwatch.StartNew(); bool success = true; success &= rtc.ListBegin(laser); for (float angle = 0; angle < 360; angle += 1) { double x = radius * Math.Sin(angle * Math.PI / 180.0); double y = radius * Math.Cos(angle * Math.PI / 180.0); success &= rtc.ListJump(new Vector2((float)x, (float)y)); //laser signal on during specific time (지정된 짧은 시간동안 레이저 출사) success &= rtc.ListLaserOn(durationMsec); if (!success) { break; } } success &= rtc.ListEnd(); if (success) { success &= rtc.ListExecute(true); } Console.WriteLine($"Processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s"); return(success); }
private static void DrawTooHeavyAndSlowJob(ILaser laser, IRtc rtc) { if (rtc.CtlGetStatus(RtcStatus.Busy)) { Console.WriteLine("Processing are working already !"); return; } Program.laser = laser; Program.rtc = rtc; Program.thread = new Thread(DoHeavyWork); //create new thread Program.thread.Start(); }
/// <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); }
/// <summary> /// draw square area with pixels /// </summary> /// <param name="laser"></param> /// <param name="rtc"></param> /// <param name="length"></param> /// <param name="gap"></param> private static bool DrawSquareAreaWithPixels(ILaser laser, IRtc rtc, float length, float gap) { if (rtc.CtlGetStatus(RtcStatus.Busy)) { return(false); } Console.WriteLine("WARNING !!! LASER IS BUSY ... DrawSquareAreaWithPixels"); timer = Stopwatch.StartNew(); // pixel operation 은 IRtcExtension 인터페이스에서 제공 var rtcExt = rtc as IRtcExtension; if (null == rtcExt) { return(false); } int counts = (int)(length / gap); float period = 200; //200 usec var delta = new Vector2(gap, 0); bool success = true; success &= rtc.ListBegin(laser); for (int i = 0; i < counts; i++) { //jumtp to start position (줄의 시작위치로 점프) success &= rtc.ListJump(new Vector2(0, i * gap)); // pixel period : 200us, intervael : gap, total pixel counts, output analog channel : analog 2 success &= rtcExt.ListPixelLine(period, delta, (uint)counts, ExtensionChannel.ExtAO2); for (int j = 0; j < counts; j++) { success &= rtcExt.ListPixel(50, 0.5f); // each pixel with 50usec, 5V } if (!success) { break; } } success &= rtc.ListEnd(); if (success) { success &= rtc.ListExecute(true); } Console.WriteLine($"Processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s"); return(success); }
private static bool MarkToDate(ILaser laser, IRtc rtc) { if (rtc.CtlGetStatus(RtcStatus.Busy)) { return(false); } date.FontName = "normal.cxf"; date.Width = 3.0f; date.CapHeight = 3.0f; date.LetterSpacing = 0.2f; date.WordSpacing = 2.0f; date.Align = Alignment.LeftMiddle; date.LetterSpace = LetterSpaceWay.Fixed; date.Location = Vector2.Zero; date.DateFormat = DateFormat.Day; date.IsLeadingWithZero = true; date.Angle = 90; date.Location = new Vector2(0, 10); //data 생성 date.Regen(); date.RegisterCharacterSetIntoRtc(rtc); bool success = true; var rtcCharSet = rtc as IRtcCharacterSet; success &= rtc.ListBegin(laser, ListType.Single); success &= rtc.ListJump(Vector2.Zero); var markerArg = new MarkerArgDefault() { Rtc = rtc, Laser = laser, }; success &= date.Mark(markerArg); success &= rtc.ListJump(new Vector2(10, 0)); if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(false); } return(success); }
/// <summary> /// 내부 리스트 메모리에 등록된 폰트를 이용한 텍스트 마킹 /// </summary> /// <param name="laser"></param> /// <param name="rtc"></param> private static bool MarkToText(ILaser laser, IRtc rtc) { if (rtc.CtlGetStatus(RtcStatus.Busy)) { return(false); } bool success = true; var rtcCharSet = rtc as IRtcCharacterSet; success &= rtc.ListBegin(laser, ListType.Single); success &= rtc.ListJump(new Vector2(-10, 0)); success &= rtcCharSet.ListText("123 456"); if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(); } return(success); }
private static bool MarkToSerial(ILaser laser, IRtc rtc) { if (rtc.CtlGetStatus(RtcStatus.Busy)) { return(false); } serial.FontName = "normal.cxf"; serial.Width = 2.0f; serial.CapHeight = 2.0f; serial.LetterSpacing = 0.2f; serial.WordSpacing = 2.0f; serial.Align = Alignment.LeftMiddle; serial.LetterSpace = LetterSpaceWay.Fixed; serial.Location = Vector2.Zero; serial.NumOfDigits = 4; serial.SerialFormat = SerialFormat.LeadingWithZero; serial.Angle = -90; serial.Location = new Vector2(0, 10); //data 생성 serial.Regen(); serial.RegisterCharacterSetIntoRtc(rtc); bool success = true; var rtcCharSet = rtc as IRtcCharacterSet; success &= rtc.ListBegin(laser, ListType.Single); success &= rtc.ListJump(new Vector2(0, 0)); var markerArg = new MarkerArgDefault() { Rtc = rtc, Laser = laser, }; success &= serial.Mark(markerArg); if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(false); } return(success); }
/// <summary> /// 내부 리스트 메모리에 등록된 폰트를 이용한 날짜 마킹 /// </summary> /// <param name="laser"></param> /// <param name="rtc"></param> private static bool MarkToDate(ILaser laser, IRtc rtc) { if (rtc.CtlGetStatus(RtcStatus.Busy)) { return(false); } bool success = true; var rtcCharSet = rtc as IRtcCharacterSet; success &= rtc.ListBegin(laser, ListType.Single); success &= rtc.ListJump(new Vector2(-10, 0)); success &= rtcCharSet.ListDate(DateFormat.MonthDigit, true); success &= rtc.ListJump(new Vector2(10, 0)); success &= rtcCharSet.ListDate(DateFormat.Day, true); if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(); } return(success); }
/// <summary> /// draw line /// </summary> /// <param name="laser"></param> /// <param name="rtc"></param> /// <param name="x1"></param> /// <param name="y1"></param> /// <param name="x2"></param> /// <param name="y2"></param> private static bool DrawLine(ILaser laser, IRtc rtc, float x1, float y1, float x2, float y2) { if (rtc.CtlGetStatus(RtcStatus.Busy)) { return(false); } Console.WriteLine("WARNING !!! LASER IS BUSY ... DrawLine"); timer = Stopwatch.StartNew(); bool success = true; success &= rtc.ListBegin(laser); success &= rtc.ListJump(new Vector2(x1, y1)); success &= rtc.ListMark(new Vector2(x2, y2)); success &= rtc.ListEnd(); if (success) { success &= rtc.ListExecute(true); } Console.WriteLine($"Processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s"); return(success); }
private static bool MarkToTime(ILaser laser, IRtc rtc) { if (rtc.CtlGetStatus(RtcStatus.Busy)) { return(false); } time.FontName = "Daum_Regular.ttf"; time.Width = 2.0f; time.CapHeight = 3.0f; time.Align = Alignment.LeftMiddle; time.Location = Vector2.Zero; time.TimeFormat = TimeFormat.Minutes; time.IsLeadingWithZero = true; time.Angle = 180; time.Location = new Vector2(0, 10); //data 생성 time.Regen(); time.RegisterCharacterSetIntoRtc(rtc); bool success = true; var rtcCharSet = rtc as IRtcCharacterSet; success &= rtc.ListBegin(laser, ListType.Single); success &= rtc.ListJump(Vector2.Zero); var markerArg = new MarkerArgDefault() { Rtc = rtc, Laser = laser, }; success &= time.Mark(markerArg); if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(false); } return(success); }
/// <summary> /// 내부 리스트 메모리에 등록된 폰트를 이용한 시간 마킹 /// </summary> /// <param name="laser"></param> /// <param name="rtc"></param> private static bool MarkToTime(ILaser laser, IRtc rtc) { if (rtc.CtlGetStatus(RtcStatus.Busy)) { return(false); } bool success = true; var rtcCharSet = rtc as IRtcCharacterSet; success &= rtc.ListBegin(laser, ListType.Single); success &= rtc.ListJump(new Vector2(-10, 0)); success &= rtcCharSet.ListTime(TimeFormat.Hours24, true); success &= rtc.ListJump(new Vector2(10, 0)); success &= rtcCharSet.ListTime(TimeFormat.Minutes, true); success &= rtc.ListJump(new Vector2(30, 0)); success &= rtcCharSet.ListTime(TimeFormat.Seconds, true); if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(); } return(success); }