It is not complex to create a Navisworks plugin if we only want the very basic features such as the default ribbon button and manual deployment of the plugin.
We create a Class Library project, reference the very necessary API assembly, autodesk.navisworks.api.dll, which can be found in the Navisworks product installation folder either Manage or Simulate, into the project, and replace the default Class1.cs with the following code.
#Region "Namespaces"
Imports System.Text
Imports System.Linq
Imports System.Xml
Imports System.Reflection
Imports System.ComponentModel
Imports System.Collections
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Media.Imaging
Imports System.Windows.Forms
Imports System.Drawing
Imports System.IO
Imports Autodesk.Navisworks.Api
Imports Autodesk.Navisworks.Api.Plugins
#End Region
Namespace NavisworksNetAddinVB1
<PluginAttribute("NavisworksNetAddinVB1.Plugin2010VB1", _
"NNAW", _
ToolTip:="Plugin", _
DisplayName:="Plugin2010VB1")> _
Public Class Plugin2010VB1
Inherits AddInPlugin
#Region "AddInPlugin Members"
Public Overrides Function Execute(ByVal ParamArray parameters As String()) As Integer
'TODO: add your own code below.
MessageBox.Show("Hello, this is Plugin2010VB1.")
Return 0
End Function
#End Region
End Class
End Namespace
However, if we want more features like using a custom ribbon button for our plugin, automatically deploying the plugin for it to be found and loaded by the expected Navisworks product and flavor properly when testing and debuggin, and adding various event handlers, there are pretty plenty of work to do. Do not worry, fortunately, the leading edge Nawisworks .NET Addin Wizard (NawisworksNetAddinWizard) can help us do all of these in a moment, which can be found and downloaded from the A Wizard for Nawisworks .NET Addin page.
Posted by: |