// Prompt the user for the location to save the file //---------------------------------------------------------- static ExportData PromptForData() { PartExportFormat exportFormat = PartExportFormat.AcisText; string fileName = null; AddIn.ExecuteWindowsFormsCode(() => { using (var fileDialog = new SaveFileDialog()) { var formats = new List <PartExportFormat>(); // add the supported file formats to the SaveAs dialog string filter = string.Empty; foreach (PartExportFormat format in Enum.GetValues(typeof(PartExportFormat))) { string formatFilter = GetFilter(format); if (!string.IsNullOrEmpty(formatFilter)) { filter += formatFilter + "|"; formats.Add(format); } } filter = filter.TrimEnd('|'); fileDialog.Filter = filter; if (fileDialog.ShowDialog(SpaceClaim.Api.V18.Application.MainWindow) != DialogResult.OK) { return; // user canceled } // get the data the user entered exportFormat = formats[fileDialog.FilterIndex - 1]; fileName = fileDialog.FileName; } }); return(new ExportData(exportFormat, fileName)); }