By Augusto Goncalves (@augustomaia)
At the Developer Center you’ll find the Revit 2015 SDK for Subscription Release. Like in previous years, this update include some new features, and Jeremy Tammik discussed at his blog post.
Ok, but can use on my plugin? You may have a user that don’t have this installed (due many reasons). You may check if is available via version number, but can get complicated if the user has a newer Update Release without this Subscription Release.
Here is a quick & easy approach: check if the new method is indeed available on the API reference loaded on runtime via Reflection. Here is how:
public static class VersionHelper
{
public static bool Has2015SubscriptionRelease
{
get
{
return typeof(Autodesk.Revit.DB.Workset).GetMethod("Create") != null;
}
}
}
The Workset.Create method is only available with this Subscription Release.
Now you may 2 DLLs, one compiled for the RTM and another for the Subscription Release. For a Ribbon, try something like:
public class MyApp : IExternalApplication
{
public Result OnStartup(UIControlledApplication a)
{
PushButtonData pbd = new PushButtonData("MY_CMD", "My command",
VersionHelper.Has2015SubscriptionRelease ? "2015_SubsRelease.dll" : "2015_RTM.dll",
"Namespace.ClassName");
RibbonPanel pnl = a.CreateRibbonPanel("Version test");
pnl.AddItem(pbd); // this button will point to the correct DLL
return Result.Succeeded;
}
}