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(); }
private void btnOpen_Click(object sender, EventArgs e) { ofd.Filter = "sirius data files (*.sirius)|*.sirius|dxf cad files (*.dxf)|*.dxf|All Files (*.*)|*.*"; ofd.Title = "Open File"; ofd.FileName = string.Empty; DialogResult result = ofd.ShowDialog(this); if (result == DialogResult.OK) { string ext = Path.GetExtension(ofd.FileName); if (0 == string.Compare(ext, ".dxf", true)) { trvEntity.SuspendLayout(); var doc = DocumentSerializer.OpenDxf(ofd.FileName); trvEntity.ResumeLayout(); if (null == doc) { MessageBox.Show($"Fail to open : {ofd.FileName}", "File Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.Document = doc; } else if (0 == string.Compare(ext, ".sirius", true)) { trvEntity.SuspendLayout(); var doc = DocumentSerializer.OpenSirius(ofd.FileName); trvEntity.ResumeLayout(); if (null == doc) { MessageBox.Show($"Fail to open : {ofd.FileName}", "File Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.Document = doc; } else { MessageBox.Show($"Unsupported file extension : {ofd.FileName}", "File Type Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
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()); }