def Main(): aborted = False commandSettingsData = TryGetCommandSettingsData() batchRvtConfig = batch_rvt_config.ConfigureBatchRvt( commandSettingsData, Output) if batchRvtConfig is None: aborted = True else: if batchRvtConfig.EnableDataExport: path_util.CreateDirectory(batchRvtConfig.SessionDataFolderPath) session_data_exporter.ExportSessionData( batchRvtConfig.SessionId, batchRvtConfig.SessionStartTime, None, batchRvtConfig.SessionDataFolderPath, None) sessionError = None try: if batchRvtConfig.RevitProcessingOption == BatchRvt.RevitProcessingOption.BatchRevitFileProcessing: aborted = RunBatchRevitTasks(batchRvtConfig) else: aborted = RunSingleRevitTask(batchRvtConfig) except Exception, e: sessionError = exception_util.GetExceptionDetails(e) raise finally:
sessionError = None try: if batchRvtConfig.RevitProcessingOption == BatchRvt.RevitProcessingOption.BatchRevitFileProcessing: aborted = RunBatchRevitTasks(batchRvtConfig) else: aborted = RunSingleRevitTask(batchRvtConfig) except Exception, e: sessionError = exception_util.GetExceptionDetails(e) raise finally: if batchRvtConfig.EnableDataExport: sessionEndTime = time_util.GetDateTimeNow() session_data_exporter.ExportSessionData( batchRvtConfig.SessionId, batchRvtConfig.SessionStartTime, sessionEndTime, batchRvtConfig.SessionDataFolderPath, sessionError) Output() if aborted: Output("Operation aborted.") else: Output("Operation completed.") Output() return try: Main() except Exception, e: exception_util.LogOutputErrorDetails(e, Output)