private void btnSelect3DModel_Click(object sender, EventArgs e) { using (var openFileDialog = new OpenFileDialog()) { openFileDialog.Filter = "(*.stl)|*.stl"; openFileDialog.Multiselect = false; if (openFileDialog.ShowDialog() == DialogResult.OK) { this.FilePath = openFileDialog.FileName; this.txt3DModelFilePath.Text = this.FilePath; ObjectView.Create(new string[] { this.FilePath }, Color.Aqua, true, null); } } }
private static void ImportWorkspaceFile(string filePath) { if (File.Exists(filePath)) { ObjectView.FileProcessed += ObjectView_FileProcessed; ObjectView.Create(new[] { filePath }, Color.Blue, ObjectView.BindingSupported, null); string jobName = (new FileInfo(filePath)).Name; jobName = jobName.Substring(0, jobName.LastIndexOf(".")); RenderEngine.PrintJob.Name = !string.IsNullOrEmpty(jobName) ? jobName : "Untitled"; } else { MessageBox.Show("Cached temp file not found", "OS3 integration warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void MagsAIWelcomeTabPanel_DragDrop(object sender, DragEventArgs e) { var validSTLFile = false; string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); foreach (string file in files) { if (file.ToLower().EndsWith("stl")) { validSTLFile = true; } if (validSTLFile) { ObjectView.Create(new string[] { file }, Color.Aqua, true, null); } } }