Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hello,
I´m having troubles using the MathCAD API to evaluate functions in a worksheet. Maybe someone here can help me?
I´d like to geht the following to work:
In my MathCAD Worksheet I got: y(x):= 2x
And now I´d like to access this function using the API
MCAppl = new Mathcad.Application();
MCWs = MCAppl.ActiveWorksheet;
And now evaluate the function, for example
y = MCWs.GetValue("y(3)").Real;
But this command is not working for me. I tried different ways of typing it, but no success.
It works the following way:
Define variable x and put y:=2x in MathCAD
MCWs.SetValue("x", 3);
y = MCWs.GetValue("y").Real;
But I already got a big document using functions, rewriting the whole document is not an option. So is there any way to evaluate functions using the API? Or is this a bug in Mathcad or its API?
I´d prefer using python for the API, but C# is also an option. Doesn´t seem to much difference between the two when accessing Mathcad. Right now I´m on Mathcad 14.0M20, a short testing on Mathcad 15 did not change anything.
Any clues?
Thanks already for any hints!
Tilman
Solved! Go to Solution.
You can't access functons via the API, only variables.
You can't access functons via the API, only variables.
Thank you, at least it was not my fault. Using a workaround already!