Top Banner
Create a custom PropertyManager page for a SolidWorks ® add-in using the SolidWorks API and either the SolidWorks VB.NET add-in template or the SolidWorks C# add-in template. Because these tutorials launch their own sessions of SolidWorks, please close the current session of SolidWorks and open outside of SolidWorks install_dir\lang\english\otadvancedapi.chm. These tutorials reference API Help throughout, so also keep open API Help outside of SolidWorks, install_dir\api\APIHelp.chm. Click a link to open a SolidWorks custom PropertyManager page add-in tutorial. z C# z VB.NET This tutorial shows you how to create a custom SolidWorks ® PropertyManager page for an add-in using the SolidWorks SwCSharpAddin template and API. Experience programming in C# in Microsoft ® Visual Studio .NET is a prerequisite of the tutorial. Carefully read all parts of this tutorial. The screen shots appearing in many steps show you where and how to modify your C# project. Examine the highlighted code. For your convenience, three fully implemented classes, whose code you can reference and copy and paste into your C# project, are included with this tutorial. See SwAddin.cs, UserPMPage.cs, PMPHandler.cs in Completed C# Addin. In this tutorial, you learn how to: z Install the SolidWorks API Software Development Kit (SDK). z Use the SolidWorks SwCSharpAddin template to create a C# add-in project in Microsoft Visual Studio .NET. z Compile and run the add-in. z Design the PropertyManager page for the add-in. z Modify the PropertyManager page and add-in. The SolidWorks API SDK contains add-in templates for VB.NET, C#, and C++. When you install the SolidWorks API SDK, the templates are copied to various directories. 1. Ensure that you have installed Microsoft ® Visual Studio .NET (2008 or later) and a compatible version of Microsoft ® .NET Framework. 2. For instructions on how to download the SolidWorks API SDK, open API Help > SolidWorks API Help > Getting Started > Overview. 3. Click Next on the Welcome to the InstallShield Wizard for SolidWorks API SDK page. 4. Click Install on the Ready to Install the Program page. 5. Click Finish on the InstallShield Wizard Completed page. Use the SolidWorks SwCSharpAddin template from the SolidWorks API SDK to create a C# add-in project in Microsoft Visual Studio. 1. Open Microsoft Visual Studio. 2. Verify that Tools > Options > Project and Solutions > General > Save new projects when created is selected. 3. Create a new Visual C# project. Custom PropertyManager Page Add-in Tutorial Overview C# Overview Installing the SolidWorks API SDK Using the SolidWorks C# Add-in Template NEXT TOPIC Installing the SolidWorks API SDK PREVIOUS TOPIC Installing the SolidWorks API SDK NEXT TOPIC Compiling and Running the Add-in PREVIOUS TOPIC Using the SolidWorks C# Add-in Template NEXT TOPIC Designing a PropertyManager Page PREVIOUS TOPIC Compiling and Running the Add-in NEXT TOPIC Expanding a Group on Startup PREVIOUS TOPIC Designing a PropertyManager Page NEXT TOPIC Changing Titles and Location of Controls PREVIOUS TOPIC Expanding a Group on Startup NEXT TOPIC Adding a Button Control PREVIOUS TOPIC Changing Titles and Location of Controls NEXT TOPIC Adding Multiple Tabs PREVIOUS TOPIC Adding a Button Control NEXT TOPIC Removing Unused Controls and Event Handlers PREVIOUS TOPIC Adding Multiple Tabs NEXT TOPIC Configuring Selection and Numberbox Controls PREVIOUS TOPIC Removing Unused Controls and Event Handlers NEXT TOPIC Modifying Control Event Handlers PREVIOUS TOPIC Configuring Selection and Numberbox Controls NEXT TOPIC Modifying Numberbox and Button Control Event Handlers PREVIOUS TOPIC Modifying Control Event Handlers NEXT TOPIC Adding Visual Cues PREVIOUS TOPIC Modifying Numberbox and Button Control Event Handlers NEXT TOPIC Adding Icons to Title Bar and Controls PREVIOUS TOPIC Adding Visual Cues NEXT TOPIC Changing Alignment of Controls PREVIOUS TOPIC Adding Icons to Title Bar and Controls NEXT TOPIC Installing the SolidWorks API SDK PREVIOUS TOPIC C# Overview NEXT TOPIC Using the SolidWorks C# Add-in Template PREVIOUS TOPIC VB.NET Overview NEXT TOPIC Using the SolidWorks VB.NET Add-in Template PREVIOUS TOPIC Installing the SolidWorks API SDK NEXT TOPIC Compiling and Running the Add-in PREVIOUS TOPIC Using the SolidWorks VB.NET Add-in Template NEXT TOPIC Designing a PropertyManager Page PREVIOUS TOPIC Compiling and Running the Add-in NEXT TOPIC Expanding a Group on Startup PREVIOUS TOPIC Designing a PropertyManager Page NEXT TOPIC Changing Titles and Groups PREVIOUS TOPIC Expanding a Group on Startup NEXT TOPIC Adding a Button Control PREVIOUS TOPIC Changing Titles and Groups NEXT TOPIC Adding Multiple Tabs PREVIOUS TOPIC Adding a Button Control NEXT TOPIC Removing Unused Controls and Event Handlers PREVIOUS TOPIC Adding Multiple Tabs NEXT TOPIC Configuring Selection and Numberbox Controls PREVIOUS TOPIC Removing Unused Controls and Event Handlers NEXT TOPIC Modifying Control Event Handlers PREVIOUS TOPIC Configuring Selection and Numberbox Controls NEXT TOPIC Modifying Numberbox and Button Control Event Handlers PREVIOUS TOPIC Modifying Control Event Handlers NEXT TOPIC Adding Visual Cues PREVIOUS TOPIC Modifying Numberbox and Button Control Event Handlers NEXT TOPIC Adding Icons to Title Bar and Controls PREVIOUS TOPIC Adding Visual Cues NEXT TOPIC Changing Alignment of Controls PREVIOUS TOPIC Adding Icons to Title Bar and Controls Page 1 of 39 Custom PropertyManager Page Add-in Tutorial Overview 02-05-2015 file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm
39
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • Create a custom PropertyManager page for a SolidWorks add-in using the SolidWorks API and either the SolidWorks VB.NET add-in template or theSolidWorks C# add-in template.

    Because these tutorials launch their own sessions of SolidWorks, please close the current session of SolidWorks and open outside of SolidWorks install_dir\lang\english\otadvancedapi.chm. These tutorials reference API Help throughout, so also keep open API Help outside of SolidWorks, install_dir\api\APIHelp.chm. Click a link to open a SolidWorks custom PropertyManager page add-in tutorial.

    C#VB.NET

    This tutorial shows you how to create a custom SolidWorks PropertyManager page for an add-in using the SolidWorks SwCSharpAddin template and API.

    Experience programming in C# in Microsoft Visual Studio .NET is a prerequisite of the tutorial. Carefully read all parts of this tutorial. The screen shots appearing in many steps show you where and how to modify your C# project. Examine the highlighted code. For your convenience, three fully implemented classes, whose code you can reference and copy and paste into your C# project, are included with this tutorial. See SwAddin.cs, UserPMPage.cs, PMPHandler.cs in Completed C# Addin.

    In this tutorial, you learn how to:

    Install the SolidWorks API Software Development Kit (SDK).Use the SolidWorks SwCSharpAddin template to create a C# add-in project in Microsoft Visual Studio .NET.Compile and run the add-in.Design the PropertyManager page for the add-in.Modify the PropertyManager page and add-in.

    The SolidWorks API SDK contains add-in templates for VB.NET, C#, and C++. When you install the SolidWorks API SDK, the templates are copied to various directories.

    1. Ensure that you have installed Microsoft Visual Studio .NET (2008 or later) and a compatible version of Microsoft .NET Framework.

    2. For instructions on how to download the SolidWorks API SDK, open API Help > SolidWorks API Help > Getting Started > Overview.

    3. Click Next on the Welcome to the InstallShield Wizard for SolidWorks API SDK page.

    4. Click Install on the Ready to Install the Program page.

    5. Click Finish on the InstallShield Wizard Completed page.

    Use the SolidWorks SwCSharpAddin template from the SolidWorks API SDK to create a C# add-in project in Microsoft Visual Studio.

    1. Open Microsoft Visual Studio.

    2. Verify that Tools > Options > Project and Solutions > General > Save new projects when created is selected.

    3. Create a new Visual C# project.

    Custom PropertyManager Page Add-in Tutorial Overview

    C# Overview

    Installing the SolidWorks API SDK

    Using the SolidWorks C# Add-in Template

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 1 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 4. Locate and select the SolidWorks add-in template, SwCSharpAddin, from the list of Visual C# installed templates.

    5. Type PropertyManagerPageAddin in Name.

    6. Browse to the folder where to save the project in Location.

    7. Click OK.

    Solution Explorer displays a C# add-in project tree.

    8. Click Show All Files in Solution Explorer to view all of the references, add-in classes, and bitmap files that you can use or modify for your application.

    References

    C# Add-in Classes

    Bitmap Files

    Compile and run the add-in that is created by the SolidWorks SwCSharpAddin template.

    1. Ensure that no SolidWorks sessions are running.

    2. To debug in Visual Studio, point the debugger's start program to your SolidWorks executable by right-clicking the project in Solution Explorer.

    3. Select Properties, click the Debug tab, select Start external program, and click to navigate to the SolidWorks executable on your system.

    4. Click Start Debugging in the Microsoft Visual Studio IDE toolbar to compile and run the add-in and start SolidWorks.

    5. Select C# Addin > CreateCube in SolidWorks.

    Compiling and Running the Add-in

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 2 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • Boss-Extrude1 is added to the FeatureManager design tree.

    To see the C# Addin tab in CommandManager, select View > Toolbars > CommandManager.

    6. Select C# Addin again.

    7. Select Show PMP.

    The add-in's Sample PMP PropertyManager page is displayed on the PropertyManager tab.

    8. Select the Sample Group 2 checkbox to expand it.

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 3 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 9. Mouse over each control to see its tooltip.

    10. Click Stop Debugging in the Microsoft Visual Studio IDE toolbar.

    SolidWorks closes.

    Now that you have seen what the SwCSharpAddin template created, it is time to design the PropertyManager page to do some useful work.

    The first step in any good design is to define the use cases or tasks that the PropertyManager page provides. After defining the use cases, think about the user interface and behavior needed to implement the use cases. Paper or software mock-ups improve usability, especially if tested by several users.

    Because you are using the SolidWorks API SDK and the SolidWorks API to implement the use cases of your PropertyManager page, keep in mind during the design:

    the types of user-interface controls supported by the SolidWorks API. See SolidWorks API Help > Getting Started > Programming with the SolidWorks API > PropertyManager Pages > Using IPropertyManagerPage2.the limits on the number of each type of control on any PropertyManager page. See SolidWorks API Help > SolidWorks APIs > SolidWorks.Interop.sldworks Namespace > Interfaces > IPropertyManagerPage2.

    The SwCSharpAddin template created two classes for the PropertyManager page of its add-in:

    UserPMPage.csPMPHandler.cs

    Using these classes as a starting point, you will use the SolidWorks API to change the add-in's user interface and behavior. The add-in's PropertyManager page looks and feels similar to the other SolidWorks PropertyManager pages, but it also has a specialized workflow.

    Your add-in's PropertyManager page workflow will:

    1. Select an edge.2. Modify its length.3. Rebuild the model.

    The workflow uses a few of the controls from the template add-in:

    Selection boxSpin/combo boxButton

    To implement this workflow, your add-in will:

    expand a group of controls on startup.change titles, selection filters, and locations of controls.add a button control to a group box.add multiple tabs.remove unused controls.resize the extrusion.add standard icon labels to controls.align a control.

    Currently one group box displays with a checkbox that configures the visibility of the contents on startup. You want the group box contents to be always visible on startup, so you must change the options on the group box.

    1. Double-click UserPMPage.cs in Solution Explorer to open it in the Microsoft Visual Studio editor.

    Designing a PropertyManager Page

    Expanding a Group on Startup

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 4 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 2. To increase the size of the editor pane, close the Solution Explorer window by clicking X in its title bar.

    3. Locate the protected void AddControls() method in the code.

    4. Add swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded and remove swAddGroupBoxOptions_e.swGroupBoxOptions_Checkbox from group2's options bitmask. Because this is the same options setting as for group1, you can simply comment out the second options assignment. The same options parameter is then passed to the AddGroupBox()constructor for both group boxes. To learn more about the bitmask enumeration swAddGroupBoxOptions_e, see SolidWorks API Help > SolidWorks Enumerations > SolidWorks.Interop.swconst Namespace > Enumerations > swAddGroupBoxOptions_e.

    5. Click Start Debugging in Microsoft Visual Studio.

    SolidWorks starts up.

    6. Select C# Addin > Create Cube in SolidWorks.

    7. Select C# Addin > Show PMP.

    Sample Group 2 is now expanded on start-up, and the checkbox is removed.

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 5 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 8. Click Stop Debugging in the IDE.

    Change the titles of your PropertyManager page and its group boxes and move controls from one group to another.

    1. Locate the protected void CreatePropertyManagerPage() method and change the title string for swPropertyPage from "Sample PMP" to"Extrusion PMP".

    2. In the AddControls() method, change the title string for group1 from "Sample Group 1" to "Modify Extrusion".

    3. Change the title string for group2 from "Sample Group 2" to "Rebuild the Model".

    4. Change selection1 from group2 to group1 and change num1 from group2 to group1.

    Changing Titles and Location of Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 6 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 5. Click to compile and run the add-in.

    6. Select C# Addin > Create Cube and Show PMP.

    7. Verify your changes by inspecting the Extrusion PMP PropertyManager page.

    8. Click to stop the debugger.

    Add a button control to group2.

    1. Locate #region Property Manager Page Controls.

    2. Declare button1 of type IPropertyManagerPageButton and declare unique control ID, button1ID.

    Adding a Button Control

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 7 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 3. At the beginning of the AddControls() method, controlType, align, and options variables are declared. In AddControls(), immediately before //selection1, assign these variables to control type, alignment, and visibility options as defined in the SolidWorks enumerators,swPropertyManagerPageControlType_e, swPropertyManagerPageControlLeftAlign_e, swAddControlOptions_e.

    4. Immediately after the controlType, align, and options assignments for button1, add the button1 control to group2 with a Redraw label, Click toredraw tooltip, controlType, align, and options parameters.

    5. Click to compile and run the add-in.

    6. Select C# Addin > Create Cube and Show PMP.

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 8 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 7. Click to stop the debugger.

    Multiple tabs in the PropertyManager page give users more functionality and help organize tasks into a workflow.

    1. Declare IPropertyManagerPageTab variables tab1 and tab2 and unique values for control IDs, tab1ID and tab2ID.

    2. At the beginning of AddControls(), add two tab controls with captions Step 1 and Step 2.

    Adding Multiple Tabs

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 9 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 3. At the end of AddControls(), add group1 to tab1, add group2 to tab2, and activate tab1 on startup.

    4. Open SwAddin.cs in the editor.

    5. In #region Property Manager Variables, change the scope of ppage to public so that other classes can access the UserPMPage object at runtime.

    6. In UserPMPage.cs, add public method DisplayControls() which sets visibility of the group on each tab depending on the tab ID input parameter.

    7. Open PMPHandler.cs in the editor.

    8. Add code to the OnTabClicked() event handler to call UserPMPage.DisplayControls() to hide and display controls according to tab selection.

    9. In UserPMPage.cs, initialize tab1 with a call to DisplayControls() after activating the tab.

    10. Compile and run the add-in.

    11. Select C# Addin > Create Cube C# and Show PMP.

    Two tabs display in the Extrusion PMP PropertyManager page. Each tab contains a different set of controls.

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 10 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 12. Stop the debugger.

    Remove controls and event handlers that are not being used.

    1. In UserPMPage.cs in #region Property Manager Page Controls, remove or comment out all control declarations except button1, selection1, and num1. Do not delete the tab and group declarations.

    2. Remove or comment out all control IDs except group1ID, group2ID, tab1ID, tab2ID, selection1ID, num1ID, button1ID.

    Removing Unused Controls and Event Handlers

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 11 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 3. In AddControls(), remove or comment out assignments for textbox1, checkbox1, option1, option2, option3, list1, and combo1 and all of theircontrolType, align, and options assignments and other related code.Because PMPHandler.cs must fully implement the interface IPropertyManagerPage2Handler9, do not delete any event handling methods from PMPHandler.cs. AfterClose() and OnClose() must contain code to prevent the .NET runtime environment from performing garbage collection at the wrong time. With the exception of AfterClose() and OnClose(), methods that do not return anything (i.e., declared void) can be empty.

    4. Click to compile and run the add-in.

    5. Show the Extrusion PMP PropertyManager page.

    The unused controls have been removed.

    6. Stop the debugger.

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 12 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • Change the options on two of the remaining controls in the PropertyManager page.

    The selection1 control should accept only one model edge.The num1 control should be initialized to a value of 0.0 mm.The tooltip for each control needs to be modified.

    1. In UserPMPage.cs in AddControls(), for selection1:Change the caption to "Selection".Change the tooltip to "Select an edge in the main view".Change filter to select only edges.Set the SingleEntityOnly property to true so that only one selection is allowed.Change the Height property from 40 to 25.

    2. For num1:Change the caption to "Edge Size".Change the tooltip to "Select an edge length".Change the starting spin box value from 50.0 to 0.0. Replace SetRange() with SetRange2().

    In SetRange2(), change: unit type to swNumberBox_Length.minimum to 0.0.maximum to 0.1.inclusive to true.increment to 0.001.fast increment to 0.005.slow increment to 0.0001.

    Set DisplayedUnit to swLengthUnit_e.swMM to display millimeters.

    3. Compile and run the add-in.

    4. Show the Extrusion PMP PropertyManager page.

    Configuring Selection and Numberbox Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 13 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 5. Stop the debugger.

    Complete the PropertyManager page workflow use case by modifying the event handlers of your three controls and adding some helper methods.

    The selection1 control displays the edge that a user clicks in the main view. The event handler for selection1, OnSubmitSelection(), returns some event information, including the selected edge, before submitting the selection to the selection box. Because edges in an extrusion are not features, they have no presence in the FeatureManager design tree and are difficult to identify. Therefore, you must give each edge of the extrusion a handle or ID. If you create the extrusion sketch along x and y axes using Create3PointCornerRectangle(), you know in advance what axis each edge is on. Then you can determine which axis of the extrusion needs to be resized for the selected edge at runtime.

    1. Open SwAddin.cs in the editor.

    2. Create public method StoreEdgeIds()in #region UI Callbacks to store IDs for all 12 edges in the extrusion.

    3. In #region Local Variables, declare public variables of type Edge for each edge and public variables, x, y, and extrusion of type double. Initialize x, y, and extrusion to 0.1. Also declare public variable modDoc.

    4. In CreateCube():

    Modifying Control Event Handlers

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 14 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • set x, y, and extrusion to .1.remove IModelDoc2 from modDoc declaration.replace modDoc.InsertSketch2 with modDoc.SketchManager.InsertSketch.replace modDoc.SketchRectangle with modDoc.SketchManager.Create3PointCornerRectangle.specify (0,0,0), (x,0,0), and (0,y,0) to align the sketch's x and y axes.replace FeatureExtrusion() with FeatureExtrusion2()in featMan.FeatureExtrusion2(), replace .1 with "extrusion".add a call to StoreEdgeIDs().

    5. Add a public method GetAxisOfSelectedEdge() in #region UI Callbacks, whose input parameter is the selected object from the event handler and whose return string contains the calculated axis.

    6. Add public String axis to #region Local Variables.

    7. Because GetAxisOfSelectedEdge() must populate the num1 control of UserPMPage with the current length of the selected edge, add public method SetNum1() in UserPMPage.cs to set the value of the private variable num1.

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 15 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 8. In PMPHandler.cs in OnSubmitSelection(), call userAddin.GetAxisOfSelectedEdge() to calculate the axis of the edge.

    9. Because PMPHandler needs to store the axis for later use, declare the axis variable at the top of PMPHandler.cs and initialize axis to "extrusion" in the constructor of the handler.

    The numberbox is a spin box control that displays the length of the selected edge. When the user types a value in numberbox the event handler, OnNumberboxChanged(), returns the value.

    The button control on the Step 2 tab rebuilds the model. The button's event handler OnButtonPress() calls a helper method to rebuild the model and complete the workflow.

    1. In PMPHandler.cs, declare double variable edgeSize and initialize it to .1 in the handler's constructor.

    2. In OnNumberboxChanged(), assign edgeSize to the handler's input parameter val.

    3. In SwAddin.cs in #region UI Callbacks, add public method ModifyCube(), which takes as input parameters edgeSize and axis, which are stored by the event handler. Like CreateCube(), ModifyCube() extrudes a sketch. Also like CreateCube(), ModifyCube() stores edge IDs. But unlike CreateCube(), ModifyCube() does not reset the extrusion parameters to 0.1, so that the user can continue to change edge lengths and re-extrude.

    Modifying Numberbox and Button Control Event Handlers

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 16 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 4. In PMPHandler.cs in OnButtonPress(), call userAddin.ModifyCube(), passing in edgeSize and axis to rebuild the cube.

    5. Compile and run the add-in.

    6. Show the Extrusion PMP PropertyManager page.

    7. Select an edge in the model view.

    The current length displays in the number box. Type a new length for the edge; for example, 50.

    8. Click Step 2 and Redraw and examine the cube to verify that the selected edge's length changed.

    9. Stop the debugger.

    In most PropertyManager pages, icons give the user a visual cue as to what a nearby control does. The SolidWorks user expects these visual cues.

    Add a length visual cue before the numberbox control and an edge visual cue before the selection control. Also, add a bitmap icon to the title bar.

    1. At the beginning of UserPMPage.cs, add using System.Reflection; and using SolidWorksTools.File;.

    Why Did I Add These Namespaces?

    2. In Windows Explorer, navigate to install_dir\samples\tutorial\api\addin.

    3. Copy pm_extruded_block.bmp to your add-in project, in the same subdirectory where the other project bitmap files reside.

    4. In Solution Explorer, right-click the project and select Add > Existing Item.

    5. Select pm_extruded_block.bmp and click Add.

    Adding Visual Cues

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 17 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 6. In Solution Explorer, right-click pm_extruded_block.bmp and select Properties.

    7. Click the down-arrow button in the Build Action row and change Content to Embedded Resource.

    Use the bitmap resource you just added to your project to add an icon to the title bar. Add standard SolidWorks icon labels to the controls of your PropertyManager page.

    1. At the top of UserPMPage.cs, declare variables iBmp and thisAssembly.

    2. In the constructor of UserPMPage, initialize iBmp and thisAssembly before calling CreatePropertyManagerPage().

    3. In CreatePropertyManagerPage(), use iBmp.CreateFileFromResourceBitmap() to create a runtime local file containing pm_extruded_block.bmp. Pass the local bitmap file to swPropertyPage.SetTitleBitmap2().

    Adding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 18 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • 4. In AddControls()after setting its selection filter, cast selection1 to IPropertyManagerPageControl and add standard SolidWorks bitmap label swBitmapLabel_SelectEdge to the control.

    5. In AddControls()after setting its display units, cast num1 to IPropertyManagerPageControl and add standard SolidWorks bitmap label swBitmapLabel_LinearDistance to the control.

    6. Compile and run the add-in.

    7. Show the Extrusion PMP PropertyManager page.

    The icons appear at the SolidWorks standard distance to the left of their controls on the PropertyManager page. The title icon appears in the title bar.

    8. Stop the debugger.

    By default, the alignment of each control is left-aligned and stacked vertically on the page as each control is added to the page or group (e.g., group.AddControl()). This is the best way to ensure a look and feel that emulates the SolidWorks PropertyManager pages. However, if you want to place controls differently, like in a single row, you can cast each control variable to IPropertyManagerPageControl and use Top(), Left() and Width() to set location and size in dialog units relative to the group box boundaries:

    Left edge is 0 dialog units.Right edge is 100 dialog units.Top edge is 0 dialog units.

    Changing Alignment of Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 19 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • Center the Redraw button using IPropertyManagerPageControl.

    1. In UserPMPage.cs in AddControls(), locate group2's button1.

    2. After group2.AddControl(), cast button1 to IPropertyManagerPageControl and set Left to 25.

    3. Compile and run the add-in.

    4. Verify the change in the Extrusion PMP PropertyManager page.

    5. Feel free to continue experimenting with controls alignment.

    Congratulations! You have completed this tutorial.

    Return to the tutorials overview page.

    This tutorial shows you how to create a custom SolidWorks PropertyManager page for an add-in using the SolidWorks SwVBAddin template and API.

    Experience programming in VB.NET in Microsoft Visual Studio .NET is a prerequisite of the tutorial. Carefully read all parts of this tutorial. The screen shots appearing in many steps show you where and how to modify your VB.NET project. Examine the highlighted code. For your convenience, three fully implemented classes, whose code you can reference and copy and paste into your VB.NET project, are included with this tutorial. See SwAddin.vb, UserPMPage.vb, PMPHandler.vb in Completed VB.NET Addin.

    In this tutorial, you learn how to:

    Install the SolidWorks API Software Development Kit (SDK).Use the SolidWorks SwVBAddin template to create a VB.NET add-in project in Microsoft Visual Studio .NET.Compile and run the add-in.Design the PropertyManager page for the add-in.Modify the PropertyManager page and add-in.

    The SolidWorks API SDK contains add-in templates for VB.NET, C#, and C++. When you install the SolidWorks API SDK, the templates are copied to

    VB.NET Overview

    Installing the SolidWorks API SDK

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICC# Overview

    NEXT TOPICUsing the SolidWorks C# Add-in Template

    PREVIOUS TOPICVB.NET Overview

    NEXT TOPICUsing the SolidWorks VB.NET Add-in Template

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks VB.NET Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Groups

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Groups

    NEXT TOPICAdding Multiple Tabs

    PREVIOUS TOPICAdding a Button Control

    NEXT TOPICRemoving Unused Controls and EventHandlers

    PREVIOUS TOPICAdding Multiple Tabs

    NEXT TOPICConfiguring Selection and Numberbox Controls

    PREVIOUS TOPICRemoving Unused Controls and EventHandlers

    NEXT TOPICModifying Control EventHandlers

    PREVIOUS TOPICConfiguring Selection and Numberbox Controls

    NEXT TOPICModifying Numberbox and Button Control Event Handlers

    PREVIOUS TOPICModifying Control Event Handlers

    NEXT TOPICAdding Visual Cues

    PREVIOUS TOPICModifying Numberbox and Button Control Event Handlers

    NEXT TOPICAdding Icons to Title Bar and Controls

    PREVIOUS TOPICAdding Visual Cues

    NEXT TOPICChanging Alignment ofControls

    PREVIOUS TOPICAdding Icons to Title Bar and Controls

    Page 20 of 39Custom PropertyManager Page Add-in Tutorial Overview

    02-05-2015file:///C:/Users/Nieve/AppData/Local/Temp/~hh1148.htm

  • various directories.

    1. Ensure that you have installed Microsoft Visual Studio .NET (2008 or later) and a compatible version of Microsoft .NET Framework.

    2. For instructions on how to download the SolidWorks API SDK, open API Help > SolidWorks API Help > Getting Started > Overview.

    3. Click Next on the Welcome to the InstallShield Wizard for SolidWorks API SDK page.

    4. Click Install on the Ready to Install the Program page.

    5. Click Finish on the InstallShield Wizard Completed page.

    Use the SolidWorks SwVBAddin template from the SolidWorks API SDK to create a VB.NET add-in project in Microsoft Visual Studio.

    1. Open Microsoft Visual Studio.

    2. Verify that Tools > Options > Project and Solutions > General > Save new projects when created is selected.

    3. Create a new Visual Basic project in Microsoft Visual Studio.

    4. Locate and select the SolidWorks add-in template, SwVBAddin, from the list of Visual Basic installed templates.

    5. Type PropertyManagerPageAddin in Name.

    6. Browse to the folder where to save the project in Location.

    7. Click OK.

    Solution Explorer displays a VB.NET add-in project tree.

    8. Click Show All Files in Solution Explorer to view all of the references, add-in classes, and bitmap files that you can use or modify for your application.

    References

    VB.NET Add-in Classes

    Bitmap Files

    Compile and run the add-in that is created by the SolidWorks SwVBAddin template.

    1. Ensure that no SolidWorks sessions are running.

    2. To debug in Visual Studio, point the debugger's start program to your SolidWorks executable by right-clicking the project in Solution Explorer.

    3. Select Properties, click the Debug tab, select Start external program, and click to navigate to the SolidWorks executable on your system.

    4. Click Start Debugging in the Microsoft Visual Studio IDE toolbar to compile and run the add-in and start SolidWorks.

    Using the SolidWorks VB.NET Add-in Template

    Compiling and Running the Add-in

    NEXT TOPICInstalling the SolidWorks API SDK

    PREVIOUS TOPICInstalling the SolidWorks API SDK

    NEXT TOPICCompiling and Running the Add-in

    PREVIOUS TOPICUsing the SolidWorks C# Add-in Template

    NEXT TOPICDesigning a PropertyManager Page

    PREVIOUS TOPICCompiling and Running the Add-in

    NEXT TOPICExpanding a Group onStartup

    PREVIOUS TOPICDesigning a PropertyManager Page

    NEXT TOPICChanging Titles and Location of Controls

    PREVIOUS TOPICExpanding a Group on Startup

    NEXT TOPICAdding a Button Control

    PREVIOUS TOPICChanging Titles and Location of Controls

    NEXT TOPICAdding Multiple Tabs