Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 레이어 안에 있는 모든 객체들을 마킹하기 (3x3 의 나선 객체가 마킹됨)
        /// </summary>
        /// <param name="rtc"></param>
        /// <param name="doc"></param>
        private static bool DrawForFieldCorrection(ILaser laser, IRtc rtc, IDocument doc)
        {
            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();
            }
            return(success);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 지정된 반지름을 갖는 원 그리기
 /// </summary>
 /// <param name="rtc"></param>
 /// <param name="radius"></param>
 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.0);
     rtc.ListEnd();
 }
Ejemplo n.º 4
0
        private static void DrawCircleWithPosition(ILaser laser, IRtc rtc)
        {
            var motf = rtc as IRtcMOTF;
            /// RTC 15핀 커넥터에 있는 /START , /STOP 입력핀을 시작, 중지 트리거로 사용합니다.
            ///turn on external /start
            ///turn on reset encoder when external start
            var extCtrl = new RtcExternalControlMode();

            extCtrl.Add(RtcExternalControlMode.Signal.EncoderReset);
            extCtrl.Add(RtcExternalControlMode.Signal.ExternalStart);
            extCtrl.Add(RtcExternalControlMode.Signal.ExternalStartAgain);
            motf.CtlExternalControl(extCtrl);


            rtc.ListBegin(laser);
            ///직선을 그립니다. (엔코더 입력과 무관합니다)
            rtc.ListJump(new Vector2(0, 0));
            rtc.ListMark(new Vector2(10, 0));
            /// ListMOTFBegin 부터 ListMOTFEnd 사이의 모든 list 명령어는 엔코더증감값이 적용됩니다
            motf.ListMOTFBegin();
            /// 엔코더 X 값이  10mm 가 넘을때(Over) 까지 리스트 명령을 대기
            motf.ListMOTFWait(RtcEncoder.EncX, 10, EncoderWaitCondition.Over);//wait until encoder x position over 10.0mm
            ///엔코더 X 값이 위 조건을 만족한이후 원 을 그린다
            rtc.ListJump(new Vector2((float)10, 0));
            rtc.ListArc(new Vector2(0, 0), 360.0f);
            /// MOTF 중지및 0,0 위치(스캐너 중심 위치)로 jump 실시
            motf.ListMOTFEnd(Vector2.Zero);

            rtc.ListEnd();
            ///외부 트리거(/START)에 의해 시작되므로 execute 호출은 하지 않는다
            ///rtc.ListExecute(); /// its not need to call because its started by external trigger
        }
Ejemplo n.º 5
0
        private static bool DrawByMarkerWithOffset(IDocument doc, IRtc rtc, ILaser laser)
        {
            var marker = new MarkerDefault(0);

            marker.Name = "marker #2";
            //가공 완료 이벤트 핸들러 등록
            marker.OnFinished += Marker_OnFinished;

            var markerArg = new MarkerArgDefault()
            {
                Document = doc,
                Rtc      = rtc,
                Laser    = laser,
            };

            // 9개의 오프셋 정보를 추가한다
            markerArg.Offsets.Clear();
            markerArg.Offsets.Add(new Offset(-20.0f, 20.0f, -90f));
            markerArg.Offsets.Add(new Offset(0.0f, 20.0f, 0.0f));
            markerArg.Offsets.Add(new Offset(20.0f, 20.0f, 90.0f));
            markerArg.Offsets.Add(new Offset(-20.0f, 0.0f, -180.0f));
            markerArg.Offsets.Add(new Offset(0.0f, 0.0f, 0.0f));
            markerArg.Offsets.Add(new Offset(20.0f, 0.0f, 180.0f));
            markerArg.Offsets.Add(new Offset(-20.0f, -20.0f, -270.0f));
            markerArg.Offsets.Add(new Offset(0.0f, -20.0f, 0.0f));
            markerArg.Offsets.Add(new Offset(20.0f, -20.0f, 270.0f));
            bool success = true;

            // 마커에 가공 문서(doc)및 rtc, laser 정보를 전달하고 가공 준비를 실시한다.
            success &= marker.Ready(markerArg);
            // 가공을 시작한다.
            success &= marker.Start();
            return(success);
        }
Ejemplo n.º 6
0
        /// <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");
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 레이어 안에 있는 모든 객체들을 마킹하기 (3x3 의 나선 객체가 마킹됨)
        /// </summary>
        /// <param name="rtc"></param>
        /// <param name="doc"></param>
        private static bool DrawForFieldCorrection(ILaser laser, IRtc rtc, IDocument doc)
        {
            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();
            }
            return(success);
        }
Ejemplo n.º 8
0
        /// <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);
        }
Ejemplo n.º 9
0
        /// <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);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 폰트 RTC 내부 리스트 메모리에 등록된 폰트 집합 삭제
        /// </summary>
        /// <param name="rtc"></param>
        private static void DeleteCharacterSet(IRtc rtc)
        {
            var rtcCharSet = rtc as IRtcCharacterSet;

            rtcCharSet.CtlCharacterSetClear();
            Debug.Assert(false == rtcCharSet.CtlCharacterSetIsExist('0'));
        }
