|
@@ -0,0 +1,53 @@
|
|
|
+/*-------------------------------------------------------------------------
|
|
|
+ * 功能描述: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
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// 获取Revit搜索dll路径
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static List<string> GetSearchPath()
|
|
|
+ {
|
|
|
+#if DEBUG
|
|
|
+ return RevitProductUtility.GetAllInstalledRevitProducts().Where(t => t.Name == "Revit 2017").Select(x => x.InstallLocation).ToList();
|
|
|
+#else
|
|
|
+ return new List<string>(){GetRevitDllPath()};
|
|
|
+#endif
|
|
|
+ }
|
|
|
+ #region dll路径管理
|
|
|
+ /// <summary>
|
|
|
+ /// 获取RevitDll,所在目录
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ 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
|
|
|
+ }
|
|
|
+}
|