Navisworks .NET Addin Wizard (NavisworksNetAddinWizard) build #0.9.8 has been rolled out for some days. It has five more Navisworks Addin Widget items added, LIB Locator, LIB Organizer, LIB Upgrader, Project Inspector, and Debug EXE Setter; two more Navisworks Addin Coder items, Data Collector, and Namespace Replacer.
We demonstrated each of the new widgets and coders one by one earlier.
It also provides nine more item wizards, AddInPlugin Creator, CommandHandlerPlugin Creator, CustomPlugin Creator, DockPanePlugin Creator, EventWatcherPlugin Creator, FileProtocolPlugin Creator, InputPlugin Creator, RenderPlugin Creator, and ToolPlugin Creator.
In this post, let’s demonstrate how to use the CommandHandlerPlugin Creator to help us create a Navisworks .NET AddinPlugin nicely shortly.
The Navisworks .NET CommandHandlerPlugin Item Wizard can be found from the Navisworks Addin node in the Add New Item dialog as usual.
After an item name is provided, the Plug Attributes dialog will nicely show up regardless of how many attributes may be and how complex they are.
The auto-generated CommandHandlerPlugin source file may look like this.
using System;
using System.Text;
using System.Linq;
using System.Xml;
using System.Reflection;
using System.ComponentModel;
using System.Collections;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Media.Imaging;
using System.Windows.Forms;
using System.Drawing;
using System.IO;
using Microsoft.Win32;
using System.Runtime.InteropServices;
using Autodesk.Navisworks.Api;
using Autodesk.Navisworks.Api.Plugins;
using Autodesk.Navisworks.Api.DocumentParts;
using Autodesk.Navisworks.Api.ApplicationParts;
namespace NavisworksNetAddinCS1
{
[CommandAttribute("NavisworksNetAddinCS1.CommandHandlerPlugin1",
CallCanExecute = CallCanExecute.CurrentSelectionSingle,
CanToggle = true,
DisplayName = "CommandPlugin",
ExtendedToolTip = "This is Command Plugin.",
Icon = "c:\temp\test.ico",
LargeIcon = "c:\temp\test.ico",
LoadForCanExecute = true,
Shortcut = "Alt+Shift+F10",
ShortcutWindowTypes = "",
ToolTip = "My CommandPlugin"), PluginAttribute("NavisworksNetAddinCS1.CommandHandlerPlugin1", "NNAW",
DisplayName = "Plugin",
ExtendedToolTip = "This is My Plugin.",
Options = PluginOptions.SupportsControls,
SupportsIsSelfEnabled = true,
ToolTip = "My Plugin.")]
public class CommandHandlerPlugin1 : Autodesk.Navisworks.Api.Plugins.CommandHandlerPlugin
{
public override CommandState CanExecuteCommand(string name)
{
return default(CommandState);
}
public override bool CanExecuteRibbonTab(string name)
{
return default(bool);
}
public override int ExecuteCommand(string name, params string[] parameters)
{
return default(int);
}
public override bool TryShowCommandHelp(string name)
{
return default(bool);
}
}
}
Enjoy it, guys!
The leading edge Navisworks .NET Addin Wizard (NavisworksNetAddinWizard) can be found and downloaded from the A Wizard for Navisworks .NET Addin page.