Using the SolidWorks VB.NET Add-in Template to Create a Visual Basic .NET Add-in
This topic describes how to use the SolidWorks
VB.NET Add-in Template to create a Visual Basic .NET add-in in Microsoft
Visual Studio .NET 2005 or later. This topic also identifies and describes
the classes provided by the template. Click a link to read that section.
NOTES:
Creating a Visual Basic .NET Add-in using the
SolidWorks VB.NET Add-in Template
Click Start > Programs
> Microsoft Visual Studio version_number > Microsoft
Visual Studio version_number.
-
Select Tools > Options > Projects and Solutions > General > Save new
projects when created.
Click the New
Project button or select File > New > Project.
-
Select Visual Basic > SwVBAddin
from the templates list.
-
Type the name of your project in Name.
-
Type the location of your project in Location.
-
Click OK.
Wait for the SolidWorks VB.NET Addin
Template to set up
your add-in's project files and to locate your SolidWorks directory.
Back to top
Examining Visual Basic .NET Add-In Classes
These classes are created by the SolidWorks
VB.NET Add-in Template:
Class |
Description |
AssemblyInfo.vb |
This file provides a means to organize and publish assembly-specific
information. |
EventHandling.vb |
This file contains the event handling objects for
documents and model views. The DocumentEventHandler object is a base
class that exposes the interface and contains code for dealing with
ModelView events.
PartEventHandler, AssemblyEventHandler, and DrawingEventHandler are
the three object types that can listen for document events. There
must be one instance of each class for each open document of that
type.
The ModelViewEventHandler object listens for ModelView events.
There should be one instance of ModelViewEventHandler for each
ModelView in each open document.
|
PMPHandler.vb |
This file contains the class that implements the
PropertyManager page handler interface. An instance of this object
is passed to SolidWorks when creating a PropertyManager page. When a
control on the page is manipulated, the corresponding function or
subroutine in
this object is called. |
SwAddinn.vb |
This file contains the main add-in class. Visual Studio
adds the letter n to the default name SwAddin, if more than one project
by that name exists in the same
location. Examine the code in
each region of this file:
Region |
Description |
Local Variables |
Contains the definitions of this class's
variables |
SolidWorks Registration |
Contains functions to register and unregister the
add-in |
ISwAddin Implementation |
Contains ConnectToSW() and DisconnectFromSW() which
are the entry and exit points for the add-in |
UI Methods |
Contains functions and subroutines that define how
the add-in behaves within the SolidWorks
application |
Event Methods |
Contains SolidWorks event handling functions and
subroutines |
Event Handlers |
Contains the event callbacks for the SolidWorks
object |
UI Callbacks |
Contains functions and subroutines that are called
from the add-in user interface |
|
UserPMPage.vb |
This file contains the wrapper class and layout methods
for the add-in's PropertyManager page. To modify the controls on the
PropertyManager page, change the code in the AddControls()
subroutine.
Add all controls to group boxes. Group boxes are displayed top to
bottom in the order in which they are added to the page. Controls
are displayed top to bottom in the order in which they are added to
the group box. |
Back to top
To learn more about add-ins and their menu items and toolbars: