© 2010 Autodesk
Introduction to Revit 2011 API
外部アプリケーション
OnStartup メソッドで UIコンポーネントと外部コマンドの関連付け
§
<VB.NET>
''  set the information about the command we will be assigning to the button
        Dim pushButtonDataHello As New PushButtonData("PushButtonHello", "Hello World", m_assembly, "RevitIntroVB.HelloWorld")
        ''  add a button to the panel
        Dim pushButtonHello As PushButton = panel.AddItem(pushButtonDataHello)
        ''  add an icon
        ''  make sure you references to WindowsBase and PresentationCore, and import System.Windows.Media.Imaging namespace.
        pushButtonHello.LargeImage = New BitmapImage(New Uri(m_imageFolder + "ImgHelloWorld.png"))
        ''  add a tooltip
        pushButtonHello.ToolTip = “押しボタン"
</VB.NET>
外部アプリケーションのOnStartupでは、通常UIこのコンポーネントを追加して、それに外部コマンドを関連付けます。この例は押しボタンをRevit ユーザインターフェスに追加して、それを押すとHello World外部コマンドが実行されるようにしています。Revit ユーザインターフェスに関しては後ほどご説明いたします。