private void saveGcodeButton_Click(object sender, EventArgs e) { var dialog = new SaveFileDialog(); dialog.Filter = "GCode Files |*.nc;*.gcode"; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string filename = dialog.FileName; if (!filename.EndsWith(".nc", StringComparison.OrdinalIgnoreCase) && !filename.EndsWith(".gcode", StringComparison.OrdinalIgnoreCase)) { filename = filename + ".nc"; } GCodeLoader.ExportGCode(router.GetCommands(), filename); } }
internal TriangleMeshGUI AddFile(string filename, float scale) { if (filename.EndsWith(".nc", StringComparison.OrdinalIgnoreCase) || filename.EndsWith(".gcode", StringComparison.OrdinalIgnoreCase)) { var commands = GCodeLoader.Load(filename); foreach (ICommand command in commands) { router.AddCommand(command); } return(null); } BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += worker_LoadMesh; worker.RunWorkerCompleted += worker_LoadMeshCompleted; var mesh = new TriangleMeshGUI(); inProgressMeshes.Add(mesh); worker.RunWorkerAsync(new LoadMeshData() { filename = filename, scale = loadObjectScale, mesh = mesh }); return(mesh); }