Hide Table of Contents
IInsertMacroFeature3 Method (IFeatureManager)

Inserts a macro feature in this model.

.NET Syntax

Visual Basic (Declaration) 
Function IInsertMacroFeature3( _
   ByVal BaseName As String, _
   ByVal ProgId As String, _
   ByRef MacroMethods As String, _
   ByVal ParamCount As Integer, _
   ByRef ParamNames As String, _
   ByRef ParamTypes As Integer, _
   ByRef ParamValues As String, _
   ByVal DimCount As Integer, _
   ByRef DimTypes As Integer, _
   ByRef DimCountValues As Double, _
   ByVal BodyCount As Integer, _
   ByRef EditBodies As Body2, _
   ByVal IconCount As Integer, _
   ByRef IconFiles As String, _
   ByVal Options As Integer _
) As Feature
Visual Basic (Usage) 
Dim instance As IFeatureManager
Dim BaseName As String
Dim ProgId As String
Dim MacroMethods As String
Dim ParamCount As Integer
Dim ParamNames As String
Dim ParamTypes As Integer
Dim ParamValues As String
Dim DimCount As Integer
Dim DimTypes As Integer
Dim DimCountValues As Double
Dim BodyCount As Integer
Dim EditBodies As Body2
Dim IconCount As Integer
Dim IconFiles As String
Dim Options As Integer
Dim value As Feature
value = instance.IInsertMacroFeature3(BaseName, ProgId, MacroMethods, ParamCount, ParamNames, ParamTypes, ParamValues, DimCount, DimTypes, DimCountValues, BodyCount, EditBodies, IconCount, IconFiles, Options)
Feature IInsertMacroFeature3( 
   string BaseName,
   string ProgId,
   ref string MacroMethods,
   int ParamCount,
   ref string ParamNames,
   ref int ParamTypes,
   ref string ParamValues,
   int DimCount,
   ref int DimTypes,
   ref double DimCountValues,
   int BodyCount,
   ref Body2 EditBodies,
   int IconCount,
   ref string IconFiles,
   int Options
Feature^ IInsertMacroFeature3( 
&   String^ BaseName,
&   String^ ProgId,
&   String^% MacroMethods,
&   int ParamCount,
&   String^% ParamNames,
&   int% ParamTypes,
&   String^% ParamValues,
&   int DimCount,
&   int% DimTypes,
&   double% DimCountValues,
&   int BodyCount,
&   Body2^% EditBodies,
&   int IconCount,
&   String^% IconFiles,
&   int Options


Name of the base feature (see Remarks)
Indicates whether to use COM or VBA callback methods (see Remarks)
Array of strings of size 9 (see Remarks)
Number of parameters
Array of strings of the parameters of size ParamCount
Array of the types of parameters of size paramCount as defined by swMacroFeatureParamType_e
Array of strings of the values of parameters of size ParamCount
Number of dimensions
Array of the types of dimensions as defined by swDimensionType_e (see Remarks)
Array of doubles of the values of dimensions of size DimCount
Number of bodies to modify in the macro feature
Array of IBody2 objects to modify in the macro feature
Number of icons
Array of 3 strings (see Remarks)
Placement of the macro feature in the FeatureManager design tree as defined by swMacroFeatureOptions_e (see Remarks)

Return Value

Pointer to the IFeature object



    • The argument BaseName is serialized within the feature and cannot be changed.
    • You can find out the name of the base feature by using IMacroFeatureData::GetBaseName.
    • The BaseName argument is also used to generate the name of the feature when the feature is first created.




To create a macro feature using the OLE version from VB or VBA...

Then the input arguments should be...

COM callback methods

The ProgId argument is the name of the program ID for the component that implements the COM callback methods. The object that is represented by ProgID must support the IswComFeature interface.


InsertMacroFeature3 ("Sample", "Sample.MyFeature", _

          Nothing, paramNames, paramTypes, _

               paramValues, dimTypes, dimValues, _

                   editBodies, iconFiles, _


In the COM server, the Sample.Feature class is derived or supports the ISwComFeature interface methods. These methods support the macro feature's rebuild, edit, and security functions.

VBA callback methods

InsertMacroFeature3 ( "", callBackMethods ... )






The macroMethods argument is implemented from VBA only and is a nine (9) element array of strings consisting of the following values:

    1. Filename - File executed during feature generation.

    2. Module - Source module executed during feature generation.

    3. Procedure - Source procedure executed during feature generation.

    4. Filename - File executed after edit definition is selected.

    5. Module - Source module executed after edit definition is selected.

    6. Procedure - Source procedure executed after edit definition is selected.

    7. Filename - File executed while querying security; optional, see the next paragraph.

    8. Module - Source Module executed while querying security; optional, see the next paragraph.

    9. Procedure - Source Procedure executed while querying security; optional, see the next paragraph.

Filename should be the full pathname to the macro file. If the procedures are all self-contained in the same macro file that calls IFeatureManager::InsertMacroFeature3, then a call to ISldWorks::GetCurrentMacroPathName will provide all of the information necessary for the Filename.

If a security procedure is not used, then Filename, Module, and Procedure must all be empty strings.

Procedure names must have an swm prefix in the name. This prefix identifies the procedures to execute. 


Only these dimension types are supported by this method:

  • swAngularDimension

  • swLinearDimension

  • swRadialDimension


Object containing an array of three strings that refer to Windows bitmap images for the regular, suppressed, and highlighted images for the custom macro feature icon.

  • Images must be Windows bitmap (*.bmp) format and be 16 pixels wide X 18 pixels high

  • Either the full pathname or only the filename can be used; for example, c:\bitmaps\icon1.bmp or icon1.bmp.

  • The first string in the array is for the regular icon bitmap, the second string is for suppressed icon bitmap, and the third string is for highlighted icon bitmap.


swMacroFeatureOptions_e.swMacroFeatureEmbedMacroFile is not supported by programming languages for the Microsoft .NET Framework; for example, not supported by C#, Visual Basic .NET, or Managed C++.

See Overview of Macro Features for more information.


See Also


SolidWorks 2007 FCS, Revision Number 15.0

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

Subject:   Feedback on Help Topics
Page:   IInsertMacroFeature3 Method (IFeatureManager)
*   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:


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

Web Help Content Version: API Help (English only) 2012 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.