Hide Table of Contents

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

  1. Click Start > Programs > Microsoft Visual Studio version_number > Microsoft Visual Studio version_number.

  2. Select Tools > Options > Projects and Solutions > General > Save new projects when created.

  3. Click the New Project button or select File > New > Project.

  4. Select Visual Basic > SwVBAddin from the templates list. 

  5. Type the name of your project in Name.

  6. Type the location of your project in Location.

  7. 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:



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Using SOLIDWORKS VB.NET Add-In Template to Create a VB.NET Add-In
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:



x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2015 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.