Hide Table of Contents

Using SolidWorks COM and SolidWorks COM Non-Attributed Add-in Wizards to Create C++/CLI Add-in

This topic describes how to use the SolidWorks COM Addin Wizard and the SolidWorks COM Non-Attributed Addin Wizard to create Visual C++/CLI add-ins in Microsoft Visual Studio .NET 2005 or 2008.

  • SolidWorks COM Addin Wizard: This add-in wizard uses attributed C++, which prohibits the use of MFC with an ATL add-in because both ATL and MFC provide a dllmain. Only one dllmain is allowed.

  • SolidWorks COM Non-Attributed Addin Wizard: The non-attributed add-in does not provide a dllmain function; thus, you can use MFC objects with a non-attributed add-in.

The SolidWorks COM Addin Wizard and SolidWorks COM Non-Attributed Addin Wizard are included in the SolidWorks API SDK.

Click the link associated with the add-in you want to use:

Creating a Visual C++/CLI Add-in Using the SolidWorks COM Addin Wizard

  1. Click Start, Programs, Microsoft Visual Studio 2005, and Microsoft Visual Studio 2005.

    - or -

    Click Start, Programs, Microsoft Visual Studio 2008, and Microsoft Visual Studio 2008.
     

  2. Click the New Project button.

    1. Select Visual C++ Projects in Project Types.

    2. Select SolidWorks COM Addin in Templates.  

    3. Enter the name of your project in Name.

    4. Click OK.

  3. Type the name of your add-in in Short name. The other fields are automatically filled in using this name.

  4. Click Options.

    1. Under Threading, select the threading option for the project.

    2. Under Interface, select whether or not to add the oleautomation attribute to your code by selecting Automation Compatible.

  5. Click SwOptions.

    1. Under AddinEvents, select the events for which you want to listen:  

      • SolidWorks Events. Fired by the SolidWorks application.

      • Part Events. Fired by individual part documents.

      • Assembly Events. Fired by individual assembly documents.

      • Drawing Events. Fired by individual drawing documents.

      • Model View Events. Fired by individual model views in each document.

It is recommended that you leave the SolidWorks Events check box selected because:

    • This check box must be selected to listen to any of the other events.

    • You can use this event's code as sample code if you decide to include event handling in the future.  

Model views are created in individual documents. To listen for a model view event, you must be listening to the basic document. Thus, the Model View Events check box is not available until you select at least one of these check boxes: Part Events, Assembly Events, or Drawing Events.

    1. Under Addin User Interface, select Create Property Page to include an add-in PropertyManager page. This page is displayed in the SolidWorks application and should contain controls to extend the add-in's user interface.  

  1. Click Finish.

Wait for the SolidWorks COM Add-in Wizard to customize your add-in and set up the project.

Examining Visual C++/CLI Add-In Files Created by SolidWorks COM Addin Wizard

Back to top

 

Creating a Visual C++/CLI Add-in Using the SolidWorks COM Non-Attributed Addin Wizard

  1. Click Start, Programs, Microsoft Visual Studio 2005, and Microsoft Visual Studio 2005.

    - or -

    Click Start, Programs, Microsoft Visual Studio 2008, and Microsoft Visual Studio 2008.

  2. Click the New Project button.

    1. Select Visual C++ Projects in Project Types.

    2. Select SolidWorks COM Non-Attributed Addin in Templates.  

    3. Enter the name of your project in Name.

    4. Click OK.

  3. Type the name of your add-in in Short name. The other fields are automatically filled in using this name.

  4. Click Options.

    1. Under Threading, select the threading option for the project.

    2. Under Interface, select whether or not to add the oleautomation attribute to your code by selecting Automation Compatible.

  5. Click SwOptions.

    1. Under AddinEvents, select the events for which you want to listen:  

      • SolidWorks Events. Fired by the SolidWorks application.

      • Part Events. Fired by individual part documents.

      • Assembly Events. Fired by individual assembly documents.

      • Drawing Events. Fired by individual drawing documents.

      • Model View Events. Fired by individual model views in each document.

It is recommended that you leave the SolidWorks Events check box selected because:

    • This check box must be selected to listen to any of the other events.

    • You can use this event's code as sample code if you decide to include event handling in the future.  

Model views are created in individual documents. To listen for a model view event, you must be listening to the basic document. Thus, the Model View Events check box is not available until you select at least one of these check boxes: Part Events, Assembly Events, or Drawing Events.

    1. Under Addin User Interface, select Create Property Page to include an add-in PropertyManager page. This page is displayed in the SolidWorks application and should contain controls to extend the add-in's user interface.  

  1. Click Finish.

Wait for the SolidWorks COM Non-Attributed Addin Wizard to customize your add-in and set up the project.

Examining Visual C++.CLI Add-In Files Created by SolidWorks COM Non-Attributed Addin Wizard

Back to top



Provide feedback on this topic

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

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Using SolidWorks C++ COM Add-In Wizard
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

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

 Never show this message again
x

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

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

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