private bool RecipeParse(string name) { if (editor.Marker.IsBusy) { this.Send(ng); return(false); } string recipeFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "recipes", name); if (File.Exists(recipeFileName)) { this.Send(ng); return(false); } var doc = DocumentSerializer.OpenSirius(recipeFileName); if (null == doc) { this.Send(ng); return(false); } editor.Invoke(new MethodInvoker(delegate() { editor.Document = doc; })); return(true); }
public bool Open(string fileName) { var doc = DocumentSerializer.OpenSirius(fileName); siriusViewerForm1.Document = doc; return(true); }
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(); }
static void Main(string[] args) { SpiralLab.Core.Initialize(); #region create entities var doc1 = new DocumentDefault("Unnamed"); var layer = new Layer("default"); doc1.Layers.Add(layer); layer.Add(new Line(0, 10, 20, 20)); layer.Add(new Circle(0, 0, 10)); layer.Add(new Spiral(-20.0f, 0.0f, 0.5f, 2.0f, 5, true)); #endregion Console.WriteLine("press any key to save ..."); Console.ReadKey(false); string filename = "default.sirius"; var ds = new DocumentSerializer(); ds.Save(doc1, filename); Console.WriteLine("press any key to open ..."); Console.ReadKey(false); var doc2 = DocumentSerializer.OpenSirius(filename); Console.WriteLine("press any key to rtc initialize ..."); Console.ReadKey(false); #region initialize RTC IRtc rtc = new RtcVirtual(0); ///가상 rtc 제어기 생성 //IRtc rtc = new Rtc5(0); ///rtc 5 제어기 생성 double fov = 60.0; /// scanner field of view : 60mm double kfactor = Math.Pow(2, 20) / fov; /// k factor (bits/mm) = 2^20 / fov rtc.Initialize(kfactor, LaserMode.Yag1, "cor_1to1.ct5"); /// 스캐너 보정 파일 지정 : correction file rtc.CtlFrequency(50 * 1000, 2); /// laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); /// default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); /// scanner and laser delays #endregion #region initialize Laser (virtial) ILaser laser = new LaserVirtual(0, "virtual", 20); #endregion Console.WriteLine("press any key to laser processing ...WARNING !!! LASER EMISSION"); Console.ReadKey(false); DoBegin(laser, rtc, doc2); Console.WriteLine("press any key to terminate program"); Console.ReadKey(false); }
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()); }
static void Main(string[] args) { SpiralLab.Core.Initialize(); #region create entities //신규 문서(Document) 생성 var doc1 = new DocumentDefault("Unnamed"); // 레이어 생성 var layer = new Layer("default"); //레이어에 선 형상 개체(Entity) 생성및 추가 layer.Add(new Line(0, 10, 20, 20)); //레이어에 원 형상 개체(Entity) 생성및 추가 layer.Add(new Circle(0, 0, 10)); //레이어에 나선 형상 개체(Entity) 생성및 추가 layer.Add(new Spiral(-20.0f, 0.0f, 0.5f, 2.0f, 5, true)); // 레이어를 문서에 추가 doc1.Layers.Add(layer); #endregion Console.WriteLine("press any key to save ..."); Console.ReadKey(false); string filename = "default.sirius"; // 문서(Document) 저장하기 DocumentSerializer.Save(doc1, filename); Console.WriteLine("press any key to open ..."); Console.ReadKey(false); // 문서(Document) 불러오기 var doc2 = DocumentSerializer.OpenSirius(filename); Console.WriteLine("press any key to rtc initialize ..."); Console.ReadKey(false); #region initialize RTC //var rtc = new RtcVirtual(0); //create Rtc for dummy var rtc = new Rtc5(0, "output.txt"); //create Rtc5 controller with list commands output file //var rtc = new Rtc6(0); //create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //실험적인 상태 (Scanlab Rtc6 Ethernet 제어기) //var rtc = new Rtc6SyncAxis(0, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "syncAxis", "syncAXISConfig.xml")); //실험적인 상태 (Scanlab XLSCAN 솔류션) float fov = 60.0f; // scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; // k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // 스캐너 보정 파일 지정 : correction file rtc.CtlFrequency(50 * 1000, 2); // laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); // default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); // scanner and laser delays #endregion #region initialize Laser (virtual) 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 Console.WriteLine("press any key to laser processing ...WARNING !!! LASER EMISSION"); Console.ReadKey(false); DoBegin(laser, rtc, doc2); Console.WriteLine("press any key to terminate program"); Console.ReadKey(false); }
static void Main(string[] args) { SpiralLab.Core.Initialize(); #region create entities ///신규 문서(Document) 생성 var doc1 = new DocumentDefault("Unnamed"); /// 레이어 생성 var layer = new Layer("default"); /// 레이어를 문서해 추가 doc1.Layers.Add(layer); ///레이어에 선 형상 개체(Entity) 생성및 추가 layer.Add(new Line(0, 10, 20, 20)); ///레이어에 원 형상 개체(Entity) 생성및 추가 layer.Add(new Circle(0, 0, 10)); ///레이어에 나선 형상 개체(Entity) 생성및 추가 layer.Add(new Spiral(-20.0f, 0.0f, 0.5f, 2.0f, 5, true)); #endregion Console.WriteLine("press any key to save ..."); Console.ReadKey(false); string filename = "default.sirius"; /// 문서(Document) 저장하기 var ds = new DocumentSerializer(); ds.Save(doc1, filename); Console.WriteLine("press any key to open ..."); Console.ReadKey(false); /// 문서(Document) 불러오기 var doc2 = DocumentSerializer.OpenSirius(filename); Console.WriteLine("press any key to rtc initialize ..."); Console.ReadKey(false); #region initialize RTC var rtc = new RtcVirtual(0, "output2.txt"); //var rtc = new Rtc5(0); ///create Rtc5 controller //var rtc = new Rtc6(0); ///create Rtc6 controller //var rtc = new Rtc6Ethernet(0, "192.168.0.200"); ///create Rtc6 ethernet controller //var rtc = new Rtc53D(0); ///create Rtc5 + 3D option controller //var rtc = new Rtc63D(0); ///create Rtc5 + 3D option controller //var rtc = new Rtc5DualHead(0); ///create Rtc5 + Dual head option controller //var rtc = new Rtc5MOTF(0); ///create Rtc5 + MOTF option controller //var rtc = new Rtc6MOTF(0); ///create Rtc6 + MOTF option controller //var rtc = new Rtc6SyncAxis(0); //var rtc = new Rtc6SyncAxis(0, "syncAXISConfig.xml"); ///create Rtc6 + XL-SCAN (ACS+SYNCAXIS) option controller float fov = 60.0f; /// scanner field of view : 60mm float kfactor = (float)Math.Pow(2, 20) / fov; /// k factor (bits/mm) = 2^20 / fov var correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5"); rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); /// 스캐너 보정 파일 지정 : correction file rtc.CtlFrequency(50 * 1000, 2); /// laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); /// default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); /// scanner and laser delays #endregion #region initialize Laser (virtial) ILaser laser = new LaserVirtual(0, "virtual", 20); #endregion Console.WriteLine("press any key to laser processing ...WARNING !!! LASER EMISSION"); Console.ReadKey(false); DoBegin(laser, rtc, doc2); Console.WriteLine("press any key to terminate program"); Console.ReadKey(false); }