Welcome to the eleventh tutorial of Navisworks® API
series, this post is to cover a different type of plugin called “DockPanePlugin“, which can be used to add custom Dockable Panes into the Navisworks GUI system. In this tutorial, we will create a Dockable Pane with a WPF (Windows Presentation Foundation) Control to host a Web Browser.
Setting up Navisworks® Add-Ins project in the visual studio, you can follow Creating Navisworks Add-Ins
tutorial to set up the project. After setting up the the project add two attributes: Plugin
& DockPanePlugin
and interface change to DockPanePlugin
, we’ll also need to override two methods: CreateControlPane
– called to tell the plugin to create it’s pane and DestroyControlPane
– called to tell the plugin to destroy it’s pane. (figure 1.0)

In the CreateControlPane
method, ElementHost control is a Windows Forms control that can be used to host a WPF (Windows Presentation Foundation) element. Assign our WPFControl (we’ll create later..) control’s properties, AutoSize & Child, and called CreateControl method is to force to handle immediately for manipulation of the our dockable pane (WPFControl). DestroyControlPane
method is to dispose and release all the resources used by our dockable pane. (figure 1.1)

Next to add a WPF User Control(XAML file) “WPFControl” to host a web browser that will display our dockable pane. (figure 1.2).

We just have to add a WebBrowser tag with Name and Source (a webpage to navigate and display). (figure 1.3)

In WPFControl.xaml.cs
, we’ll subscribe WebBrowser’s Navigated Event with a callback method to hide unwanted JavaScript pop-up dialogs during web page loading. (figure 1.4)

What this callback, HideScriptErrors, method does is set the .Silent property on the underlying activeX object which is the same as the .ScriptErrorsSuppressed property which is the Windows forms equivalent. (Got it from a stackoverflow answer.) (figure 1.5)

We’ll add Post-build Command line for debugging purpose. (figure 1.6)
In Build Events tab, edit Post-build event : xcopy /Y "$(TargetDir)." "D:\Autodesk\Navisworks Manage 2020\Plugins\$(TargetName)\"
– to copy the output dll
file.

Finally, change the platform solution to x64
, add external program to Navisworks’ Roamer.exe
and click Start
. (figure 1.7)

After Navisworks Application has launched, you can find our Dockable Pane in Navisworks GUI > View Tab > Windows Dropdown, check to display in the UI.

That’s all for this tutorial, you can get the complete source code from here, Cheers!