/*------------------------------------------------------------------------- * 功能描述:RevitUtils * 作者:xulisong * 创建时间: 2019/7/29 9:08:18 * 版本号:v1.0 * -------------------------------------------------------------------------*/ using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Autodesk.RevitAddIns; namespace ExportStart { public class RevitUtils { /// /// 获取Revit搜索dll路径 /// /// public static List GetSearchPath() { #if DEBUG return RevitProductUtility.GetAllInstalledRevitProducts().Where(t => t.Name == "Revit 2017").Select(x => x.InstallLocation).ToList(); #else return new List(){GetRevitDllPath()}; #endif } #region dll路径管理 /// /// 获取RevitDll,所在目录 /// /// public static string GetRevitDllPath() { if (!string.IsNullOrWhiteSpace(m_RevitDllPath)) { return m_RevitDllPath; } return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\\RevitDlls"); } private static string m_RevitDllPath; public static void SetRevitDllPath(string path) { m_RevitDllPath = path; } #endregion } }