def do_save_dialogs(): dlg = SaveFileDialog() dlg.Title = "Save Column Settings" dlg.FileName = "Column Export" dlg.Filter = 'MahTweets Settings (*.mahtweets) | *.mahtweets' dlg.DefaultExt = ".mahtweets" if dlg.ShowDialog() == DialogResult.OK: return dlg.FileName else: return None
def dosave(): dialog = SaveFileDialog() dialog.FileName="cvs-debug-log-" + \ DateTime.Today.ToString("yyyy-MM-dd") + ".txt" dialog.Title = i18n.get("LogSaveTitle") dialog.Filter = i18n.get("LogSaveFilter")+'|*.*' try: if dialog.ShowDialog(__app_window) == DialogResult.OK: if dialog.FileName != None: debug("wrote debug logfile: ", FileInfo(dialog.FileName).Name) __logger.save(dialog.FileName) if show_error_message: MessageBox.Show(__app_window, i18n.get("LogSavedText"), i18n.get("LogSavedTitle"), MessageBoxButtons.OK, MessageBoxIcon.Information ) except: debug_exc() MessageBox.Show( __app_window, i18n.get("LogSaveFailedText") )
GNU General Public License for more details. See this link for a copy of the GNU General Public License protecting this package. https://github.com/eirannejad/pyRevit/blob/master/LICENSE ''' __window__.Close() import clr clr.AddReference('System.Windows.Forms') from System.Windows.Forms import DialogResult, SaveFileDialog from Autodesk.Revit.DB import ImageExportOptions, ExportRange, ImageFileType, ImageResolution, ZoomFitType doc = __revit__.ActiveUIDocument.Document # collect file location from user dialog = SaveFileDialog() dialog.Title = 'Export current view as PNG' dialog.Filter = 'PNG files (*.PNG)|*.PNG' if dialog.ShowDialog() == DialogResult.OK: # set up the export options options = ImageExportOptions() options.ExportRange = ExportRange.VisibleRegionOfCurrentView options.FilePath = dialog.FileName options.HLRandWFViewsFileType = ImageFileType.PNG options.ImageResolution = ImageResolution.DPI_600 options.ZoomType = ZoomFitType.Zoom options.ShadowViewsFileType = ImageFileType.PNG doc.ExportImage(options)