研发动态

[Revit二次开发] Revit二次开发之获取本机已安装的Revit版本与路径 [课程编码3917]

[复制链接]
发表于 2023-1-21 09:58:10| 字数 770 | 显示全部楼层 |阅读模式

  • 在revit安装目录下找到 RevitAddInUtility.dll
  • 在项目中引用
  • 使用以下方法
    1. using Autodesk.RevitAddIns;

    2.         /// <summary>
    3.         /// 获取指定版本的Revit安装目录
    4.         /// </summary>
    5.         /// <param name="revitVersion"></param>
    6.         /// <returns></returns>
    7.         public static string GetAllRevitInstallPath(RevitVersion revitVersion)
    8.         {
    9.             var revitProducts = GetAllRevitProducts();
    10.             RevitProduct revit = revitProducts.Find(x => (int)x.Version ==(int) revitVersion);
    11.             if (revit != null)
    12.             {
    13.                 return revit.InstallLocation;
    14.             }
    15.             else
    16.             {
    17.                 throw new Exception($"未安装{revitVersion}");
    18.             }
    19.         }
    20.         /// <summary>
    21.         /// 获取本机所有Revit安装信息
    22.         /// </summary>
    23.         /// <returns></returns>
    24.         public static List<RevitProduct> GetAllRevitProducts()
    25.         {
    26.             return RevitProductUtility.GetAllInstalledRevitProducts();
    27.         }
    复制代码



   https://www.lmlphp.com/user/16591/article/item/491207/
回复 申请删帖

使用道具 举报

  • 联系我们
  • 邮箱:837005074#qq.com(请把#改成@)
  • 电话:18810188033
  • QQ客服 837005074
  • 人工客服:周一至周日(晚6点至11点)
  • 扫描加客服QQ

  • 扫描加客服微信

QQ|关于我们|Archiver|手机版|小黑屋|畅建科技 ( 京ICP备2022013818号-3 )

GMT+8, 2024-4-20 18:18 , Processed in 0.405420 second(s), 52 queries .

Powered by 找最好 X3.4

© 2015至今 zhaozuihao.com