Thank you!

ModelDoc2 mDoc = swApp.ActiveDoc as ModelDoc2;

EquationMgr eMgr = mDoc.GetEquationMgr();

eMgr.Add(0, "TEST=5.25");

eMgr.set_Equation(0, "TEST2=6.75");

Equations in my part has about 20 global variables. How can I get the index of each global variable in equations?

Qingbo,

You need to look in the IEquationMgr interface. It has members like IEquationMgr::GetCount, which gets the number of equations, and IEquationMgr::Equation, which gets the equation at a specified index.

Keith

Video Tutorials for the SolidWorks API

sorry jim,

i think the answer is wrong,because there is no such function like set_equation in equation manager

This is read-write property if you are working from VBA/VB.NET/C# and get_Equation/set_Equation for c++.

Check also ::Value property.

______________________

Regards,

Artem Taturevych

Application Engineer at Intercad

http://intercad.com.au/

Tel: +61 2 9454 4444

ModelDoc2 mDoc = swApp.ActiveDoc as ModelDoc2;

EquationMgr eMgr = mDoc.GetEquationMgr();

eMgr.Add(0, "TEST=5.25");

eMgr.set_Equation(0, "TEST2=6.75");