Build the solution and fix bugs.
As part of the build, the Addin registers automatically for you with Intent.
Open an Assembly. On the ribbon, UIToolsDockableWindow.Addin tab, three buttons display:
This behavior is the default for an Inventor Addin.
To finish, clean up the Addin, and create an instance of the dockable window.
Edit UserInferfaceComponents.cs
- In the organizational UI folder of the project, open the file
UserInterfaceComponents.cs. This class defines the components of the user interface for the Addin.
- The buttons, or many of the generated methods for our add-in are not necessary. In the class UserInterfaceComponents, remove:
- Everything except the constructor, and the Activate method
- The implementation inside the constructor and Activate method.
- Add a variable of the type ApplicationAddInSite to the UserInterfaceComponents class.
the implementation inside the constructor and Activate method.
- Add a variable to hold an instance of our DockableWindow to the UserInterfaceComponents class.
private UIToolsDockableWindow uiToolsDockableWindow;
- Initialize this variable to the ApplicationAddInSite parameter in the constructor for the UserInterfaceComponents class.
internal UserInterfaceComponents( ApplicationAddInSite addInSite)
{
m_addInSite = addInSite;
}
The m_addInSite variable holds the ApplicationAddInSite locally, to use when you create the Dockable Window after Intent initializes.
- Create a method to instantiate, and show the dockableWindow object.
internal void createDockableWindow()
{
uiToolsDockableWindow = new UIToolsDockableWindow (m_addInSite);
uiToolsDockableWindow.Show();
}
In this method, we use the default value for the DockingStateEnum parameter. To dock the window a different position than the default, add an Inventor.DockingStateEnum parameter to the constructor call. We call the new method createDockableWindow after Intent initializes.
Edit IntentModel.cs
- Open the file IntentModel.cs in the root of the project.
- In the constructor, remove:
- Lines that add event handlers to the buttons on the gui, since the buttons no longer exist.
- "ImportModelButton_OnExecute" method.
- "ExportModelButton_OnExecute" method.
In the IntentModel class, the variable m_gui holds an instance of UserInferfaceComponents. Use this variable to call the method made earlier to create the dockable window.
- Add a call to our method as the last line of the IntentInitialized method.
m_gui.createDockableWindow();
With the addition of this call, Intent initializes, and you can create the UIInventorProject successfully.
Build Completed Addin
- Build the project again.
- Open an Inventor assembly that uses intent and is configured for UITools.
- A dockable window add-in displays. If necessary, resize some of the existing dockable windows to view the custom add-in.