|
![]() |
How to create a plug-in for Navisworks that displays the 'Hello World' message to the user. The result of this can be found in the 'BasicPlugin' sample.
This example can be found in: '<drive>:\Program Files\Autodesk\Navisworks <Product> 2015\api\net\examples\PlugIns\BasicPlugIn'.
Overview
Step | Key Information |
---|---|
Create Blank Project | |
Add API Reference | Autodesk.Navisworks.Api.dll |
Add any other references | System.Windows.Forms |
Add implementation | |
Build | |
Copy output assembly to structured directory in 'Plugins' directory | The 'Plugins' directory is located in the Navisworks installation directory |
Hello World! |
To create a plug-in
-
Create a Class library project called BasicPlugin.
-
Add the API assembly references required.
-
Add any other references required.
-
Insert the code required to display a message box on screen:
CopyHello World!
using System; using System.Collections.Generic; using System.Windows.Forms; using System.Text; //Add two new namespaces using Autodesk.Navisworks.Api; using Autodesk.Navisworks.Api.Plugins; namespace BasicPlugIn { [PluginAttribute("BasicPlugIn.ABasicPlugin", //Plugin name "ADSK", //4 character Developer ID or GUID ToolTip = "BasicPlugIn.ABasicPlugin tool tip",//The tooltip for the item in the ribbon DisplayName = "Hello World Plugin")] //Display name for the Plugin in the Ribbon public class ABasicPlugin : AddInPlugin //Derives from AddInPlugin { public override int Execute(params string[] parameters) { MessageBox.Show(Autodesk.Navisworks.Api.Application.Gui.MainWindow, "Hello World"); return 0; } } }
-
Build the project and copy assembly into a structure in the Plugins directory of Navisworks
- <drive>:\Program Files\Autodesk\Navisworks <Product> 2015\Plugins\BasicPlugin.ADSK
- This can be done using a post-build step
-
Run Navisworks and select the plugin from the 'Add-Ins' tab.
-
Hello World!