Hi,
Plus what you have emailed me in private, you have misunderstood the following:
1) CommandHandlerPlugin is just to create Ribbon interfaces. It cannot create the Dock Pane Window. You must write a DockPanePlugin to create your Dock Pane Window. Please refer to the SDK sample BasicDockPanePlugin.
2) As the SDK code explains: The ability of the attribute ShortcutWindowTypes of CommandHandlerPlugin is:
If you have defined a DockPanePlugin, you can specify that the Shortcut only applies when that window is active. Use the Id for the DockPanePlugin. This attribute is just to specify if the shortcut can work or not.
Then, what ShortcutWindowTypes works for? Assume we have had a DockPanePlugin e.g. BasicDockPanePlugin. And in CommandHandlerPlugin, we define a command e.g.
[Command("ID_Button_3",
CanToggle = true,
Shortcut="Shift+Z")]
In default, the shortcut can work anytime when we press “Shift+Z”. But if we add the attribute ShortcutWindowTypes
,
[Command("ID_Button_3",
CanToggle = true,
Shortcut = "Shift+Z",
ShortcutWindowTypes = "BasicDockPanePlugin.BasicDockPanePlugin.ADSK")]
What will happen?
- If the window of BasicDockPanePlugin is not displayed and not activate(Activate means it is being focused), the shortcut will NOT work anymore.
- If the window of BasicDockPanePlugin is displayed and activate, the shortcut will work as normal.
In a word, this attribute is just to specify if the shortcut can work or not. In addition, when you set ShortcutWindowTypes, please make sure to set the correct ID (name) of the DockPanePlugin. Otherwise, the shortcut will still work.
Hope this explains.
Back to your original question: how can I make my dock pane window visible when a button of my Ribbon clicked?
Every dock pane window is linked with one DockPanePlugin. In the execute function of the Ribbon button, you can get the plugin by AddInPluginRecord (searching by its name). And call DockPanePlugin.Visible = true. e.g.
DockPanePlugin oDockPlugin =
(DockPanePlugin)Autodesk.Navisworks.Api.Application.Plugins.FindPlugin("BasicDockPanePlugin.BasicDockPanePlugin.ADSK").LoadedPlugin;
oDockPlugin.Visible = true;
Hi,
I have solved the problem about link a DockPane to the CustomRibbon.
Then an problem appears: how can I make the selection tree shown in the DockPane?
Thx.
Firstly, if your further question is not related with the original question, I suggest you create a new post thus if any developer has answer, he may be interested in jumping into to help you.
You have confused something. There is NOT any .NET API to provide the Selection Tree as same as the product displays. It completely requires you to build the tree yourself. When you have a dock pane, you can place Tree View control of Windows. This control is managed by yourself. thus you can add any nodes and construct its hierarchy. While the model hierarchy of Navisworks is exposed in terms of tree hierarchy. Each node is a ModelItem. So the simplest way is to iterate the model from RootItem, its children, to its decadences, and add them one by one to the Tree View control.
I would suggest you take a look at the MSDN help to get started with Tree View control. And there are many posts on web on Tree View control.
http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview.aspx