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
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.
Click the New
Project button.
Select Visual
C++ Projects in Project Types.
Select SolidWorks
COM Addin in Templates.
Enter the name of your project in Name.
Click OK.
Type the name of your add-in in Short
name. The other fields are automatically filled in using this name.
Click Options.
Under Threading,
select the threading option for the project.
Under Interface,
select whether or not to add the oleautomation
attribute to your code by selecting Automation
Compatible.
Click SwOptions.
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:
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.
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.
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
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.
Click the New
Project button.
Select Visual
C++ Projects in Project Types.
Select SolidWorks
COM Non-Attributed Addin in Templates.
Enter the name of your project in Name.
Click OK.
Type the name of your add-in in Short
name. The other fields are automatically filled in using this name.
Click Options.
Under Threading,
select the threading option for the project.
Under Interface,
select whether or not to add the oleautomation
attribute to your code by selecting Automation
Compatible.
Click SwOptions.
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:
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.
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.
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