Deleting equations in SW API

Hi all,

I'm using the following code to add an equation in my assembly:

Dim swEquationMgr As EquationMgr

swEquationMgr = swModel.GetEquationMgr()

Const EQUATION_TEMPLATE As String = """{0}""=""{1}"""

Dim equation As String = String.Format(EQUATION_TEMPLATE, a, b)

Dim i As Integer = swEquationMgr.Add(-1, equation)

swModel.ForceRebuild3(False)

where 'a' and 'b' are string as:

 

a = D1@Sketch3@NP1.Part

b = D1@Sketch2@NP_Nut.Part

Now I want to delete this equation and I am using:

swEquationMgr.Delete(-1)



but getting error:

The embedded interop type 'Delete' does not contain a definition for 'SolidWorks.Interop.sldworks.EquationMgr' since it was not used in the compiled assembly. Consider casting to object or changing the 'Embed Interop Types' property to true.

Any pointers?

Thanks.

Mo

SolidworksApi macros