示例#1
0
        public static string RunTask(
            CommandSettings.Data commandSettingsData,
            bool openLogFileWhenDone
            )
        {
            commandSettingsData = ValidateCommandSettingsData(commandSettingsData);

            var batchRvtFolderPath = BatchRvt.GetBatchRvtFolderPath();

            BatchRvt.ExecuteMonitorScript(batchRvtFolderPath, commandSettingsData);

            var logFilePath = commandSettingsData.GeneratedLogFilePath;

            logFilePath = PostProcessLogFile(logFilePath);

            if (openLogFileWhenDone)
            {
                if (!string.IsNullOrWhiteSpace(logFilePath))
                {
                    Process.Start(logFilePath);
                }
            }

            return(logFilePath);
        }
        public static string GetUniqueScriptDataFilePath()
        {
            string uniqueId = Guid.NewGuid().ToString();

            return(Path.Combine(
                       BatchRvt.GetDataFolderPath(),
                       SCRIPT_DATA_FILENAME_PREFIX + uniqueId + JSON_FILE_EXTENSION
                       ));
        }
        private static void InitPythonFunctions()
        {
            bool needToAddSearchPath = (engine == null);

            engine = engine ?? ScriptUtil.CreatePythonEngine();

            if (needToAddSearchPath)
            {
                var scriptsFolderPath = BatchRvt.GetBatchRvtScriptsFolderPath();

                ScriptUtil.AddSearchPaths(engine, new[] { scriptsFolderPath });
            }

            pathUtilModuleScope = pathUtilModuleScope ?? IronPythonHosting.Python.ImportModule(engine, "path_util");
            PYTHON_FUNCTION_ExpandedFullNetworkPath = PYTHON_FUNCTION_ExpandedFullNetworkPath ?? pathUtilModuleScope.GetVariable("ExpandedFullNetworkPath");

            revitFileListModuleScope      = revitFileListModuleScope ?? IronPythonHosting.Python.ImportModule(engine, "revit_file_list");
            PYTHON_FUNCTION_RevitFileInfo = PYTHON_FUNCTION_RevitFileInfo ?? revitFileListModuleScope.GetVariable("RevitFileInfo");

            revitFileVersionModuleScope = revitFileVersionModuleScope ?? IronPythonHosting.Python.ImportModule(engine, "revit_file_version");
            PYTHON_FUNCTION_GetRevitVersionNumberTextFromRevitVersionText = PYTHON_FUNCTION_GetRevitVersionNumberTextFromRevitVersionText ?? revitFileVersionModuleScope.GetVariable("GetRevitVersionNumberTextFromRevitVersionText");
        }