Ejemplo n.º 11
0
 private static void DrawCircle(IRtc rtc, double radius)
 {
     rtc.ListBegin();
     rtc.ListJump(new System.Numerics.Vector2((float)radius, 0));
     rtc.ListArc(new System.Numerics.Vector2(0, 0), 360.0);
     rtc.ListEnd();
 }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        private static void DrawByMarker(IRtc rtc, ILaser laser, IMarker marker)
        {
            #region load from sirius file
            var dlg = new OpenFileDialog();
            dlg.Filter = "sirius data files (*.sirius)|*.sirius|dxf cad files (*.dxf)|*.dxf|All Files (*.*)|*.*";
            dlg.Title  = "Open to data file";
            DialogResult result = dlg.ShowDialog();
            if (result != DialogResult.OK)
            {
                return;
            }
            string    ext = Path.GetExtension(dlg.FileName);
            IDocument doc = null;
            if (0 == string.Compare(ext, ".dxf", true))
            {
                doc = DocumentSerializer.OpenDxf(dlg.FileName);
            }
            else if (0 == string.Compare(ext, ".sirius", true))
            {
                doc = DocumentSerializer.OpenSirius(dlg.FileName);
            }
            #endregion

            Debug.Assert(null != doc);
            marker.Ready(doc, rtc, laser);
            marker.Offsets.Clear();
            marker.Offsets.Add((0, 0, 0));
            marker.Start();
        }
Ejemplo n.º 14
0
        /// <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();
        }
Ejemplo n.º 15
0
        /// <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);
        }
Ejemplo n.º 16
0
        private static bool DrawByMarker(IDocument doc, IRtc rtc, ILaser laser)
        {
            var marker = new MarkerDefault(0);

            marker.Name = "marker #1";
            //가공 완료 이벤트 핸들러 등록
            marker.OnFinished += Marker_OnFinished;

            var markerArg = new MarkerArgDefault()
            {
                Document = doc,
                Rtc      = rtc,
                Laser    = laser,
            };

            // 하나의 오프셋 정보(0,0 및 회전각도 0) 를 추가한다.
            markerArg.Offsets.Add(Offset.Zero);
            bool success = true;

            // 마커에 가공 문서(doc)및 rtc, laser 정보를 전달하고 가공 준비를 실시한다.
            success &= marker.Ready(markerArg);
            // 가공을 시작한다.
            success &= marker.Start();
            return(success);
        }
Ejemplo n.º 17
0
        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");
        }
Ejemplo n.º 18
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            var xmlConfigFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "syncAxis", "syncAXISConfig.xml");

            if (!File.Exists(xmlConfigFileName))
            {
                MessageBox.Show($"XML configuration file is not founded : {xmlConfigFileName}");
                return;
            }

            #region SyncAxis 초기화
            bool success = true;
            var  rtc     = new Rtc6SyncAxis(0, xmlConfigFileName);
            rtc.Name = "SyncAxis";
            success &= rtc.Initialize(0, LaserMode.None, string.Empty);
            success &= rtc.CtlFrequency(50 * 1000, 2); // laser frequency : 50KHz, pulse width : 2usec
            success &= rtc.CtlSpeed(100, 100);         // default scanner jump and mark speed : 100mm/s

            //스테이지 이동시 기본 값 설정
            rtc.StageMoveSpeed   = 10;
            rtc.StageMoveTimeOut = 5;
            #endregion


            #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


            #region 마커 지정
            var marker = new MarkerDefault(0, " SyncAxis Marker ");
            #endregion

            #region RTC 확장 IO
            this.RtcExt1DInput = new RtcDInput(rtc, 0, "DIN RTC EXT1");
            this.RtcExt1DInput.Initialize();
            this.RtcExt1DOutput = new RtcDOutputExt1(rtc, 0, "DOUT RTC EXT1");
            this.RtcExt1DOutput.Initialize();
            this.RtcExt2DOutput = new RtcDOutputExt2(rtc, 0, "DIN RTC EXT2");
            this.RtcExt2DOutput.Initialize();
            this.siriusEditorForm1.RtcExtension1Input  = this.RtcExt1DInput;
            this.siriusEditorForm1.RtcExtension1Output = this.RtcExt1DOutput;
            this.siriusEditorForm1.RtcExtension2Output = this.RtcExt2DOutput;
            #endregion

            this.Rtc = rtc;
            this.siriusEditorForm1.Rtc    = rtc;
            this.siriusEditorForm1.Laser  = laser;
            this.siriusEditorForm1.Marker = marker;
        }
Ejemplo n.º 19
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);
        }
Ejemplo n.º 20
0
 /// <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);
 }
Ejemplo n.º 21
0
        private static void DrawCircle(ILaser laser, IRtc rtc)
        {
            float radius = 20.0f;

            rtc.ListBegin(laser);
            rtc.ListJump(new Vector2(radius, 0));
            rtc.ListArc(new Vector2(0, 0), 360.0f);
            rtc.ListEnd();
        }
