Hide Table of Contents
IInsertMacroFeature3 Method (IFeatureManager)

Inserts a macro feature in this model.

.NET Syntax

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


Name of the base feature (see Remarks)
Indicates callback object (see Remarks)
Null; valid only for VBA
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 strings of the file names for the icons (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.



If creating a macro feature using...

Then ProgId is...

COM callback methods

The name of 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. These methods support the macro feature's rebuild, edit, and security functions.



Only these dimension types are supported by this method:

  • swAngularDimension

  • swLinearDimension

  • swRadialDimension


The array of the file names for the icons can contain either three or nine strings.

Number of strings in array Types of images in this order Image format and sizes
  1. Regular
  2. Suppressed
  3. Highlighted
  • Windows bitmap (*.bmp) format
  • 16 pixels wide X 18 pixels high



  • This size array is only valid for macro features created in parts, assemblies, and drawings in SOLIDWORKS 2017 and later.
  • SOLIDWORKS displays the appropriate images based on the current DPI setting of the display device.
  1. Regular small
  2. Suppressed small
  3. Highlighted small
  4. Regular medium
  5. Suppressed medium
  6. Highlighted medium
  7. Regular large
  8. Suppressed large
  9. Highlighted large


  • Windows bitmap (*.bmp) format
  • Recommended sizes are:
    • Small: 20 pixels wide X 20 pixels high
    • Medium: 32 pixels wide X 32 pixels high
    • Large: 40 pixels wide X 40 pixels high

You can specify either the full path name or just the file name for the strings; for example, c:\bitmaps\icon1.bmp or icon1.bmp.


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) 2018 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.