特定の修正や互換性のある API があるために、アドインを操作するために Revit の特定の Update Release が必要になることがあります。次のサンプル コードは、Revit のバージョンが初期の既知の Revit リリースの後の Update Release であるかどうかを判断するための方法を表しています。
コード領域: アドインに互換性があるかどうかを判断するために VersionBuild を使用 |
public void GetVersionInfo(Autodesk.Revit.ApplicationServices.Application app) { // 20110309_2315 is the datecode of the initial release of Revit 2012 if (app.VersionNumber == "2012" && String.Compare(app.VersionBuild, "20110309_2315") > 0) { TaskDialog.Show("Supported version", "This application supported in this version."); } else { TaskDialog dialog = new TaskDialog("Unsupported version."); dialog.MainIcon = TaskDialogIcon.TaskDialogIconWarning; dialog.MainInstruction = "This application is only supported in Revit 2012 UR1 and later."; dialog.Show(); } } |