Ejemplo n.º 22
0
        private static void DrawByMarker(IDocument doc, IRtc rtc, ILaser laser)
        {
            var marker = new MarkerDefault(0);

            marker.Name        = "marker #1";
            marker.OnFinished += Marker_OnFinished;
            marker.Ready(doc, rtc, laser);   //layer cloned
            marker.Start();
        }
Ejemplo n.º 23
0
 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();
 }
Ejemplo n.º 24
0
 /// <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)
 {
     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();
 }
Ejemplo n.º 25
0
        /// <summary>
        /// laser processing
        /// </summary>
        /// <param name="rtc"></param>
        /// <returns></returns>
        public override bool Mark(IRtc rtc)
        {
            bool success = true;

            ///jump to start pos
            success &= rtc.ListJump(new Vector2((float)this.StartX, (float)this.StartY));
            ///mark to end pos
            success &= rtc.ListMark(new Vector2((float)this.EndX, (float)this.EndY));
            return(success);
        }
Ejemplo n.º 26
0
 private static void DrawRectangle(IRtc rtc, double width, double height)
 {
     rtc.ListBegin();
     rtc.ListJump(new System.Numerics.Vector2((float)-width / 2, (float)height / 2));
     rtc.ListMark(new System.Numerics.Vector2((float)width / 2, (float)height / 2));
     rtc.ListMark(new System.Numerics.Vector2((float)width / 2, (float)-height / 2));
     rtc.ListMark(new System.Numerics.Vector2((float)-width / 2, (float)-height / 2));
     rtc.ListMark(new System.Numerics.Vector2((float)-width / 2, (float)height / 2));
     rtc.ListEnd();
 }
Ejemplo n.º 27
0
        /// <summary>
        /// laser processing
        /// </summary>
        /// <param name="rtc"></param>
        /// <returns></returns>
        public override bool Mark(IRtc rtc)
        {
            if (this.OutterDiameter <= 0)
            {
                return(false);
            }
            if (this.InnerDiameter > this.OutterDiameter)
            {
                return(false);
            }
            if (this.Revolutions <= 0)
            {
                return(false);
            }

            bool success = true;

            ///translate spiral's center
            rtc.Matrix.Push(this.X, this.Y);
            ///jump to start pos
            success &= rtc.ListJump(new Vector2((float)(this.InnerDiameter / 2.0), 0.0f));
            ///calculate radial pitch
            double radialPitch = (this.OutterDiameter - this.InnerDiameter) / 2.0 / (double)this.Revolutions;

            for (int i = 0; i < this.Revolutions; i++)
            {
                for (double t = 0; t < 360; t += 30.0)  ///360/30 = 12 steps
                {
                    double  angle    = t + 360.0 * (double)i;
                    double  degInRad = angle * Math.PI / 180.0;
                    double  d        = InnerDiameter / 2.0 + radialPitch * (double)i + radialPitch * t / 360.0;
                    Vector2 v2;
                    v2.X     = (float)(d * Math.Cos(degInRad));
                    v2.Y     = (float)(d * Math.Sin(degInRad));
                    success &= rtc.ListMark(v2);
                    if (!success)
                    {
                        break;
                    }
                }
                if (!success)
                {
                    break;
                }
            }
            if (success && this.Closed)
            {
                success &= rtc.ListArc(new Vector2(0.0f, 0.0f), 360.0);
            }

            rtc.Matrix.Pop();
            return(success);
        }
Ejemplo n.º 28
0
 /// <summary>
 /// 원(호)를 따라 매 1도마다 점 찍기
 /// </summary>
 /// <param name="rtc"></param>
 /// <param name="radius"></param>
 /// <param name="durationMsec"></param>
 private static void DrawCircleWithDots(ILaser laser, IRtc rtc, double radius, double durationMsec)
 {
     rtc.ListBegin(laser);
     for (double 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();
 }
Ejemplo n.º 29
0
 /// <summary>
 /// 행렬을 이용해 직선을 그릴때 1도마다 직선을 회전시켜 그리기
 /// </summary>
 /// <param name="rtc"></param>
 /// <param name="angleStart"></param>
 /// <param name="angleEnd"></param>
 private static void DrawLinesWithRotate(ILaser laser, IRtc rtc, double angleStart, double angleEnd)
 {
     rtc.ListBegin(laser);
     for (double angle = angleStart; angle <= angleEnd; angle += 1)
     {
         rtc.MatrixStack.Push(angle);
         rtc.ListJump(new Vector2(-10, 0));
         rtc.ListMark(new Vector2(10, 0));
         rtc.MatrixStack.Pop();
     }
     rtc.ListEnd();
 }
Ejemplo n.º 30
0
 private static void DrawLinesWithRotate(IRtc rtc, double angleStart, double angleEnd)
 {
     rtc.ListBegin();
     for (double angle = angleStart; angle <= angleEnd; angle += 1)
     {
         rtc.Matrix.Push(angle);
         rtc.ListJump(new System.Numerics.Vector2(-10, 0));
         rtc.ListMark(new System.Numerics.Vector2(10, 0));
         rtc.Matrix.Pop();
     }
     rtc.ListEnd();
 }