Exemplo n.º 1
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();
        }
Exemplo n.º 2
0
        private static bool DrawByMarker(IRtc rtc, ILaser laser, IMarker marker, IMotor motor)
        {
            #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(false);
            }
            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(new MarkerArgDefault()
            {
                Document = doc,
                Rtc      = rtc,
                Laser    = laser,
                MotorZ   = motor,
            });
            // 하나의 오프셋 정보 추가
            marker.MarkerArg.Offsets.Clear();
            marker.MarkerArg.Offsets.Add(Offset.Zero);
            // 가공 시작
            return(marker.Start());
        }