Hide Table of Contents
Add2 Method (IEquationMgr)

Adds an equation at the specified index.

.NET Syntax

Visual Basic (Declaration) 
Function Add2( _
   ByVal Index As System.Integer, _
   ByVal Equation As System.String, _
   ByVal Solve As System.Boolean _
) As System.Integer
Visual Basic (Usage) 
Dim instance As IEquationMgr
Dim Index As System.Integer
Dim Equation As System.String
Dim Solve As System.Boolean
Dim value As System.Integer
value = instance.Add2(Index, Equation, Solve)
System.int Add2( 
   System.int Index,
   System.string Equation,
   System.bool Solve
System.int Add2( 
&   System.int Index,
&   System.String^ Equation,
&   System.bool Solve


0-based index of the new equation (-1 places it at the end of the list)
String containing the equation (see Remarks)
True to solve the equation immediately; false otherwise (see Remarks)

Return Value

Index of the new equation if successfully added, -1 if an error



To add an equation using the SOLIDWORKS user interface, you must embed the names of dimensions and global variables in double quotes:


  • Global variable assignment:
    "B" = 2    
  • Component equation:
    "N_SPOKES@CirPattern" = "BARLENGTH@Sketch2" /10 
  • Dimension equation that uses the Visual Basic IIf function:
    "D1@Extrude2" = (IIf("D1@Extrude3">20, 15, 6))+5
  • Dimension equation that sets a dimension to the current value:
    "D1@Extrude2" =

NOTE: To add an equation using this method, you must specify Equation with the names of dimensions and global variables in double double quotes and the entire equation in double quotes. See the Examples.

If you call this method to add an equation whose left-hand side already exists in another equation, this method returns an error.

Setting the Solve argument to false delays evaluation of this equation, which enhances performance when there are many equations to solve. When Solve is set to false, the equation appears in the FeatureManager design tree only after calling IEquationaMgr::EvaluateAll or IModelDoc2::EditRebuild3.

To add equations to models having multiple configurations created in SOLIDWORKS 2014 or later, use IEquationMgr::Add3 instead of this method.


When you add an equation, you are adding it to the list of relations. Thus, do not add an equation while traversing the equations in a model, because SOLIDWORKS could crash.


See Also


SOLIDWORKS 2010 FCS, Revision Number 18.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:   Add2 Method (IEquationMgr)
*   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) 2017 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.