cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Mathcad API and functions y(x)

SOLVED
Tilman
1-Newbie

Mathcad API and functions y(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

1 ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:Tilman)

You can't access functons via the API, only variables.

View solution in original post

2 REPLIES 2
RichardJ
19-Tanzanite
(To:Tilman)

You can't access functons via the API, only variables.

View solution in original post

Thank you, at least it was not my fault. Using a workaround already!

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."