Hide Table of Contents
IAdd3 Method (IEquationMgr)

Adds an equation at the specified index for the specified configurations.

.NET Syntax

Visual Basic (Declaration) 
Function IAdd3( _
   ByVal Index As System.Integer, _
   ByVal Equation As System.String, _
   ByVal Solve As System.Boolean, _
   ByVal WhichConfigurations As System.Integer, _
   ByVal ConfigCount As System.Integer, _
   ByRef ConfigNames As System.String _
) 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 WhichConfigurations As System.Integer
Dim ConfigCount As System.Integer
Dim ConfigNames As System.String
Dim value As System.Integer
 
value = instance.IAdd3(Index, Equation, Solve, WhichConfigurations, ConfigCount, ConfigNames)
C# 
System.int IAdd3( 
   System.int Index,
   System.string Equation,
   System.bool Solve,
   System.int WhichConfigurations,
   System.int ConfigCount,
   ref System.string ConfigNames
)
C++/CLI 
System.int IAdd3( 
&   System.int Index,
&   System.String^ Equation,
&   System.bool Solve,
&   System.int WhichConfigurations,
&   System.int ConfigCount,
&   System.String^% ConfigNames
) 

Parameters

Index
0-based 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 to solve it later (see Remarks)
WhichConfigurations
Configuration option as defined in swInConfigurationOpts_e (see Remarks)
ConfigCount
Number of names in the ConfigNames array
ConfigNames
  • in-process, in-process, unmanaged C++: Pointer to an array of strings containing configuration names
  • VBA, VB.NET, C#, and C++/CLI: Not supported 

See In-process Methods for details about this type of method.

Return Value

Index of the new equation, -1 if error

Remarks

This method only works for parts having multple configurations created in SOLIDWORKS 2014 or later. Use this method to add dimension equations, component equations, or global variable assignments to various configurations of models. If you don't have multiple configurations, then call IEquationMgr::Add2, which does not support configurations and is slightly faster.

 

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:

  • 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.
  • directly to an assembly component's model, you must call IAssemblyDoc::EditPart2 before calling this method.

You can add a dimension equation whose left-hand side already exists, but only if the existing equation is suppressed. Adding the equation again unsuppresses it. See IEquationMgr::ChangeSuppressionForAllConfigurations and IEquationMgr::ChangeSuppressionForConfiguration.

Setting Solve 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 IEquationMgr::EvaluateAll or IModelDoc2::EditRebuild3.

When adding global variable assignments and component equations, WhichConfigurations must be set to swInConfigurationOpts_e.swAllConfiguration. 

If you add a global variable assignment that already exists, this method returns an error.

To modify an equation added by this method, call IEquationMgr::ISetEquationAndConfigurationOption.

 

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

Availability

SOLIDWORKS 2014 FCS, Revision Number 22.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

 
*Email:  
Subject:   Feedback on Help Topics
Page:   IAdd3 Method (IEquationMgr)
*Comment:  
*   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:



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