API判断本机安装的Revit版本信息

start
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class cmdRevitVersion : IExternalCommand
{
    public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
    {
        UIDocument uiDoc = commandData.Application.ActiveUIDocument;
        Autodesk.Revit.ApplicationServices.Application app = commandData.Application.Application;
        Selection sel = uiDoc.Selection;

        Transaction ts = new Transaction(uiDoc.Document, "http://revit.5d6d.com");
        ts.Start();

        string strInfo = "";
        foreach (RevitProduct revitPro in RevitProductUtility.GetAllInstalledRevitProducts())
        {
            strInfo += revitPro.Name + "," + revitPro.InstallLocation + "\n";
        }

        ts.Commit();

        WinFormTools.MsgBox(strInfo);

        return Result.Succeeded;
    }
}
url:http://greatverve.cnblogs.com/p/RevitAddInUtility.html
posted @ 2014-03-20 11:05  大气象  阅读(2395)  评论(0编辑  收藏  举报
http://www.tianqiweiqi.com