获取已安装的Revit版本与路径
1.使用vs2015新建控制台应用程序
2.在项目中引入
RevitAddInUtility.dll
3.实现代码
using Autodesk.RevitAddIns; using System; using System.Collections.Generic; namespace ReadRvt { class Program { static void Main(string[] args) { Console.WriteLine("REVIT安装版本:"); GetAllRevitProducts(); Console.ReadKey(); } public static void GetAllRevitProducts() { List<RevitProduct> aa = RevitProductUtility.GetAllInstalledRevitProducts(); if (aa != null) { foreach (RevitProduct s in aa) { string i = s.InstallLocation; Console.WriteLine(i); } } else { throw new Exception("未安装revit"); } } } }
运行结果