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

C#
```System.int Add2(
System.int Index,
System.string Equation,
System.bool Solve
)```
C++/CLI
```System.int Add2(
&   System.int Index,
&   System.String^ Equation,
&   System.bool Solve
) ```

#### Parameters

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

#### Return Value

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

# Remarks

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.

# Availability

SolidWorks 2010 FCS, Revision Number 18.0

Provide feedback on this topic

* Required

 *Email: Subject: Feedback on Help Topics Page: Add2 Method (IEquationMgr) *Comment:

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) 2014 SP05

The search functionality within the web help is in a beta test phase and you may experience periodic delays or interruptions in its performance. These are the normal and ordinary features of a beta test and shall not under any circumstances give rise to any liability on the part of Dassault Systèmes SolidWorks Corporation or its licensors. The topics within the Web-based help are not beta topics; they document API Help (English only) 2014 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.