/// <summary> /// 레이어 안에 있는 모든 객체들을 마킹하기 /// </summary> /// <param name="laser"></param> /// <param name="rtc"></param> /// <param name="doc"></param> private static bool Draw(ILaser laser, IRtc rtc, IDocument doc) { var markerArg = new MarkerArgDefault() { Document = doc, Rtc = rtc, Laser = laser, }; bool success = true; success &= rtc.ListBegin(laser); foreach (var layer in doc.Layers) { success &= layer.Mark(markerArg); // or //foreach (var entity in layer) //{ // var markerable = entity as IMarkerable; // if (null != markerable) // success &= markerable.Mark(markerArg); //} if (!success) { break; } } if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(true); } return(success); }
/// <summary> /// 직선으로 원 그리기 /// </summary> /// <param name="rtc"></param> /// <param name="radius"></param> /// <param name="durationMsec"></param> private static void DrawCircleWithLines(ILaser laser, IRtc rtc, float radius) { ///스테이지의 원점은 통상 0,0 이기 때문에 - 영역에서는 모션구동이 불가능하므로 ///+ 영역에서 처리되도록 안전한 위치로 이동하는 코드 rtc.MatrixStack.Push(radius * 2f, radius * 2f);///transit safety area /// 스테이지 + 스캐너 동시 구동하여 원 그리기 rtc.ListBegin(laser, MotionType.StageAndScanner); double x = radius * Math.Sin(0 * Math.PI / 180.0); double y = radius * Math.Cos(0 * Math.PI / 180.0); rtc.ListJump(new Vector2((float)x, (float)y)); for (float angle = 10; angle < 360; angle += 10) { x = radius * Math.Sin(angle * Math.PI / 180.0); y = radius * Math.Cos(angle * Math.PI / 180.0); rtc.ListMark(new Vector2((float)x, (float)y)); } x = radius * Math.Sin(0 * Math.PI / 180.0); y = radius * Math.Cos(0 * Math.PI / 180.0); rtc.ListMark(new Vector2((float)x, (float)y)); rtc.ListEnd(); rtc.ListExecute(true); rtc.MatrixStack.Pop(); }
/// <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> /// 선 그리기 = 실제 속도 기반 레이저 신호 (주파수 변조) 제어 /// iDRIVE 기반 스캐너 필요 /// 가공 출력 조건 = 50KHz (최소 40KHz, 최대 60KHz) /// </summary> private static bool DrawLine3(ILaser laser, IRtc rtc, float x1, float y1, float x2, float y2) { var alc = rtc as IRtcAutoLaserControl; if (null == alc) { return(false); } bool success = true; alc.AutoLaserControlByPositionFileName = string.Empty; //target frequency : 100KHz //lower cut off frequency : 50KHz //upper cut off frequency : 120KHz success &= alc.CtlAutoLaserControl <float>(AutoLaserControlSignal.Frequency, AutoLaserControlMode.ActualVelocity, 50 * 1000, 40 * 1000, 60 * 1000); success &= rtc.ListBegin(laser); success &= rtc.ListJump(new Vector2(x1, y1)); success &= rtc.ListMark(new Vector2(x2, y2)); if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(true); } 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); }
static void DoBegin(ILaser laser, IRtc rtc, IDocument doc) { var timer = new Stopwatch(); bool success = true; rtc.ListBegin(laser); foreach (var layer in doc.Layers) { foreach (var entity in layer) { var markerable = entity as IMarkerable; if (null != markerable) { success &= markerable.Mark(rtc); } if (!success) { break; } } if (!success) { break; } } if (success) { rtc.ListEnd(); rtc.ListExecute(true); } Console.WriteLine($"processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s"); }
/// <summary> /// 지정된 문서(Document)를 지정된 RTC 제어기로 가공하기 /// </summary> /// <param name="laser"></param> /// <param name="rtc"></param> /// <param name="doc"></param> static void DoBegin(ILaser laser, IRtc rtc, IDocument doc) { var timer = Stopwatch.StartNew(); bool success = true; rtc.ListBegin(laser); ///레이어를 순회 foreach (var layer in doc.Layers) { ///레이어 내의 개체(Entity)들을 순회 foreach (var entity in layer) { var markerable = entity as IMarkerable; ///레이저 가공이 가능한 개체(markerable)인지를 판단 if (null != markerable) { success &= markerable.Mark(rtc); /// 해당 개체(Entity) 가공 } if (!success) { break; } } if (!success) { break; } } if (success) { rtc.ListEnd(); rtc.ListExecute(true); } Console.WriteLine($"processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s"); }
private static bool DrawCircle(ILaser laser, IRtc rtc) { bool success = true; var rtcDualHead = rtc as IRtcDualHead; //리스트 시작 success &= rtc.ListBegin(laser); //리스트 명령으로 오프셋 및 회전 처리 방법 //rtcDualHead.ListHeadOffset(ScannerHead.Primary, new Vector2(5, 0), 0); //rtcDualHead.ListHeadOffset(ScannerHead.Secondary, new Vector2(-5, 0), 0); for (int i = 0; i < 10; i++) { //직선을 그립니다. success &= rtc.ListJump(new Vector2(0, 0)); success &= rtc.ListMark(new Vector2(10, 0)); success &= rtc.ListJump(new Vector2((float)10, 0)); success &= rtc.ListArc(new Vector2(0, 0), 360.0f); if (!success) { break; } } //리스트 명령으로 오프셋 및 회전 처리 방법 //rtcDualHead.ListHeadOffset(ScannerHead.Primary, Vector2.Zero, 0); //rtcDualHead.ListHeadOffset(ScannerHead.Secondary, Vector2.Zero, 0); //리스트 종료 if (success) { success &= rtc.ListEnd(); //나머지 데이타 가공 완료 대기 success &= rtc.ListExecute(true); } return(success); }
private static void DrawCircle(ILaser laser, IRtc rtc, double radius) { rtc.ListBegin(laser); rtc.ListJump(new Vector2((float)radius, 0)); rtc.ListArc(new Vector2(0, 0), 360.0f); rtc.ListEnd(); rtc.ListExecute(true); }
/// <summary> /// 지정된 반지름을 갖는 원 그리기 /// </summary> /// <param name="rtc"></param> /// <param name="radius"></param> private static void DrawCircle(ILaser laser, IRtc rtc, double radius) { /// 스캐너만 구동하여 원 그리기 rtc.ListBegin(laser, MotionType.ScannerOnly); rtc.ListJump(new Vector2((float)radius, 0)); rtc.ListArc(new Vector2(0, 0), 360.0f); rtc.ListEnd(); rtc.ListExecute(true); }
private static void DrawCircleWith3D(ILaser laser, IRtc rtc, IRtc3D rtc3D) { rtc.ListBegin(laser); //draw circle in z = +1 mm rtc3D.ListJump3D(new Vector3((float)10, 0, 1)); rtc3D.ListArc3D(new Vector3(0, 0, 1), 360.0f); rtc.ListEnd(); rtc.ListExecute(); }
private static void DrawRectangle(ILaser laser, IRtc rtc, double width, double height) { rtc.ListBegin(laser); rtc.ListJump(new Vector2((float)-width / 2, (float)height / 2)); rtc.ListMark(new Vector2((float)width / 2, (float)height / 2)); rtc.ListMark(new Vector2((float)width / 2, (float)-height / 2)); rtc.ListMark(new Vector2((float)-width / 2, (float)-height / 2)); rtc.ListMark(new Vector2((float)-width / 2, (float)height / 2)); rtc.ListEnd(); rtc.ListExecute(true); }
/// <summary> /// draw cicle with dots /// </summary> /// <param name="rtc"></param> /// <param name="radius"></param> /// <param name="durationMsec"></param> private static void DrawCircleWithDots(ILaser laser, IRtc rtc, float radius, float durationMsec) { 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); rtc.ListJump(new Vector2((float)x, (float)y)); rtc.ListLaserOn(durationMsec); } rtc.ListEnd(); rtc.ListExecute(true); }
/// <summary> /// 지정된 크기의 직사각형 그리기 /// </summary> /// <param name="rtc"></param> /// <param name="width"></param> /// <param name="height"></param> private static void DrawRectangle(ILaser laser, IRtc rtc, double width, double height) { ///스테이지의 원점은 통상 0,0 이기 때문에 - 영역에서는 모션구동이 불가능하므로 ///+ 영역에서 처리되도록 안전한 위치로 이동하는 코드 rtc.MatrixStack.Push(width * 1.5f, height * 1.5f);///transit safety area /// 스테이지만 구동하여 원 그리기 rtc.ListBegin(laser, MotionType.StageOnly); rtc.ListJump(new Vector2((float)-width / 2, (float)height / 2)); rtc.ListMark(new Vector2((float)width / 2, (float)height / 2)); rtc.ListMark(new Vector2((float)width / 2, (float)-height / 2)); rtc.ListMark(new Vector2((float)-width / 2, (float)-height / 2)); rtc.ListMark(new Vector2((float)-width / 2, (float)height / 2)); rtc.ListEnd(); rtc.ListExecute(true); rtc.MatrixStack.Pop(); }
/// <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); }
static void Draw(IRtc rtc, ILaser laser, MotionType motionType) { bool success = true; var rtcSyncAxis = rtc as IRtcSyncAxis; success &= rtcSyncAxis.ListBegin(laser, motionType); success &= rtc.ListJump(new Vector2(50, 50)); success &= rtc.ListMark(new Vector2(100, 50)); success &= rtc.ListMark(new Vector2(100, 100)); success &= rtc.ListMark(new Vector2(50, 100)); success &= rtc.ListMark(new Vector2(50, 50)); if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(true); } }
/// <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); }
/// <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 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); }
private static bool DrawCircle(ILaser laser, IRtc rtc) { bool success = true; var rtcExt = rtc as IRtcExtension; //리스트 시작 success &= rtc.ListBegin(laser); //아나로그1 에 5V 출력 success &= rtc.ListWriteData <float>(ExtensionChannel.ExtAO2, 0.5f); //1 초 동안 대기 success &= rtc.ListWait(1000); //아나로그1 에 0V 출력 success &= rtc.ListWriteData <float>(ExtensionChannel.ExtAO2, 0); //점프 success &= rtc.ListJump(new Vector2(10, 0)); //레이저 출력 15핀에 있는 출력 2접점중 첫번째 비트 켜기 success &= rtc.ListWriteData <int>(ExtensionChannel.ExtDO2, 0x01); //레이저 출력 시작 success &= rtc.ListLaserOn(); //0.5 초 동안 대기 success &= rtc.ListWait(500); //레이저 출력 중지 success &= rtc.ListLaserOff(); //레이저 출력 15핀에 있는 출력 2접점중 첫번째 비트 끄기 success &= rtc.ListWriteData <int>(ExtensionChannel.ExtDO2, 0x00); //점프 success &= rtc.ListJump(new Vector2(-10, 0)); //매 100us 마다 X 방향으로 0.1 mm 이동하면서 아나로그 1번 출력으로 픽셀 출력(Raster Operation)을 준비 (100개) success &= rtcExt.ListPixelLine(100, new Vector2(0.1F, 0), 100, ExtensionChannel.ExtAO2); for (int i = 0; i < 100; i++) { success &= rtcExt.ListPixel(10, 0.5f); //10us 펄스 생성및 아나로그2 에 5V 출력 } if (success) { //리스트 종료 success &= rtc.ListEnd(); //나머지 데이타 가공 완료 대기 success &= rtc.ListExecute(true); } 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); }
/// <summary> /// 행렬을 이용해 직선을 그릴때 1도마다 직선을 회전시켜 그리기 /// </summary> /// <param name="rtc"></param> /// <param name="angleStart"></param> /// <param name="angleEnd"></param> private static bool DrawLinesWithRotate(ILaser laser, IRtc rtc, double angleStart, double angleEnd) { bool success = true; success &= rtc.ListBegin(laser); rtc.MatrixStack.Push(2, 4); // dx =2, dy=4 만큼 이동 for (double angle = angleStart; angle <= angleEnd; angle += 1) { rtc.MatrixStack.Push(angle); success &= rtc.ListJump(new Vector2(-10, 0)); success &= rtc.ListMark(new Vector2(10, 0)); rtc.MatrixStack.Pop(); } rtc.MatrixStack.Pop(); if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(true); } return(success); }
private static bool MotfWithCircleAndWaitEncoder(ILaser laser, IRtc rtc, bool externalStart) { var rtcMotf = rtc as IRtcMOTF; var rtcExtension = rtc as IRtcExtension; bool success = true; // 리스트 시작 success &= rtc.ListBegin(laser, ListType.Single); // 직선을 그립니다. (엔코더 입력과 무관합니다) success &= rtc.ListJump(new Vector2(0, 0)); success &= rtc.ListMark(new Vector2(0, 10)); // ListMOTFBegin 부터 ListMOTFEnd 사이의 모든 list 명령어는 엔코더증감값이 적용됩니다 success &= rtcMotf.ListMOTFBegin(); // 엔코더 X 값이 10mm 가 넘을때(Over) 까지 리스트 명령들이 모두 대기됨 success &= rtcMotf.ListMOTFWait(RtcEncoder.EncX, 10, EncoderWaitCondition.Over); // 엔코더 X 값이 위 조건을 만족한 이후 원 을 그린다 success &= rtc.ListJump(new Vector2((float)10, 0)); success &= rtc.ListArc(new Vector2(0, 0), 360.0f); // MOTF 중지및 0,0 위치(스캐너 중심 위치)로 jump 실시 success &= rtcMotf.ListMOTFEnd(Vector2.Zero); success &= rtc.ListEnd(); if (externalStart) { // RTC 15핀 커넥터에 있는 /START 을 리스트 시작 트리거로 사용합니다. var extCtrl = new Rtc5ExternalControlMode(); extCtrl.Add(Rtc5ExternalControlMode.Bit.ExternalStart); extCtrl.Add(Rtc5ExternalControlMode.Bit.ExternalStartAgain); rtcExtension.CtlExternalControl(extCtrl); } else { // 외부 트리거(/START) 미사용 rtcExtension.CtlExternalControl(Rtc5ExternalControlMode.Empty); if (success) { success &= rtc.ListExecute(); } } return(success); }
/// <summary> /// 레이어 안에 있는 모든 객체들을 마킹하기 (3x3 의 나선 객체가 마킹됨) /// </summary> /// <param name="rtc"></param> /// <param name="doc"></param> private static bool DrawForFieldCorrection(ILaser laser, IRtc rtc, IDocument doc) { bool success = true; var markerArg = new MarkerArgDefault() { Document = doc, Rtc = rtc, Laser = laser, IsEnablePens = true, //문서(doc) 내부에 사전에 생성된 10개의 펜 집합(Pens)을 사용하므로 이를 활성화 }; success &= rtc.ListBegin(laser); // 레이어 순회 foreach (var layer in doc.Layers) { //레이어 가공 success &= layer.Mark(markerArg); // or // 직접 하나씩 처리방법. 레이어 내의 개체들을 순회 //foreach (var entity in layer) //{ // var markerable = entity as IMarkerable; // // 해당 개체가 레이저 가공이 가능한지 여부를 판별 // if (null != markerable) // success &= markerable.Mark(markerArg); // 레이저 가공 실시 // if (!success) // break; //} if (!success) { break; } } if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(true); } return(success); }
/// <summary> /// 선 그리기 = 지령 속도 기반 레이저 신호 (아나로그 ~10V) 제어 /// 가공 출력 조건 = 5V (최소 4V, 최대 6V) /// </summary> private static bool DrawLine1(ILaser laser, IRtc rtc, float x1, float y1, float x2, float y2) { var alc = rtc as IRtcAutoLaserControl; if (null == alc) { return(false); } bool success = true; alc.AutoLaserControlByPositionFileName = string.Empty; success &= alc.CtlAutoLaserControl <float>(AutoLaserControlSignal.Analog1, AutoLaserControlMode.SetVelocity, 5, 4, 6); success &= rtc.ListBegin(laser); success &= rtc.ListJump(new Vector2(x1, y1)); success &= rtc.ListMark(new Vector2(x2, y2)); if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(true); } return(success); }
/// <summary> /// 선 그리기 = 벡터 위치 기반 레이저 신호(아나로그) 제어 /// </summary> private static bool DrawLine4(ILaser laser, IRtc rtc, float x1, float y1, float x2, float y2) { var alc = rtc as IRtcAutoLaserControl; if (null == alc) { return(false); } bool success = true; success &= rtc.ListBegin(laser); success &= alc.ListAlcByVectorBegin <float>(AutoLaserControlSignal.Analog1, 5F); // 아나로그 출력 초기값 : 5V success &= rtc.ListJump(new Vector2(x1, y1), 0.5F); //시작 위치로 점프 5V * 0.5 = 2.5V 로 시작 success &= rtc.ListMark(new Vector2(x2, y2), 1.5F); //끝 위치로 마크 5V * 1.5 = 7.5V 로 끝 success &= alc.ListAlcByVectorEnd(); if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(true); } return(success); }
/// <summary> /// 지정된 문서(Document)를 지정된 RTC 제어기로 가공하기 /// </summary> /// <param name="laser"></param> /// <param name="rtc"></param> /// <param name="doc"></param> static void DoBegin(ILaser laser, IRtc rtc, IDocument doc) { var timer = Stopwatch.StartNew(); var markerArg = new MarkerArgDefault() { Document = doc, Rtc = rtc, Laser = laser, }; bool success = true; success &= rtc.ListBegin(laser); //레이어를 순회 foreach (var layer in doc.Layers) { success &= layer.Mark(markerArg); // or //레이어 내의 개체(Entity)들을 순회 //foreach (var entity in layer) //{ // var markerable = entity as IMarkerable; // //레이저 가공이 가능한 개체(markerable)인지를 판단 // if (null != markerable) // success &= markerable.Mark(markerArg); // 해당 개체(Entity) 가공 // if (!success) // break; //} if (!success) { break; } } if (success) { success &= rtc.ListEnd(); success &= rtc.ListExecute(true); } Console.WriteLine($"Processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s"); }
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); }