- 在revit安装目录下找到 RevitAddInUtility.dll
- 在项目中引用
- 使用以下方法
using Autodesk.RevitAddIns;
///
/// 获取指定版本的Revit安装目录
///
///
///
public static string GetAllRevitInstallPath(RevitVersion revitVersion)
{
var revitProducts = GetAllRevitProducts();
RevitProduct revit = revitProducts.Find(x => (int)x.Version ==(int) revitVersion);
if (revit != null)
{
return revit.InstallLocation;
}
else
{
throw new Exception($"未安装{revitVersion}");
}
}
///
/// 获取本机所有Revit安装信息
///
///
public static List GetAllRevitProducts()
{
return RevitProductUtility.GetAllInstalledRevitProducts();
}